Decompiled source of CloudsOfBeyond v0.0.4

plugins/CloudsOfBeyond/CloudsOfBeyond.dll

Decompiled 3 days ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
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.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

[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("CloudsOfBeyond")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+a9df960cbae486926aa03fa225da613ab4592cb0")]
[assembly: AssemblyProduct("CloudsOfBeyond")]
[assembly: AssemblyTitle("CloudsOfBeyond")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.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;
		}
	}
	[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 CloudsOfBeyond
{
	public sealed class CloudsOfBeyond : MonoSingleton<CloudsOfBeyond>
	{
		private static ManualLogSource log = new ManualLogSource("");

		private bool initialized;

		internal static void SetLogger(ManualLogSource logger)
		{
			log = logger;
		}

		public void Update()
		{
			TryInit();
		}

		private bool TryInit()
		{
			if (initialized)
			{
				return true;
			}
			log.LogInfo((object)"CloudsOfBeyond initialized");
			initialized = true;
			return true;
		}
	}
	[BepInPlugin("luaujimmy.CloudsOfBeyond", "CloudsOfBeyond", "0.0.3")]
	public sealed class DebugPatches : BaseUnityPlugin
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Revolver), "ThrowCoin")]
		private static void CoinDebug(Revolver __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((OutdoorLightMaster)Object.FindObjectsOfType(typeof(OutdoorLightMaster))[0]).UpdateSkyboxMaterial();
		}
	}
	[BepInPlugin("luaujimmy.CloudsOfBeyond", "CloudsOfBeyond", "0.0.4")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public static string? AssetPath;

		public static Material? jimmat;

		private static bool debugMode;

		public static string aapath = "hello";

		public void Awake()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			AssetPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Assets");
			if (!Directory.Exists(AssetPath))
			{
				Debug.Log((object)"ASSET IN SAME FOLDER AS DLL");
				AssetPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			}
			debugMode = false;
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
			Addressables.LoadContentCatalogAsync(AssetPath + "\\catalog.json", (string)null).WaitForCompletion();
			Addressables.UpdateCatalogs((IEnumerable<string>)null, true);
			AsyncOperationHandle<Material> val = Addressables.LoadAssetAsync<Material>((object)"Assets/fbm.mat");
			val.Completed += delegate(AsyncOperationHandle<Material> h)
			{
				Debug.Log((object)"Successfully loaded skybox material");
				jimmat = h.Result;
			};
		}

		public void Start()
		{
			CloudsOfBeyond.SetLogger(((BaseUnityPlugin)this).Logger);
		}

		public void Update()
		{
			_ = MonoSingleton<CloudsOfBeyond>.Instance;
		}

		private static Vector4 CreateCloudColorVector()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random();
			float num = 2f;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			while (num > 0f)
			{
				float num5 = (float)random.NextDouble() * num;
				num2 += num5;
				num -= num5;
				float num6 = (float)random.NextDouble() * num;
				num3 += num6;
				num -= num6;
				float num7 = (float)random.NextDouble() * num;
				num4 += num7;
				num -= num7;
			}
			return new Vector4(num2, num3, num4, 0f);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(EndlessGrid), "NextWave")]
		private static void UpdateSkyboxMaterialAfterWave(EndlessGrid __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((OutdoorLightMaster)Object.FindObjectsOfType(typeof(OutdoorLightMaster))[0]).UpdateSkyboxMaterial();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(OutdoorLightMaster), "UpdateSkyboxMaterial")]
		private static void UpdateSkyboxMaterialInit(OutdoorLightMaster __instance)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)jimmat == (Object)null))
			{
				Random random = new Random();
				double num = random.NextDouble() * 0.4;
				if (random.Next(0, 2) == 1)
				{
					num *= -1.0;
				}
				double num2 = random.NextDouble() * 0.25;
				double num3 = random.NextDouble() * 8.0;
				jimmat.SetFloat("_XSpeedCoefficient", (float)num);
				jimmat.SetFloat("_YSpeedCoefficient", (float)num2);
				jimmat.SetFloat("_DeformCoefficient", (float)num3);
				jimmat.SetVector("_Color", CreateCloudColorVector());
				__instance.skyboxMaterial = jimmat;
			}
		}
	}
	public static class PluginInfo
	{
		public const string guid = "luaujimmy.CloudsOfBeyond";

		public const string name = "CloudsOfBeyond";

		public const string version = "0.0.3";
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CloudsOfBeyond";

		public const string PLUGIN_NAME = "CloudsOfBeyond";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace CloudsOfBeyond.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("CloudsOfBeyond.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}