Decompiled source of Dot Decay Patch v1.0.1

DecayPatch.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sonigon;
using UnboundLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("Systems.R00t.DecayPatch", "Decay Patch", "1.0.1")]
[BepInProcess("Rounds.exe")]
[HarmonyPatch]
public class Patch : BaseUnityPlugin
{
	private const string ModId = "Systems.R00t.DecayPatch";

	private const string ModName = "Decay Patch";

	public const string Version = "1.0.1";

	private void Start()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("Systems.R00t.DecayPatch").PatchAll();
	}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class DOT_Patch : Object
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	private static void Postfix(MonoBehaviour __instance)
	{
		DamageOverTime val = (DamageOverTime)(object)((__instance is DamageOverTime) ? __instance : null);
		if (val != null)
		{
			((Component)val).GetComponent<FixedDamageOverTime>().ActiveDOTs = new List<FixedDamageOverTime.DOT_Instance>();
		}
	}

	[HarmonyPatch("Start")]
	private static void Postfix(DamageOverTime __instance)
	{
		ExtensionMethods.GetOrAddComponent<FixedDamageOverTime>(((Component)__instance).gameObject, false).ActiveDOTs = new List<FixedDamageOverTime.DOT_Instance>();
	}

	[HarmonyPatch("DoDamageOverTime")]
	private static bool Prefix(DamageOverTime __instance, ref IEnumerator __result, ref Vector2 damage, ref Vector2 position, ref float time, ref float interval, ref Color color, ref SoundEvent soundDamageOverTime, ref GameObject damagingWeapon, ref Player damagingPlayer, ref bool lethal)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		__result = ((Component)__instance).GetComponent<FixedDamageOverTime>().DoDamageOverTime(damage, position, time, interval, color, soundDamageOverTime, damagingWeapon, damagingPlayer, lethal);
		return false;
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	private static void Prefix(HealthHandler __instance, bool ignoreBlock)
	{
		((Component)__instance).GetComponent<FixedDamageOverTime>().ignoreBlock = ignoreBlock;
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	private static void Postfix(HealthHandler __instance)
	{
		((Component)__instance).GetComponent<FixedDamageOverTime>().ignoreBlock = false;
	}
}
public class FixedDamageOverTime : MonoBehaviour
{
	public class DOT_Instance : Object
	{
		public Vector2 damage;

		public Vector2 position;

		public float time;

		public float interval;

		public Color color;

		public SoundEvent soundDamageOverTime;

		public GameObject damagingWeapon;

		public Player damagingPlayer;

		public bool lethal;

		public bool ignoreBlock;

		public float damageDealt;

		public float timeFilled;

		public HealthHandler health;

		public CharacterData data;

		internal DOT_Instance(Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon, Player damagingPlayer, bool lethal, bool ignoreBlock)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			this.damage = damage;
			this.position = position;
			this.time = time;
			this.interval = interval;
			this.color = color;
			this.soundDamageOverTime = soundDamageOverTime;
			this.damagingWeapon = damagingWeapon;
			this.damagingPlayer = damagingPlayer;
			this.lethal = lethal;
			this.ignoreBlock = ignoreBlock;
		}

		internal void Trigger()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)soundDamageOverTime != (Object)null && data.isPlaying && !data.dead)
			{
				SoundManager.Instance.Play(soundDamageOverTime, ((Component)data).transform);
			}
			float num = ((Vector2)(ref damage)).magnitude / time * timeFilled;
			num = Mathf.Clamp(num, 0f, ((Vector2)(ref damage)).magnitude - damageDealt);
			damageDealt += num;
			health.DoDamage(((Vector2)(ref damage)).normalized * num, position, color, damagingWeapon, damagingPlayer, true, lethal, ignoreBlock);
		}
	}

	public bool ignoreBlock;

	private HealthHandler health;

	private CharacterData data;

	internal List<DOT_Instance> ActiveDOTs;

	private void Start()
	{
		health = ((Component)this).GetComponent<HealthHandler>();
		data = ((Component)this).GetComponent<CharacterData>();
	}

	public void AddDOT(Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon, Player damagingPlayer, bool lethal)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		AddDOT(damage, position, time, interval, color, soundDamageOverTime, damagingWeapon, damagingPlayer, lethal, ignoreBlock);
	}

	public void AddDOT(Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon, Player damagingPlayer, bool lethal, bool ignoreBlock)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		DOT_Instance dOT_Instance = new DOT_Instance(damage, position, time, interval, color, soundDamageOverTime, damagingWeapon, damagingPlayer, lethal, ignoreBlock);
		dOT_Instance.health = health;
		dOT_Instance.data = data;
		dOT_Instance.Trigger();
		ActiveDOTs.Add(dOT_Instance);
	}

	private void Update()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		if (ActiveDOTs.Count == 0)
		{
			return;
		}
		List<DOT_Instance> val = new List<DOT_Instance>();
		Enumerator<DOT_Instance> enumerator = ActiveDOTs.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				DOT_Instance current = enumerator.Current;
				if (current.timeFilled >= current.interval)
				{
					current.Trigger();
					current.timeFilled = 0f;
				}
				current.timeFilled += Time.deltaTime;
				if (current.damageDealt >= ((Vector2)(ref current.damage)).magnitude)
				{
					val.Add(current);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		if (val.Count > 0)
		{
			ActiveDOTs = Enumerable.ToList<DOT_Instance>(Enumerable.Except<DOT_Instance>((IEnumerable<DOT_Instance>)(object)ActiveDOTs, (IEnumerable<DOT_Instance>)(object)val));
		}
	}

	public void TakeDamageOverTime(Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon = null, Player damagingPlayer = null, bool lethal = true, bool ignoreBlock = false)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		this.ignoreBlock = ignoreBlock;
		((MonoBehaviour)this).StartCoroutine(health.dot.DoDamageOverTime(damage, position, time, interval, color, soundDamageOverTime, damagingWeapon, damagingPlayer, lethal));
		this.ignoreBlock = false;
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator DoDamageOverTime(Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon = null, Player damagingPlayer = null, bool lethal = true)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).GetComponent<FixedDamageOverTime>().AddDOT(damage, position, time, interval, color, soundDamageOverTime, damagingWeapon, damagingPlayer, lethal);
		yield break;
	}
}