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 UltimateReviveFixed v1.0.1
plugins/yazirushi-UltimateReviveFixed/ultimaterevivefixed.dll
Decompiled a year agousing System; 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 Photon.Realtime; using UltimateRevive.Patches; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ultimaterevivefixed")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ultimaterevivefixed")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b0f8e056-5974-443a-8f81-603a9700ac2f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace UltimateRevive.Patches { internal class ConfigManager { public static ConfigEntry<int> hpCost; public static ConfigEntry<string> reviveKey; public static void Initialize(ConfigFile cfg) { hpCost = cfg.Bind<int>("Revive HP Settings", "StaminaCost", 20, "The amount of hp consumed when reviving."); reviveKey = cfg.Bind<string>("Controls", "ReviveKey", "h", "The key used to trigger a revive."); } } [HarmonyPatch(typeof(PhysGrabCart))] internal class PhysGrabCartPatch { private static readonly FieldInfo playerNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName"); private static readonly FieldRef<PlayerHealth, int> healthRef = AccessTools.FieldRefAccess<PlayerHealth, int>("health"); [HarmonyPatch("Update")] [HarmonyPostfix] private static void DisplayText() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.RunIsShop() || !PlayerControllerPatch.isGrab) { return; } PlayerDeathHead grabHead = PlayerControllerPatch.grabHead; if ((Object)(object)grabHead?.playerAvatar == (Object)null) { return; } string arg = playerNameField.GetValue(grabHead.playerAvatar)?.ToString(); PlayerHealth val = PlayerController.instance?.playerAvatarScript?.playerHealth; if (!((Object)(object)val == (Object)null)) { int num = healthRef.Invoke(val); int value = ConfigManager.hpCost.Value; string value2 = ConfigManager.reviveKey.Value; if (num < value) { ItemInfoExtraUI.instance.ItemInfoText($"Your HP is below {value}", Color.red); } else { ItemInfoExtraUI.instance.ItemInfoText($"Press [{value2}] to revive {arg} with {value} HP", new Color(0.2f, 0.8f, 0.1f)); } } } } [HarmonyPatch(typeof(PlayerController))] internal class PlayerControllerPatch { public static PlayerDeathHead grabHead; public static bool isGrab; [HarmonyPatch("FixedUpdate")] [HarmonyPostfix] private static void PlayerGrabHeadPatch(PlayerController __instance) { if ((Object)(object)__instance == (Object)null) { return; } if (__instance.physGrabActive && (Object)(object)__instance.physGrabObject != (Object)null) { PlayerDeathHead component = __instance.physGrabObject.GetComponent<PlayerDeathHead>(); if ((Object)(object)component?.playerAvatar != (Object)null) { grabHead = component; isGrab = true; return; } } isGrab = false; } } internal class ReviveManager : MonoBehaviourPun { private static readonly FieldInfo extractionField = AccessTools.Field(typeof(PlayerDeathHead), "inExtractionPoint"); private static readonly FieldRef<PlayerHealth, int> healthRef = AccessTools.FieldRefAccess<PlayerHealth, int>("health"); private void Update() { if (!TryGetKeyDown(ConfigManager.reviveKey.Value)) { return; } PlayerDeathHead grabHead = PlayerControllerPatch.grabHead; if ((Object)(object)grabHead == (Object)null || !PlayerControllerPatch.isGrab) { return; } PlayerHealth val = PlayerController.instance?.playerAvatarScript?.playerHealth; if ((Object)(object)val == (Object)null) { return; } int num = healthRef.Invoke(val); int value = ConfigManager.hpCost.Value; if (num < value) { return; } PhotonView component = ((Component)grabHead).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { Player owner = component.Owner; int num2 = ((owner != null) ? owner.ActorNumber : (-1)); if (num2 >= 0) { ((MonoBehaviourPun)this).photonView.RPC("RPC_RequestRevive", (RpcTarget)2, new object[2] { num2, value }); } } } private bool TryGetKeyDown(string keyString) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse<Key>(keyString, ignoreCase: true, out Key result)) { KeyControl val = Keyboard.current[result]; return val != null && ((ButtonControl)val).wasPressedThisFrame; } return false; } [PunRPC] private void RPC_RequestRevive(int actorId, int cost) { if (!PhotonNetwork.IsMasterClient) { return; } PlayerDeathHead[] array = Object.FindObjectsOfType<PlayerDeathHead>(); PlayerDeathHead[] array2 = array; foreach (PlayerDeathHead val in array2) { PhotonView component = ((Component)val).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.Owner != null && component.Owner.ActorNumber == actorId) { DoRevive(val, cost); break; } } } private void DoRevive(PlayerDeathHead head, int cost) { if (!((Object)(object)head == (Object)null)) { PlayerHealth val = PlayerController.instance?.playerAvatarScript?.playerHealth; if (!((Object)(object)val == (Object)null) && !(bool)extractionField.GetValue(head)) { extractionField.SetValue(head, true); head.Revive(); val.Hurt(cost, true, -1); extractionField.SetValue(head, false); } } } } internal class ShopManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void KeyboardListener(ShopManager __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<ReviveManager>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<ReviveManager>(); Debug.Log((object)"[UltimateRevive] Added keyboard event listener"); } } } } namespace UltimateReviveFixed { [BepInPlugin("yazirushi.UltimateReviveFixed", "REPO Ultimate Revive Fixed", "1.0.0")] public class UltimateRevive : BaseUnityPlugin { private const string modGUID = "yazirushi.UltimateReviveFixed"; private const string modName = "REPO Ultimate Revive Fixed"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("yazirushi.UltimateReviveFixed"); private static UltimateRevive Instance; internal ManualLogSource mls; private void Awake() { Instance = this; ConfigManager.Initialize(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[yazirushi] Ultimate Revive Fixed Initialized."); harmony.PatchAll(typeof(UltimateRevive)); harmony.PatchAll(typeof(ShopManagerPatch)); harmony.PatchAll(typeof(PlayerControllerPatch)); harmony.PatchAll(typeof(PhysGrabCartPatch)); } } }