Decompiled source of RavagerDedicatedServerFix v1.0.0

RavagerDedicatedServerFix.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using RedGuyMod.Content.Components;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RavagerDedicatedServerFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RavagerDedicatedServerFix")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ce79dd78-8f54-4f43-97e9-7316fcc23061")]
[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 RavagerDedicatedServerFix
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.RavagerDedicatedServerFix", "RavagerDedicatedServerFix", "1.0.0")]
	public class RavagerDedicatedServerFix : BaseUnityPlugin
	{
		private void Awake()
		{
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
		}

		private void OnLoad()
		{
			GameObject val = BodyCatalog.FindBodyPrefab("RobRavagerBody");
			val.AddComponent<RavagerFixComponent>();
		}
	}
	public class RavagerFixComponent : MonoBehaviour
	{
		private CharacterBody characterBody;

		private RedGuyController controller;

		private bool wasDraining = false;

		private void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			controller = ((Component)this).GetComponent<RedGuyController>();
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)controller) || !Object.op_Implicit((Object)(object)characterBody) || !Object.op_Implicit((Object)(object)NetworkSession.instance) || !((Enum)NetworkSession.instance.flags).HasFlag((Enum)(object)(Flags)2))
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			bool draining = controller.draining;
			if (!wasDraining && draining)
			{
				OnDrainStart();
			}
			wasDraining = draining;
		}

		private void OnDrainStart()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)controller).hasAuthority && Object.op_Implicit((Object)(object)characterBody.healthComponent))
			{
				float num = controller.storedHealth;
				float fullHealth = characterBody.healthComponent.fullHealth;
				Inventory inventory = characterBody.inventory;
				bool flag = Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCount(Items.DrizzlePlayerHelper) > 0;
				if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCount(Items.MonsoonPlayerHelper) > 0)
				{
					num /= 0.6f;
				}
				else if (flag)
				{
					num /= 1.5f;
				}
				float num2 = num / fullHealth;
				characterBody.AddTimedBuffAuthority(Buffs.CrocoRegen.buffIndex, num2 * 10f);
			}
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}