Decompiled source of Deluxe Particles v0.1.2

Plugins/VentureValheim.DeluxeParticles.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VentureValheim.DeluxeParticles")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VentureValheim.DeluxeParticles")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2F226E24-FC17-4AB5-B591-5E08CE4448FD")]
[assembly: AssemblyFileVersion("0.1.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace VentureValheim.DeluxeParticles
{
	[BepInPlugin("com.orianaventure.mod.DeluxeParticles", "DeluxeParticles", "0.1.2")]
	public class DeluxeParticlesPlugin : BaseUnityPlugin
	{
		private const string ModName = "DeluxeParticles";

		private const string ModVersion = "0.1.2";

		private const string Author = "com.orianaventure.mod";

		private const string ModGUID = "com.orianaventure.mod.DeluxeParticles";

		private readonly Harmony HarmonyInstance = new Harmony("com.orianaventure.mod.DeluxeParticles");

		public static readonly ManualLogSource DeluxeParticlesLogger = Logger.CreateLogSource("DeluxeParticles");

		public void Awake()
		{
			DeluxeParticlesLogger.LogInfo((object)"Initializing DeluxeParticles!");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			HarmonyInstance.PatchAll(executingAssembly);
		}
	}
	public class DeluxeParticles
	{
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		public static class Patch_ObjectDB_Awake
		{
			[HarmonyPriority(0)]
			private static void Postfix()
			{
				//IL_0000: 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)
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name.Equals("main"))
				{
					Deluxify();
					DeluxeParticlesPlugin.DeluxeParticlesLogger.LogInfo((object)"Done deluxifying particles.");
				}
			}
		}

		private static readonly DeluxeParticles _instance = new DeluxeParticles();

		public static DeluxeParticles Instance => _instance;

		private DeluxeParticles()
		{
		}

		private static void Deluxify()
		{
			//IL_0026: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> items = ObjectDB.m_instance.m_items;
			for (int i = 0; i < items.Count; i++)
			{
				ParticleSystem component = items[i].GetComponent<ParticleSystem>();
				if ((Object)(object)component != (Object)null)
				{
					MainModule main = component.main;
					((MainModule)(ref main)).startLifetime = new MinMaxCurve(3f);
					((MainModule)(ref main)).startSize = new MinMaxCurve(0.6f, 0.8f);
					((MainModule)(ref main)).maxParticles = 3;
					EmissionModule emission = component.emission;
					((EmissionModule)(ref emission)).rateOverTime = new MinMaxCurve(1f);
				}
			}
		}
	}
}