Decompiled source of CloudCoverage v1.0.1

CloudCoverage.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 BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using WildSkies.Service;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CloudCoverage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("CloudCoverage")]
[assembly: AssemblyTitle("CloudCoverage")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 CloudCoverage
{
	[BepInPlugin("CloudCoverage", "CloudCoverage", "1.0.1")]
	public class Plugin : BasePlugin
	{
		private class CloudCoverageSimpleChatCommands
		{
			public static string ScrollMultiplier(float value)
			{
				if (value == -1f)
				{
					CloudVolume_ScrollMultiplier.Value = (float)((ConfigEntryBase)CloudVolume_ScrollMultiplier).DefaultValue;
				}
				else
				{
					CloudVolume_ScrollMultiplier.Value = value;
				}
				return $"CloudCoverage scrollMultiplier now set to {value}.";
			}
		}

		internal static ManualLogSource Log;

		internal static Harmony harmonyInstance;

		private static ConfigEntry<float> CloudVolume_ScrollMultiplier;

		private static SceneService SceneService;

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CloudCoverage");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			CloudVolume_ScrollMultiplier = ((BasePlugin)this).Config.Bind<float>("CloudCoverage", "ScrollMultiplier", 0.01f, "CloudCoverage.ScrollMultiplier");
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		public override bool Unload()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			return true;
		}

		[HarmonyPatch(typeof(SkyChangeController), "Awake")]
		[HarmonyPostfix]
		public static void SkyChangeController_Awake(SkyChangeController __instance)
		{
			SceneService = ProjectContextInstaller.ResolveObject<SceneService>();
		}

		[HarmonyPatch(typeof(SkyChangeController), "Update")]
		[HarmonyPostfix]
		public static void SkyChangeController_Update(SkyChangeController __instance)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (!SceneService.AreWeLoadingOrInLobby() && Keyboard.current.altKey.isPressed)
			{
				Vector2 val = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue();
				if (val.y != 0f)
				{
					__instance._creativeCloudVolume.m_coverage = Mathf.Clamp(__instance._creativeCloudVolume.m_coverage + val.y * CloudVolume_ScrollMultiplier.Value, 0.15f, __instance._activeProfile.CloudCoverage);
				}
				if (Mouse.current.middleButton.wasPressedThisFrame)
				{
					__instance._creativeCloudVolume.m_coverage = __instance._activeProfile.CloudCoverage;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CloudCoverage";

		public const string PLUGIN_NAME = "CloudCoverage";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}