Decompiled source of DotParticleFix v1.0.1

DotParticleFix.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("DotParticleFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DotParticleFix")]
[assembly: AssemblyTitle("DotParticleFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 DotParticleFix
{
	[BepInPlugin("com.Nuxlar.DotParticleFix", "DotParticleFix", "1.0.1")]
	public class DotParticleFix : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			NormalizeParticleScale.OnEnable += new hook_OnEnable(ThankYouGoorakh);
			BurnEffectController.AddFireParticles += new hook_AddFireParticles(ModdedCharFix);
		}

		private void ThankYouGoorakh(orig_OnEnable orig, NormalizeParticleScale self)
		{
			if (!Object.op_Implicit((Object)(object)self.particleSystem))
			{
				orig.Invoke(self);
			}
		}

		private GameObject ModdedCharFix(orig_AddFireParticles orig, BurnEffectController self, Renderer modelRenderer, Transform targetParentTransform)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = orig.Invoke(self, modelRenderer, targetParentTransform);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.transform) && Object.op_Implicit((Object)(object)modelRenderer) && Object.op_Implicit((Object)(object)((Component)modelRenderer).transform))
			{
				float num = Mathf.Max(new float[3]
				{
					((Component)modelRenderer).transform.localScale.x,
					((Component)modelRenderer).transform.localScale.y,
					((Component)modelRenderer).transform.localScale.z
				});
				if (num > 25f && Object.op_Implicit((Object)(object)val.GetComponent<NormalizeParticleScale>()))
				{
					ParticleSystem component = val.GetComponent<ParticleSystem>();
					if (Object.op_Implicit((Object)(object)component))
					{
						MainModule main = component.main;
						MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
						((MinMaxCurve)(ref startSize)).constantMin = ((MinMaxCurve)(ref startSize)).constantMin / num;
						((MinMaxCurve)(ref startSize)).constantMax = ((MinMaxCurve)(ref startSize)).constantMax / num;
						((MainModule)(ref main)).startSize = startSize;
					}
				}
			}
			return val;
		}
	}
}