Decompiled source of BringBackRedSand v1.0.1

plugins/com.github.MiiMii1205.BringBackRedSand.dll

Decompiled 2 days 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 Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.MiiMii1205.BringBackRedSand")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+3e13684e929c00a2b80b68eb8869f439b4f2a841")]
[assembly: AssemblyProduct("com.github.MiiMii1205.BringBackRedSand")]
[assembly: AssemblyTitle("BringBackRedSand")]
[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.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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BringBackRedSand
{
	[BepInPlugin("com.github.MiiMii1205.BringBackRedSand", "BringBackRedSand", "1.0.1")]
	public class BringBackRedSandPlugin : BaseUnityPlugin
	{
		private static readonly int TopColor2 = Shader.PropertyToID("_TopColor2");

		private static readonly int TopColor = Shader.PropertyToID("_TopColor");

		private static readonly int TopColor1 = Shader.PropertyToID("_TopColor1");

		private static readonly int TopHueShift = Shader.PropertyToID("_TopHueShifts");

		private static readonly int Tint = Shader.PropertyToID("_Tint");

		private static readonly int BaseColor = Shader.PropertyToID("_BaseColor");

		private static readonly int Color1 = Shader.PropertyToID("_Color1");

		private static readonly Color BloodRedTopColor = new Color(0.592f, 0.102f, 0f, 1f);

		private static readonly Color BloodRedTop2Color = new Color(0.1137255f, 0.007843135f, 0.007843135f, 0.8156863f);

		private static readonly Color BloodRedTop1Color = new Color(0.2901961f, 0.03869281f, 0f, 0.4196078f);

		private static readonly Vector4 HueShift = new Vector4(0.2875f, 0f, 0f, 0f);

		private static readonly Color FoliageTint = new Color(1.1485935f, 0.6110518f, 0.6110518f, 0f);

		private static readonly Color FoliageBaseColor = new Color(2f / 51f, 2f / 85f, 0.015686275f, 0f);

		private static readonly Color FoliageColor1 = new Color(16f / 51f, 14f / 85f, 7f / 85f, 1f);

		public const string Id = "com.github.MiiMii1205.BringBackRedSand";

		internal static ManualLogSource Log
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			private set;
		} = null;


		internal static Material RedRockMaterial
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			private set;
		} = null;


		internal static Material RedFoliageMaterial
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			private set;
		} = null;


		public static string Name => "BringBackRedSand";

		public static string Version => "1.0.1";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			SceneManager.sceneLoaded += CheckMaterials;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}

		private void CheckMaterials(Scene arg0, LoadSceneMode arg1)
		{
			if (Object.op_Implicit((Object)(object)RedRockMaterial) && Object.op_Implicit((Object)(object)RedFoliageMaterial))
			{
				return;
			}
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			Log.LogInfo((object)$"Found {array.Length} materials...");
			Material[] array2 = array;
			foreach (Material val in array2)
			{
				string name = ((Object)val).name;
				if (!(name == "M_RedRock"))
				{
					if (name == "M_Foliage Generic_Red")
					{
						RedFoliageMaterial = val;
					}
				}
				else
				{
					RedRockMaterial = val;
				}
				if (Object.op_Implicit((Object)(object)RedRockMaterial) && Object.op_Implicit((Object)(object)RedFoliageMaterial))
				{
					UpdateMaterialColors();
					break;
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static void UpdateMaterialColors()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			RedRockMaterial.SetColor(TopColor2, BloodRedTop2Color);
			RedRockMaterial.SetColor(TopColor, BloodRedTopColor);
			RedRockMaterial.SetColor(TopColor1, BloodRedTop1Color);
			RedRockMaterial.SetVector(TopHueShift, HueShift);
			RedFoliageMaterial.SetColor(Tint, FoliageTint);
			RedFoliageMaterial.SetColor(BaseColor, FoliageBaseColor);
			RedFoliageMaterial.SetColor(Color1, FoliageColor1);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}