Decompiled source of ReviveScout v1.2.0

ReviveScout.dll

Decompiled a week ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ReviveScout")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ReviveScout")]
[assembly: AssemblyTitle("ReviveScout")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ReviveScoutMod;

[BepInPlugin("com.revive.scout", "Revive Scout", "1.2.0")]
public class ReviveScout : BaseUnityPlugin
{
	private ConfigEntry<int> CureInjuryAmount;

	private ConfigEntry<int> CursePenalty;

	private ConfigEntry<KeyCode> ReviveKey;

	private ConfigEntry<float> ReviveTime;

	private float reviveTimer;

	private bool isReviving;

	private void Awake()
	{
		CureInjuryAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Revive", "CureInjuryAmount", 20, "Cantidad de Injury curado al revivir");
		CursePenalty = ((BaseUnityPlugin)this).Config.Bind<int>("Revive", "CursePenalty", 15, "Cantidad de Curse aplicada al rescatador");
		ReviveKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Revive", "ReviveKey", (KeyCode)108, "Tecla para revivir");
		ReviveTime = ((BaseUnityPlugin)this).Config.Bind<float>("Revive", "ReviveTime", 3f, "Tiempo (segundos) para revivir manteniendo la tecla");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[ReviveScout] Cargado correctamente (host-side).");
	}

	private void Update()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		if (!IsHost())
		{
			return;
		}
		GameObject val = FindDownedAlly();
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		if (Input.GetKey(ReviveKey.Value))
		{
			reviveTimer += Time.deltaTime;
			if (!isReviving)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"[ReviveScout] Iniciando reanimación...");
				isReviving = true;
			}
			if (reviveTimer >= ReviveTime.Value)
			{
				RevivePlayer(val, GetLocalPlayer());
				reviveTimer = 0f;
				isReviving = false;
			}
		}
		else
		{
			reviveTimer = 0f;
			isReviving = false;
		}
	}

	private bool IsHost()
	{
		return true;
	}

	private GameObject FindDownedAlly()
	{
		return null;
	}

	private GameObject GetLocalPlayer()
	{
		return ((Component)this).gameObject;
	}

	private void RevivePlayer(GameObject target, GameObject rescuer)
	{
		RemoveAllNegativeEffectsExceptInjury(target);
		HealInjury(target, CureInjuryAmount.Value);
		ApplyCurse(rescuer, CursePenalty.Value);
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ReviveScout] {((Object)rescuer).name} revivió a {((Object)target).name}. Curado Injury {CureInjuryAmount.Value}, aplicado Curse {CursePenalty.Value}.");
	}

	private void RemoveAllNegativeEffectsExceptInjury(GameObject player)
	{
	}

	private void HealInjury(GameObject player, int amount)
	{
	}

	private void ApplyCurse(GameObject player, int amount)
	{
	}
}