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 SoulRevive v1.0.0
SoulRevive.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using UnityEngine; [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("SoulRevive")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SoulRevive")] [assembly: AssemblyTitle("SoulRevive")] [assembly: AssemblyVersion("1.0.0.0")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SoulRevive { [BepInPlugin("com.inbox.soulrevive", "Soul Revive", "1.0.0")] public class SoulRevivePlugin : BaseUnityPlugin { private float cooldownTimer; private float hintTimer; private static FieldInfo _grabbedPhysGrabObjectField; private static FieldInfo _deadSetField; private static FieldInfo _healthField; private static FieldInfo _playerNameField; private void Awake() { _grabbedPhysGrabObjectField = typeof(PhysGrabber).GetField("grabbedPhysGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _deadSetField = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _healthField = typeof(PlayerHealth).GetField("health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _playerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Soul Revive loaded! Hold a teammate's head and press H to revive (costs 10 HP). Host only."); } private void Update() { if (cooldownTimer > 0f) { cooldownTimer -= Time.deltaTime; } if (hintTimer > 0f) { hintTimer -= Time.deltaTime; } if (!Object.op_Implicit((Object)(object)PhysGrabber.instance) || !PhysGrabber.instance.grabbed) { return; } object? obj = _grabbedPhysGrabObjectField?.GetValue(PhysGrabber.instance); PhysGrabObject val = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null); if ((Object)(object)val == (Object)null) { return; } PlayerDeathHead component = ((Component)val).GetComponent<PlayerDeathHead>(); if ((Object)(object)component == (Object)null || (Object)(object)component.playerAvatar == (Object)null || !(bool)(_deadSetField?.GetValue(component.playerAvatar) ?? ((object)false)) || !Input.GetKeyDown((KeyCode)104) || cooldownTimer > 0f) { return; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerHealth == (Object)null) { return; } int num = 10; if ((int)(_healthField?.GetValue(instance.playerHealth) ?? ((object)0)) <= num) { return; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { if (hintTimer <= 0f) { hintTimer = 5f; } } else { instance.playerHealth.Hurt(num, false, -1, false); component.playerAvatar.Revive(false); cooldownTimer = 2f; string text = (_playerNameField?.GetValue(component.playerAvatar) as string) ?? "teammate"; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Soul Revive! Sacrificed " + num + " HP to revive " + text)); } } } }