Decompiled source of CoolerHelminth v1.0.0

plugins/CoolerHelminth/CoolerHelminth.dll

Decompiled a day 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 BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using RoR2.ContentManagement;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CoolerHelminth")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+56105bacee8da28544385ec9e9d4f3d8226e786c")]
[assembly: AssemblyProduct("CoolerHelminth")]
[assembly: AssemblyTitle("CoolerHelminth")]
[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 CoolerHelminth
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("CoolerHelminth");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "CoolerHelminth".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Nuxlar.CoolerHelminth", "CoolerHelminth", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "Nuxlar.CoolerHelminth";

		public const string PluginAuthor = "Nuxlar";

		public const string PluginName = "CoolerHelminth";

		public const string PluginVersion = "1.0.0";

		internal static Main Instance { get; private set; }

		public static string PluginDirectory { get; private set; }

		public void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			LoadAssets();
			SceneDirector.Start += new hook_Start(Deredify);
		}

		private void Deredify(orig_Start orig, SceneDirector self)
		{
			//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 == "helminthroost")
			{
				GameObject val = GameObject.Find("CAMERA PARTICLES: AshParticles");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
				GameObject gameObject = ((Component)GameObject.Find("HOLDER: Lighting").transform.Find("Weather, Helminthroost").Find("PP + Amb")).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					SetAmbientLight component = gameObject.GetComponent<SetAmbientLight>();
					component.ambientIntensity = 0.35f;
					component.ApplyLighting();
				}
			}
			orig.Invoke(self);
		}

		private void LoadAssets()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<PostProcessProfile> val = AssetAsyncReferenceManager<PostProcessProfile>.LoadAsset(new AssetReferenceT<PostProcessProfile>(RoR2_DLC2_helminthroost.ppSceneHelminth_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<PostProcessProfile> x)
			{
				//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_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				RampFog setting = x.Result.GetSetting<RampFog>();
				((ParameterOverride<Color>)(object)setting.fogColorEnd).value = new Color(0.25f, 0.2f, 0.18f, 1f);
				((ParameterOverride<Color>)(object)setting.fogColorMid).value = new Color(0.45f, 0.4f, 0.38f, 0.4471f);
				((ParameterOverride<Color>)(object)setting.fogColorStart).value = new Color(0.6f, 0.5f, 0.5f, 0.11f);
				((ParameterOverride<float>)(object)setting.fogIntensity).value = 0.6f;
				((ParameterOverride<float>)(object)setting.fogOne).value = 0.7f;
			};
		}
	}
}