Decompiled source of SnowGlobe v1.0.0

plugins/SnowGlobe/SnowGlobe.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 SnowGlobe
{
	internal static class Materials
	{
		private static Shader _lit;

		private static readonly string[] OpaquePlain = new string[2] { "_DISABLE_SSR_TRANSPARENT", "_NORMALMAP_TANGENT_SPACE" };

		private static readonly string[] OpaqueNormalMask = new string[4] { "_DISABLE_SSR_TRANSPARENT", "_MASKMAP", "_NORMALMAP", "_NORMALMAP_TANGENT_SPACE" };

		private static Shader Lit
		{
			get
			{
				if ((Object)(object)_lit == (Object)null)
				{
					_lit = Shader.Find("HDRP/Lit");
				}
				if ((Object)(object)_lit == (Object)null)
				{
					SnowGlobePlugin.Log.LogError((object)"HDRP/Lit shader not found - the snow globe will render pink.");
				}
				return _lit;
			}
		}

		private static void ApplyFloats(Material m, (string, float)[] floats)
		{
			for (int i = 0; i < floats.Length; i++)
			{
				var (text, num) = floats[i];
				if (m.HasProperty(text))
				{
					m.SetFloat(text, num);
				}
			}
		}

		private static void ApplyColors(Material m, (string, float, float, float, float)[] colors)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < colors.Length; i++)
			{
				var (text, num, num2, num3, num4) = colors[i];
				if (m.HasProperty(text))
				{
					m.SetColor(text, new Color(num, num2, num3, num4));
				}
			}
		}

		private static void SetTex(Material m, string prop, Texture2D tex)
		{
			if ((Object)(object)tex != (Object)null && m.HasProperty(prop))
			{
				m.SetTexture(prop, (Texture)(object)tex);
			}
		}

		internal static Material Opaque(string name, Texture2D baseMap, Texture2D normal, Texture2D mask, Color tint, float smoothnessMax, float normalScale = 0.5f, float smoothness = 0.3f, float metallic = 0f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Lit)
			{
				name = name
			};
			ApplyFloats(val, VanillaTemplates.SteelFloats);
			ApplyColors(val, VanillaTemplates.SteelColors);
			val.SetFloat("_DisplacementMode", 0f);
			bool flag = (Object)(object)normal != (Object)null;
			bool flag2 = (Object)(object)mask != (Object)null;
			string[] array = ((flag && flag2) ? OpaqueNormalMask : OpaquePlain);
			foreach (string text in array)
			{
				val.EnableKeyword(text);
			}
			array = VanillaTemplates.SteelDisabledPasses;
			foreach (string text2 in array)
			{
				val.SetShaderPassEnabled(text2, false);
			}
			val.renderQueue = 2225;
			val.SetColor("_BaseColor", tint);
			SetTex(val, "_BaseColorMap", baseMap);
			SetTex(val, "_MainTex", baseMap);
			SetTex(val, "_NormalMap", normal);
			SetTex(val, "_MaskMap", mask);
			val.SetFloat("_NormalScale", flag ? normalScale : 1f);
			val.SetFloat("_Metallic", metallic);
			val.SetFloat("_Smoothness", smoothness);
			val.SetFloat("_SmoothnessRemapMin", 0f);
			val.SetFloat("_SmoothnessRemapMax", smoothnessMax);
			return val;
		}

		internal static Material Glass()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Lit)
			{
				name = "SnowGlobe_Glass"
			};
			ApplyFloats(val, VanillaTemplates.GlassFloats);
			ApplyColors(val, VanillaTemplates.GlassColors);
			string[] glassKeywords = VanillaTemplates.GlassKeywords;
			foreach (string text in glassKeywords)
			{
				val.EnableKeyword(text);
			}
			glassKeywords = VanillaTemplates.GlassDisabledPasses;
			foreach (string text2 in glassKeywords)
			{
				val.SetShaderPassEnabled(text2, false);
			}
			val.renderQueue = 3000;
			val.SetColor("_BaseColor", new Color(0.82f, 0.92f, 1f, 0.11f));
			val.SetFloat("_Metallic", 0f);
			val.SetFloat("_Smoothness", 0.85f);
			return val;
		}

		internal static Material Flake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Lit)
			{
				name = "SnowGlobe_Flake"
			};
			ApplyFloats(val, VanillaTemplates.SteelFloats);
			ApplyColors(val, VanillaTemplates.SteelColors);
			val.SetFloat("_DisplacementMode", 0f);
			string[] opaquePlain = OpaquePlain;
			foreach (string text in opaquePlain)
			{
				val.EnableKeyword(text);
			}
			opaquePlain = VanillaTemplates.SteelDisabledPasses;
			foreach (string text2 in opaquePlain)
			{
				val.SetShaderPassEnabled(text2, false);
			}
			val.renderQueue = 2225;
			val.SetColor("_BaseColor", new Color(0.95f, 0.97f, 1f, 1f));
			val.SetFloat("_Metallic", 0f);
			val.SetFloat("_Smoothness", 0.2f);
			val.SetFloat("_UseEmissiveIntensity", 0f);
			val.SetColor("_EmissiveColor", new Color(0.9f, 1f, 1.15f, 1f));
			val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
			return val;
		}
	}
	[BepInPlugin("CoddingCat.SnowGlobe", "Snow Globe", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SnowGlobePlugin : BaseUnityPlugin
	{
		public const string Guid = "CoddingCat.SnowGlobe";

		public const string Name = "Snow Globe";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log;

		internal static Item GlobeItem;

		private void Awake()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Invalid comparison between Unknown and I4
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Settings.Bind(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "snowglobe");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogError((object)("Could not load asset bundle at " + text + ". The snow globe will not be added."));
				return;
			}
			GlobeItem = SnowGlobePrefab.CreateItem(val);
			if (Settings.SpawnRarity.Value > 0)
			{
				LevelTypes val2 = (LevelTypes)1;
				if (Settings.SpawnOnVanillaMoons.Value)
				{
					val2 = (LevelTypes)(val2 | 0x3BFC);
				}
				if (Settings.SpawnOnModdedMoons.Value)
				{
					val2 = (LevelTypes)(val2 | 0x400);
				}
				if ((int)val2 != 1)
				{
					Items.RegisterScrap(GlobeItem, Settings.SpawnRarity.Value, val2);
				}
			}
			else
			{
				Items.RegisterScrap(GlobeItem, 0, (LevelTypes)1);
			}
			new Harmony("CoddingCat.SnowGlobe").PatchAll(typeof(Patches));
			Log.LogInfo((object)string.Format("{0} {1} loaded (rarity {2}, cooldown {3}s).", "Snow Globe", "1.0.0", Settings.SpawnRarity.Value, Settings.ShakeCooldown.Value));
		}
	}
	internal static class Settings
	{
		internal static ConfigEntry<float> ShakeCooldown;

		internal static ConfigEntry<float> DriftSeconds;

		internal static ConfigEntry<float> ChimeVolume;

		internal static ConfigEntry<float> ChimeNoiseRange;

		internal static ConfigEntry<float> ChimeNoiseLoudness;

		internal static ConfigEntry<float> MelodyVolume;

		internal static ConfigEntry<bool> MelodyAttractsMonsters;

		internal static ConfigEntry<int> SpawnRarity;

		internal static ConfigEntry<int> MinScrapValue;

		internal static ConfigEntry<int> MaxScrapValue;

		internal static ConfigEntry<bool> SpawnOnVanillaMoons;

		internal static ConfigEntry<bool> SpawnOnModdedMoons;

		internal static void Bind(ConfigFile c)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			ShakeCooldown = c.Bind<float>("Shaking", "CooldownSeconds", 8f, new ConfigDescription("Seconds you must wait between shakes of the snow globe. Set to 0 for no cooldown.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			DriftSeconds = c.Bind<float>("Shaking", "DriftSeconds", 5f, new ConfigDescription("How long, in seconds, the snow drifts toward the nearest scrap after a shake.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>()));
			ChimeVolume = c.Bind<float>("Chime", "Volume", 1f, new ConfigDescription("Volume of the chime (1 = full).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ChimeNoiseRange = c.Bind<float>("Chime", "MonsterHearingRange", 30f, new ConfigDescription("How far away (in meters) monsters can hear the chime. Set to 0 to make the chime silent to monsters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 150f), Array.Empty<object>()));
			ChimeNoiseLoudness = c.Bind<float>("Chime", "MonsterHearingLoudness", 0.8f, new ConfigDescription("How loud monsters perceive the chime (0 - 1). Higher values also get through the closed ship doors.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			MelodyVolume = c.Bind<float>("Chime", "MusicBoxVolume", 0.15f, new ConfigDescription("Volume of the music box melody that plays after a shake. 0 disables the melody.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			MelodyAttractsMonsters = c.Bind<bool>("Chime", "MusicBoxAttractsMonsters", true, "While the melody plays, monsters in MonsterHearingRange keep hearing it (a pulse every few seconds).");
			SpawnRarity = c.Bind<int>("Spawning", "Rarity", 12, new ConfigDescription("How common the snow globe is as scrap (relative spawn weight, like other scrap items). 0 disables spawning. Needs a game restart.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>()));
			MinScrapValue = c.Bind<int>("Spawning", "MinValue", 60, new ConfigDescription("Lowest scrap value it can spawn with, as shown in game when scanned.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 2000), Array.Empty<object>()));
			MaxScrapValue = c.Bind<int>("Spawning", "MaxValue", 130, new ConfigDescription("Highest scrap value it can spawn with, as shown in game when scanned.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 2000), Array.Empty<object>()));
			SpawnOnVanillaMoons = c.Bind<bool>("Spawning", "SpawnOnVanillaMoons", true, "Spawn as scrap on the vanilla moons. Needs a game restart.");
			SpawnOnModdedMoons = c.Bind<bool>("Spawning", "SpawnOnModdedMoons", true, "Spawn as scrap on modded moons. Needs a game restart.");
		}
	}
	[HarmonyPatch]
	internal static class Patches
	{
		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		[HarmonyPrefix]
		private static void ApplyScrapValues(RoundManager __instance)
		{
			Item globeItem = SnowGlobePlugin.GlobeItem;
			if (!((Object)(object)globeItem == (Object)null))
			{
				float num = Mathf.Max(0.01f, __instance.scrapValueMultiplier);
				int num2 = Mathf.Min(Settings.MinScrapValue.Value, Settings.MaxScrapValue.Value);
				int num3 = Mathf.Max(Settings.MinScrapValue.Value, Settings.MaxScrapValue.Value);
				globeItem.minValue = Mathf.Max(1, Mathf.RoundToInt((float)num2 / num));
				globeItem.maxValue = Mathf.Max(globeItem.minValue + 1, Mathf.RoundToInt((float)(num3 + 1) / num));
			}
		}
	}
	public class SnowGlobeItem : GrabbableObject
	{
		public Transform visual;

		public ParticleSystem snowSystem;

		public ParticleSystemRenderer snowRenderer;

		public AudioSource audioSource;

		public AudioClip chime;

		public AudioSource musicSource;

		public Vector3 domeCenter;

		public float domeRadius;

		public float floorY;

		public float[] groundHeights;

		private const float FlakeMargin = 0.006f;

		private const float FallSpeed = 0.035f;

		private const float DriftSpeed = 0.13f;

		private const float ShakeAnimLength = 0.75f;

		private Particle[] _particles;

		private Vector3[] _vel;

		private float[] _speedMul;

		private float[] _phase;

		private int _count;

		private float _driftRemaining;

		private float _driftTotal;

		private Transform _target;

		private Vector3 _lastDirWorld;

		private bool _hasDir;

		private float _shakeAnim;

		private Vector3 _lastGravityLocal;

		private bool _settled;

		private bool _initialized;

		private float _melodyDelay = -1f;

		private float _nextMelodyNoise;

		private float _floor;

		private float _radius;

		private Vector3 _center;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			base.useCooldown = Settings.ShakeCooldown.Value;
			AssignMixerGroup();
			InitSnow();
		}

		private void AssignMixerGroup()
		{
			try
			{
				AudioMixer val = (((Object)(object)SoundManager.Instance != (Object)null) ? SoundManager.Instance.diageticMixer : null);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)audioSource == (Object)null))
				{
					AudioMixerGroup[] array = val.FindMatchingGroups("Master");
					if (array == null || array.Length == 0)
					{
						array = val.FindMatchingGroups(string.Empty);
					}
					if (array != null && array.Length != 0)
					{
						audioSource.outputAudioMixerGroup = array[0];
					}
				}
			}
			catch (Exception ex)
			{
				SnowGlobePlugin.Log.LogWarning((object)("Could not assign mixer group: " + ex.Message));
			}
		}

		private void InitSnow()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)snowSystem == (Object)null))
			{
				_center = domeCenter;
				_radius = Mathf.Max(0.02f, domeRadius - 0.006f);
				_floor = floorY + 0.0018000001f;
				_count = 600;
				_particles = (Particle[])(object)new Particle[_count];
				_vel = (Vector3[])(object)new Vector3[_count];
				_speedMul = new float[_count];
				_phase = new float[_count];
				float num = Mathf.Sqrt(Mathf.Max(0.0001f, _radius * _radius - (floorY - _center.y) * (floorY - _center.y))) * 0.92f;
				snowSystem.Play();
				EmitParams val = default(EmitParams);
				((EmitParams)(ref val)).velocity = Vector3.zero;
				((EmitParams)(ref val)).startColor = Color32.op_Implicit(Color.white);
				((EmitParams)(ref val)).applyShapeToPosition = false;
				EmitParams val2 = val;
				for (int i = 0; i < _count; i++)
				{
					Vector2 val3 = Random.insideUnitCircle * num;
					float num2 = _center.x + val3.x;
					float num3 = _center.z + val3.y;
					((EmitParams)(ref val2)).position = new Vector3(num2, GroundAt(num2, num3) + 0.0015f + Random.value * 0.003f, num3);
					((EmitParams)(ref val2)).startSize = Random.Range(0.0009f, 0.0019f);
					((EmitParams)(ref val2)).startLifetime = 100000f;
					((EmitParams)(ref val2)).rotation3D = new Vector3(Random.value * 360f, Random.value * 360f, Random.value * 360f);
					snowSystem.Emit(val2, 1);
					_speedMul[i] = Random.Range(0.55f, 1.25f);
					_phase[i] = Random.value * 6.2832f;
				}
				_settled = false;
				_initialized = true;
				_lastGravityLocal = Vector3.zero;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				Shake();
			}
		}

		private void Shake()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			float value = Settings.ChimeVolume.Value;
			if ((Object)(object)audioSource != (Object)null && (Object)(object)chime != (Object)null && value > 0f)
			{
				audioSource.pitch = Random.Range(0.97f, 1.03f);
				audioSource.PlayOneShot(chime, value);
				WalkieTalkie.TransmitOneShotAudio(audioSource, chime, value);
			}
			float value2 = Settings.ChimeNoiseRange.Value;
			if (value2 > 0f && (Object)(object)RoundManager.Instance != (Object)null)
			{
				float value3 = Settings.ChimeNoiseLoudness.Value;
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, value2, value3, 0, base.isInElevator && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.hangarDoorsClosed, 0);
				if (value3 >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
				{
					base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
				}
			}
			if ((Object)(object)musicSource != (Object)null && (Object)(object)musicSource.clip != (Object)null && Settings.MelodyVolume.Value > 0f)
			{
				musicSource.Stop();
				_melodyDelay = 1.25f;
			}
			_driftTotal = Mathf.Max(0.5f, Settings.DriftSeconds.Value);
			_driftRemaining = _driftTotal;
			GrabbableObject val = FindNearestScrap();
			_target = (((Object)(object)val != (Object)null) ? ((Component)val).transform : null);
			_hasDir = false;
			if ((Object)(object)_target != (Object)null)
			{
				Vector3 val2 = _target.position - WorldCenter();
				_lastDirWorld = ((Vector3)(ref val2)).normalized;
				_hasDir = true;
			}
			Stir(0.32f);
			_shakeAnim = 0.75f;
		}

		private float GroundAt(float x, float z)
		{
			if (groundHeights == null || domeRadius <= 0f)
			{
				return floorY;
			}
			int num = 96;
			float num2 = 2f * domeRadius / (float)(num - 1);
			float num3 = Mathf.Clamp((x + domeRadius) / num2, 0f, (float)num - 1.001f);
			float num4 = Mathf.Clamp((z + domeRadius) / num2, 0f, (float)num - 1.001f);
			int num5 = (int)num3;
			int num6 = (int)num4;
			float num7 = num3 - (float)num5;
			float num8 = num4 - (float)num6;
			float num9 = groundHeights[num6 * num + num5];
			float num10 = groundHeights[num6 * num + num5 + 1];
			float num11 = groundHeights[(num6 + 1) * num + num5];
			float num12 = groundHeights[(num6 + 1) * num + num5 + 1];
			return Mathf.Lerp(Mathf.Lerp(num9, num10, num7), Mathf.Lerp(num11, num12, num7), num8);
		}

		private Vector3 WorldCenter()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)snowSystem != (Object)null))
			{
				return ((Component)this).transform.position;
			}
			return ((Component)snowSystem).transform.TransformPoint(_center);
		}

		private GrabbableObject FindNearestScrap()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject result = null;
			float num = float.MaxValue;
			Vector3 val = WorldCenter();
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject val2 in array)
			{
				if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)this) && !((Object)(object)val2.itemProperties == (Object)null) && val2.itemProperties.isScrap && !val2.isInShipRoom && !val2.isInElevator && !(val2 is RagdollGrabbableObject))
				{
					Vector3 val3 = ((Component)val2).transform.position - val;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						result = val2;
					}
				}
			}
			return result;
		}

		private void Stir(float strength)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (_initialized)
			{
				for (int i = 0; i < _count; i++)
				{
					ref Vector3 reference = ref _vel[i];
					reference += (Random.onUnitSphere * strength + Vector3.up * strength * 0.4f) * _speedMul[i];
				}
				_settled = false;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			Stir(0.12f);
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			Stir(0.18f);
		}

		public override void EnableItemMeshes(bool enable)
		{
			((GrabbableObject)this).EnableItemMeshes(enable);
			if ((Object)(object)snowRenderer != (Object)null)
			{
				((Renderer)snowRenderer).enabled = enable;
			}
		}

		public override void LateUpdate()
		{
			((GrabbableObject)this).LateUpdate();
			UpdateMelody();
			AnimateShake();
			SimulateSnow();
		}

		private void UpdateMelody()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)musicSource == (Object)null)
			{
				return;
			}
			if (_melodyDelay >= 0f)
			{
				_melodyDelay -= Time.deltaTime;
				if (_melodyDelay < 0f)
				{
					musicSource.volume = Settings.MelodyVolume.Value;
					musicSource.Play();
					_nextMelodyNoise = Time.time;
					WalkieTalkie.TransmitOneShotAudio(audioSource, musicSource.clip, Settings.MelodyVolume.Value);
				}
			}
			if (musicSource.isPlaying && Settings.MelodyAttractsMonsters.Value && Time.time >= _nextMelodyNoise)
			{
				_nextMelodyNoise = Time.time + 3f;
				float value = Settings.ChimeNoiseRange.Value;
				if (value > 0f && (Object)(object)RoundManager.Instance != (Object)null)
				{
					RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, value, Settings.ChimeNoiseLoudness.Value * 0.75f, 0, base.isInElevator && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.hangarDoorsClosed, 0);
				}
			}
		}

		private void AnimateShake()
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)visual == (Object)null))
			{
				if (_shakeAnim > 0f)
				{
					_shakeAnim -= Time.deltaTime;
					float num = Mathf.Clamp01(_shakeAnim / 0.75f);
					float num2 = num * num;
					float time = Time.time;
					visual.localRotation = Quaternion.Euler(Mathf.Sin(time * 43f) * 16f * num2, Mathf.Sin(time * 29f) * 8f * num2, Mathf.Sin(time * 37f + 1.3f) * 18f * num2);
					visual.localPosition = new Vector3(Mathf.Sin(time * 51f) * 0.012f * num2, Mathf.Abs(Mathf.Sin(time * 31f)) * 0.03f * num2, Mathf.Sin(time * 47f + 0.7f) * 0.012f * num2);
				}
				else if (visual.localPosition != Vector3.zero || visual.localRotation != Quaternion.identity)
				{
					visual.localPosition = Vector3.zero;
					visual.localRotation = Quaternion.identity;
				}
			}
		}

		private void SimulateSnow()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			if (!_initialized)
			{
				return;
			}
			float num = Mathf.Min(Time.deltaTime, 0.04f);
			if (num <= 0f)
			{
				return;
			}
			bool flag = _driftRemaining > 0f;
			if (flag)
			{
				_driftRemaining -= num;
			}
			PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null);
			Vector3 val2;
			if ((Object)(object)val != (Object)null)
			{
				val2 = ((Component)val).transform.position - ((Component)this).transform.position;
				if (((Vector3)(ref val2)).sqrMagnitude > 2500f)
				{
					return;
				}
			}
			Transform transform = ((Component)snowSystem).transform;
			val2 = transform.InverseTransformDirection(Vector3.down);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			if (!flag && _settled)
			{
				val2 = normalized - _lastGravityLocal;
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0004f)
				{
					return;
				}
			}
			_lastGravityLocal = normalized;
			Vector3 val3 = Vector3.zero;
			float num2 = 0f;
			if (flag)
			{
				if ((Object)(object)_target != (Object)null)
				{
					Vector3 val4 = _target.position - WorldCenter();
					if (((Vector3)(ref val4)).sqrMagnitude > 0.0001f)
					{
						_lastDirWorld = ((Vector3)(ref val4)).normalized;
						_hasDir = true;
					}
				}
				if (_hasDir)
				{
					val2 = transform.InverseTransformDirection(_lastDirWorld);
					val3 = ((Vector3)(ref val2)).normalized;
				}
				float num3 = _driftTotal - _driftRemaining;
				num2 = Mathf.SmoothStep(0f, 1f, num3 / 0.6f) * Mathf.SmoothStep(0f, 1f, _driftRemaining / 0.9f);
			}
			snowSystem.GetParticles(_particles, _count);
			float time = Time.time;
			float num4 = 1f - Mathf.Exp((0f - num) / (flag ? 0.55f : 0.7f));
			float num5 = 0f;
			for (int i = 0; i < _count; i++)
			{
				Vector3 position = ((Particle)(ref _particles[i])).position;
				Vector3 val5 = position;
				Vector3 val6 = _vel[i];
				Vector3 val7 = normalized * (0.035f * _speedMul[i]);
				if (flag)
				{
					float num6 = _phase[i];
					val7 += new Vector3(Mathf.Sin(time * 2.1f + num6), Mathf.Sin(time * 1.7f + num6 * 1.9f), Mathf.Sin(time * 2.6f + num6 * 0.7f)) * (0.025f * num2);
					val7 += val3 * (0.13f * num2 * _speedMul[i]);
				}
				val6 = Vector3.Lerp(val6, val7, num4);
				val5 += val6 * num;
				Vector3 val8 = val5 - _center;
				float magnitude = ((Vector3)(ref val8)).magnitude;
				if (magnitude > _radius)
				{
					Vector3 val9 = val8 / magnitude;
					val5 = _center + val9 * _radius;
					float num7 = Vector3.Dot(val6, val9);
					if (num7 > 0f)
					{
						val6 -= val9 * num7;
					}
				}
				float num8 = GroundAt(val5.x, val5.z) + 0.0018000001f;
				if (num8 - position.y > 0.008f)
				{
					val5.x = position.x;
					val5.z = position.z;
					val6.x *= 0.2f;
					val6.z *= 0.2f;
					num8 = GroundAt(val5.x, val5.z) + 0.0018000001f;
				}
				if (val5.y < num8)
				{
					val5.y = num8;
					if (val6.y < 0f)
					{
						val6.y = 0f;
					}
					val6.x *= 0.9f;
					val6.z *= 0.9f;
				}
				((Particle)(ref _particles[i])).position = val5;
				((Particle)(ref _particles[i])).velocity = Vector3.zero;
				_vel[i] = val6;
				float sqrMagnitude = ((Vector3)(ref val6)).sqrMagnitude;
				if (sqrMagnitude > num5)
				{
					num5 = sqrMagnitude;
				}
			}
			snowSystem.SetParticles(_particles, _count);
			_settled = !flag && num5 < 2E-05f;
		}
	}
	internal static class SnowGlobePrefab
	{
		internal const float FlakeCount = 600f;

		internal const int GroundGrid = 96;

		internal static Item CreateItem(AssetBundle bundle)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0771: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = FindMesh(bundle, "Base");
			Mesh val2 = FindMesh(bundle, "Plaque");
			Mesh val3 = FindMesh(bundle, "Dome");
			Mesh val4 = FindMesh(bundle, "Island");
			AudioClip chime = bundle.LoadAsset<AudioClip>("Assets/Source/ShakeGlobeSound.ogg");
			AudioClip pocketSFX = AudioClip.Create("SnowGlobeSilence", 1, 1, 44100, false);
			AudioClip clip = bundle.LoadAsset<AudioClip>("Assets/Source/MusicBox.ogg");
			Texture2D val5 = bundle.LoadAsset<Texture2D>("Assets/Source/SnowGlobeIcon.png");
			Material mat = Materials.Opaque("SnowGlobe_Base", Tex("Base_BaseMap"), Tex("Base_Normal"), Tex("Base_MaskMap"), new Color(0.85f, 0.85f, 0.85f, 1f), 0.65f);
			Material mat2 = Materials.Opaque("SnowGlobe_Plaque", Tex("Plaque_BaseMap"), Tex("Plaque_Normal"), Tex("Plaque_MaskMap"), new Color(0.85f, 0.85f, 0.85f, 1f), 0.65f);
			Material mat3 = Materials.Opaque("SnowGlobe_Island", Tex("Island_BaseMap"), null, null, Color.white, 0.2f, 1f, 0.12f);
			Material val6 = Materials.Glass();
			Material sharedMaterial = Materials.Flake();
			Mesh mesh = BuildFlakeMesh();
			GameObject val7 = NetworkPrefabs.CreateNetworkPrefab("SnowGlobe");
			val7.layer = LayerMask.NameToLayer("Props");
			val7.tag = "PhysicsProp";
			GameObject val8 = new GameObject("Visual");
			val8.transform.SetParent(val7.transform, false);
			val8.layer = val7.layer;
			AddPart(val8.transform, "Base", val, mat);
			AddPart(val8.transform, "Plaque", val2, mat2);
			AddPart(val8.transform, "Island", val4, mat3);
			AddPart(val8.transform, "Dome", val3, val6);
			BoxCollider obj = val7.AddComponent<BoxCollider>();
			Bounds bounds = val.bounds;
			Bounds bounds2 = val3.bounds;
			Bounds val9 = bounds;
			((Bounds)(ref val9)).Encapsulate(bounds2);
			((Bounds)(ref val9)).Encapsulate(val2.bounds);
			obj.center = ((Bounds)(ref val9)).center;
			obj.size = ((Bounds)(ref val9)).size;
			GameObject val10 = new GameObject("ScanNode");
			val10.transform.SetParent(val7.transform, false);
			val10.layer = LayerMask.NameToLayer("ScanNode");
			val10.transform.localPosition = ((Bounds)(ref val9)).center;
			BoxCollider obj2 = val10.AddComponent<BoxCollider>();
			((Collider)obj2).isTrigger = true;
			obj2.size = ((Bounds)(ref val9)).size * 1.1f;
			ScanNodeProperties obj3 = val10.AddComponent<ScanNodeProperties>();
			obj3.maxRange = 13;
			obj3.minRange = 1;
			obj3.requiresLineOfSight = true;
			obj3.headerText = "Snow Globe";
			obj3.subText = "Value: ";
			obj3.scrapValue = 0;
			obj3.creatureScanID = -1;
			obj3.nodeType = 2;
			AudioSource val11 = val7.AddComponent<AudioSource>();
			val11.playOnAwake = false;
			val11.spatialBlend = 1f;
			val11.rolloffMode = (AudioRolloffMode)1;
			val11.minDistance = 3f;
			val11.maxDistance = 45f;
			val11.dopplerLevel = 0f;
			GameObject val12 = new GameObject("MusicBox");
			val12.transform.SetParent(val7.transform, false);
			AudioSource val13 = val12.AddComponent<AudioSource>();
			val13.playOnAwake = false;
			val13.loop = false;
			val13.spatialBlend = 1f;
			val13.rolloffMode = (AudioRolloffMode)1;
			val13.minDistance = 2.5f;
			val13.maxDistance = 38f;
			val13.dopplerLevel = 0f;
			val13.clip = clip;
			GameObject val14 = new GameObject("Snow");
			val14.transform.SetParent(val8.transform, false);
			val14.layer = val7.layer;
			ParticleSystem val15 = val14.AddComponent<ParticleSystem>();
			val15.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val15.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).duration = 100000f;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
			((MainModule)(ref main)).maxParticles = 600;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(100000f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f);
			EmissionModule emission = val15.emission;
			((EmissionModule)(ref emission)).enabled = false;
			ShapeModule shape = val15.shape;
			((ShapeModule)(ref shape)).enabled = false;
			ParticleSystemRenderer component = val14.GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)4;
			component.mesh = mesh;
			((Renderer)component).sharedMaterial = sharedMaterial;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			component.alignment = (ParticleSystemRenderSpace)2;
			MeshRenderer[] componentsInChildren = val8.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val16 in componentsInChildren)
			{
				if ((Object)(object)((Renderer)val16).sharedMaterial == (Object)(object)val6)
				{
					((Renderer)val16).shadowCastingMode = (ShadowCastingMode)0;
				}
			}
			Item val17 = ScriptableObject.CreateInstance<Item>();
			((Object)val17).name = "SnowGlobeItem";
			val17.itemName = "Snow Globe";
			val17.isScrap = true;
			val17.minValue = 60;
			val17.maxValue = 130;
			val17.weight = 1.05f;
			val17.twoHanded = false;
			val17.canBeGrabbedBeforeGameStart = true;
			val17.itemSpawnsOnGround = true;
			val17.isConductiveMetal = false;
			val17.requiresBattery = false;
			val17.automaticallySetUsingPower = false;
			val17.holdButtonUse = false;
			val17.itemIsTrigger = false;
			val17.syncGrabFunction = true;
			val17.syncUseFunction = true;
			val17.syncDiscardFunction = true;
			val17.syncInteractLRFunction = true;
			val17.saveItemVariable = false;
			val17.canBeInspected = true;
			val17.allowDroppingAheadOfPlayer = true;
			val17.restingRotation = Vector3.zero;
			val17.verticalOffset = 0f;
			val17.floorYOffset = 0;
			val17.rotationOffset = new Vector3(0f, 0f, -90f);
			val17.positionOffset = new Vector3(-0.01f, 0f, -0.1f);
			val17.grabAnim = "";
			val17.useAnim = "";
			val17.pocketAnim = "";
			val17.throwAnim = "";
			val17.toolTips = new string[1] { "Shake : [LMB]" };
			val17.pocketSFX = pocketSFX;
			val17.itemIcon = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), new Vector2(0.5f, 0.5f), 100f);
			val17.spawnPrefab = val7;
			SnowGlobeItem snowGlobeItem = val7.AddComponent<SnowGlobeItem>();
			((GrabbableObject)snowGlobeItem).itemProperties = val17;
			((GrabbableObject)snowGlobeItem).mainObjectRenderer = val8.GetComponentsInChildren<MeshRenderer>().FirstOrDefault();
			((GrabbableObject)snowGlobeItem).grabbable = true;
			((GrabbableObject)snowGlobeItem).grabbableToEnemies = true;
			((GrabbableObject)snowGlobeItem).useCooldown = Settings.ShakeCooldown.Value;
			snowGlobeItem.visual = val8.transform;
			snowGlobeItem.snowSystem = val15;
			snowGlobeItem.snowRenderer = component;
			snowGlobeItem.audioSource = val11;
			snowGlobeItem.chime = chime;
			snowGlobeItem.musicSource = val13;
			snowGlobeItem.domeCenter = ((Bounds)(ref bounds2)).center;
			snowGlobeItem.domeRadius = ((Bounds)(ref bounds2)).extents.x;
			snowGlobeItem.floorY = ((Bounds)(ref bounds)).max.y;
			snowGlobeItem.groundHeights = BuildHeightField(val4, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds2)).extents.x, 96);
			return val17;
			Texture2D Tex(string n)
			{
				return bundle.LoadAsset<Texture2D>("Assets/Source/" + n + ".png");
			}
		}

		private static Mesh FindMesh(AssetBundle bundle, string key)
		{
			GameObject val = bundle.LoadAsset<GameObject>("Assets/Source/SnowGlobe" + key + ".obj");
			MeshFilter val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren<MeshFilter>(true) : null);
			if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null)
			{
				SnowGlobePlugin.Log.LogError((object)("Mesh 'SnowGlobe" + key + "' not found in bundle."));
			}
			if (!((Object)(object)val2 != (Object)null))
			{
				return null;
			}
			return val2.sharedMesh;
		}

		private static void AddPart(Transform parent, string name, Mesh mesh, Material mat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.layer = ((Component)parent).gameObject.layer;
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = mat;
		}

		private static float[] BuildHeightField(Mesh island, float baseTop, float extent, int n)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[n * n];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = baseTop;
			}
			try
			{
				Vector3[] vertices = island.vertices;
				Vector3[] normals = island.normals;
				int[] triangles = island.triangles;
				float num = 2f * extent / (float)(n - 1);
				for (int j = 0; j < triangles.Length; j += 3)
				{
					int num2 = triangles[j];
					int num3 = triangles[j + 1];
					int num4 = triangles[j + 2];
					if (normals.Length == vertices.Length && (normals[num2].y + normals[num3].y + normals[num4].y) / 3f < 0.05f)
					{
						continue;
					}
					Vector3 val = vertices[num2];
					Vector3 val2 = vertices[num3];
					Vector3 val3 = vertices[num4];
					float num5 = Mathf.Min(val.x, Mathf.Min(val2.x, val3.x));
					float num6 = Mathf.Max(val.x, Mathf.Max(val2.x, val3.x));
					float num7 = Mathf.Min(val.z, Mathf.Min(val2.z, val3.z));
					float num8 = Mathf.Max(val.z, Mathf.Max(val2.z, val3.z));
					int num9 = Mathf.Max(0, Mathf.FloorToInt((num5 + extent) / num));
					int num10 = Mathf.Min(n - 1, Mathf.CeilToInt((num6 + extent) / num));
					int num11 = Mathf.Max(0, Mathf.FloorToInt((num7 + extent) / num));
					int num12 = Mathf.Min(n - 1, Mathf.CeilToInt((num8 + extent) / num));
					float num13 = (val2.z - val3.z) * (val.x - val3.x) + (val3.x - val2.x) * (val.z - val3.z);
					if (Mathf.Abs(num13) < 1E-12f)
					{
						continue;
					}
					for (int k = num11; k <= num12; k++)
					{
						float num14 = (float)k * num - extent;
						for (int l = num9; l <= num10; l++)
						{
							float num15 = (float)l * num - extent;
							float num16 = ((val2.z - val3.z) * (num15 - val3.x) + (val3.x - val2.x) * (num14 - val3.z)) / num13;
							float num17 = ((val3.z - val.z) * (num15 - val3.x) + (val.x - val3.x) * (num14 - val3.z)) / num13;
							float num18 = 1f - num16 - num17;
							if (!(num16 < -0.02f) && !(num17 < -0.02f) && !(num18 < -0.02f))
							{
								float num19 = num16 * val.y + num17 * val2.y + num18 * val3.y;
								if (num19 > array[k * n + l])
								{
									array[k * n + l] = num19;
								}
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				SnowGlobePlugin.Log.LogWarning((object)("Could not build the island height map, snow will rest on the base only: " + ex.Message));
			}
			return array;
		}

		private static Mesh BuildFlakeMesh()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0037: 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)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[6]
			{
				new Vector3(0.5f, 0f, 0f),
				new Vector3(-0.5f, 0f, 0f),
				new Vector3(0f, 0.5f, 0f),
				new Vector3(0f, -0.5f, 0f),
				new Vector3(0f, 0f, 0.5f),
				new Vector3(0f, 0f, -0.5f)
			};
			int[] array2 = new int[24]
			{
				2, 4, 0, 2, 1, 4, 2, 5, 1, 2,
				0, 5, 3, 0, 4, 3, 4, 1, 3, 1,
				5, 3, 5, 0
			};
			Mesh val = new Mesh
			{
				name = "SnowFlake"
			};
			Vector3[] array3 = (Vector3[])(object)new Vector3[array2.Length * 2];
			int[] array4 = new int[array2.Length * 2];
			for (int i = 0; i < array2.Length; i++)
			{
				array3[i] = array[array2[i]];
				array4[i] = i;
			}
			for (int j = 0; j < array2.Length; j += 3)
			{
				array3[array2.Length + j] = array[array2[j]];
				array3[array2.Length + j + 1] = array[array2[j + 2]];
				array3[array2.Length + j + 2] = array[array2[j + 1]];
				array4[array2.Length + j] = array2.Length + j;
				array4[array2.Length + j + 1] = array2.Length + j + 1;
				array4[array2.Length + j + 2] = array2.Length + j + 2;
			}
			val.vertices = array3;
			val.triangles = array4;
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}
	}
	internal static class VanillaTemplates
	{
		internal static readonly (string, float)[] SteelFloats = new(string, float)[114]
		{
			("_AORemapMax", 1f),
			("_AORemapMin", 0f),
			("_ATDistance", 1f),
			("_AddPrecomputedVelocity", 0f),
			("_AlbedoAffectEmissive", 0f),
			("_AlphaCutoff", 0.5f),
			("_AlphaCutoffEnable", 0f),
			("_AlphaCutoffPostpass", 0.5f),
			("_AlphaCutoffPrepass", 0.5f),
			("_AlphaCutoffShadow", 0.5f),
			("_AlphaDstBlend", 0f),
			("_AlphaRemapMax", 1f),
			("_AlphaRemapMin", 0f),
			("_AlphaSrcBlend", 1f),
			("_AlphaToMask", 0f),
			("_AlphaToMaskInspectorValue", 0f),
			("_Anisotropy", 0f),
			("_BlendMode", 0f),
			("_CoatMask", 0f),
			("_CullMode", 2f),
			("_CullModeForward", 2f),
			("_Cutoff", 0.5f),
			("_DepthOffsetEnable", 0f),
			("_DetailAlbedoScale", 1f),
			("_DetailNormalScale", 1f),
			("_DetailSmoothnessScale", 1f),
			("_DiffusionProfile", 0f),
			("_DiffusionProfileHash", 0f),
			("_DisplacementLockObjectScale", 0f),
			("_DisplacementLockTilingScale", 1f),
			("_DisplacementMode", 2f),
			("_DoubleSidedEnable", 0f),
			("_DoubleSidedGIMode", 0f),
			("_DoubleSidedNormalMode", 1f),
			("_DstBlend", 0f),
			("_EmissiveColorMode", 1f),
			("_EmissiveExposureWeight", 1f),
			("_EmissiveIntensity", 1f),
			("_EmissiveIntensityUnit", 0f),
			("_EnableBlendModePreserveSpecularLighting", 1f),
			("_EnableFogOnTransparent", 1f),
			("_EnableGeometricSpecularAA", 0f),
			("_EnergyConservingSpecularColor", 1f),
			("_HeightAmplitude", 0.07f),
			("_HeightCenter", 1f),
			("_HeightMapParametrization", 0f),
			("_HeightMax", 1f),
			("_HeightMin", -1f),
			("_HeightOffset", 0f),
			("_HeightPoMAmplitude", 7f),
			("_HeightTessAmplitude", 2f),
			("_HeightTessCenter", 0.5f),
			("_InvTilingScale", 0.4f),
			("_Ior", 1.5f),
			("_IridescenceMask", 1f),
			("_IridescenceThickness", 1f),
			("_LinkDetailsWithBase", 1f),
			("_MaterialID", 1f),
			("_Metallic", 0f),
			("_MetallicRemapMax", 0.99160933f),
			("_MetallicRemapMin", 0.15410958f),
			("_NormalMapSpace", 0f),
			("_NormalScale", 0.4f),
			("_ObjectSpaceUVMapping", 0f),
			("_ObjectSpaceUVMappingEmissive", 0f),
			("_OpaqueCullMode", 2f),
			("_PPDLodThreshold", 5.92f),
			("_PPDMaxSamples", 15f),
			("_PPDMinSamples", 5f),
			("_PPDPrimitiveLength", 1.4f),
			("_PPDPrimitiveWidth", 1.4f),
			("_RayTracing", 0f),
			("_ReceivesSSR", 1f),
			("_ReceivesSSRTransparent", 0f),
			("_RefractionModel", 0f),
			("_Smoothness", 0.5f),
			("_SmoothnessRemapMax", 0.7226027f),
			("_SmoothnessRemapMin", 0f),
			("_SpecularAAScreenSpaceVariance", 0.1f),
			("_SpecularAAThreshold", 0.2f),
			("_SpecularOcclusionMode", 1f),
			("_SrcBlend", 1f),
			("_StencilRef", 0f),
			("_StencilRefDepth", 8f),
			("_StencilRefGBuffer", 10f),
			("_StencilRefMV", 40f),
			("_StencilWriteMask", 6f),
			("_StencilWriteMaskDepth", 9f),
			("_StencilWriteMaskGBuffer", 15f),
			("_StencilWriteMaskMV", 41f),
			("_SubsurfaceMask", 1f),
			("_SupportDecals", 1f),
			("_SurfaceType", 0f),
			("_TexWorldScale", 1f),
			("_TexWorldScaleEmissive", 1f),
			("_Thickness", 1f),
			("_TransmissionEnable", 1f),
			("_TransmissionMask", 1f),
			("_TransparentBackfaceEnable", 0f),
			("_TransparentCullMode", 2f),
			("_TransparentDepthPostpassEnable", 0f),
			("_TransparentDepthPrepassEnable", 0f),
			("_TransparentSortPriority", 0f),
			("_TransparentWritingMotionVec", 0f),
			("_TransparentZWrite", 0f),
			("_UVBase", 0f),
			("_UVDetail", 0f),
			("_UVEmissive", 0f),
			("_UseEmissiveIntensity", 0f),
			("_UseShadowThreshold", 0f),
			("_ZTestDepthEqualForOpaque", 3f),
			("_ZTestGBuffer", 4f),
			("_ZTestTransparent", 4f),
			("_ZWrite", 1f)
		};

		internal static readonly (string, float, float, float, float)[] SteelColors = new(string, float, float, float, float)[16]
		{
			("_BaseColor", 0.764151f, 0.764151f, 0.764151f, 1f),
			("_BaseColorMap_MipInfo", 0f, 0f, 0f, 0f),
			("_Color", 0.764151f, 0.764151f, 0.764151f, 1f),
			("_DiffusionProfileAsset", 0f, 0f, 0f, 0f),
			("_DoubleSidedConstants", 1f, 1f, -1f, 0f),
			("_EmissionColor", 1f, 1f, 1f, 1f),
			("_EmissiveColor", 0f, 0f, 0f, 1f),
			("_EmissiveColorLDR", 0f, 0f, 0f, 1f),
			("_InvPrimScale", 0.71428573f, 0.71428573f, 0f, 0f),
			("_IridescenceThicknessRemap", 0f, 1f, 0f, 0f),
			("_SpecularColor", 1f, 1f, 1f, 1f),
			("_ThicknessRemap", 0f, 1f, 0f, 0f),
			("_TransmittanceColor", 1f, 1f, 1f, 1f),
			("_UVDetailsMappingMask", 1f, 0f, 0f, 0f),
			("_UVMappingMask", 1f, 0f, 0f, 0f),
			("_UVMappingMaskEmissive", 1f, 0f, 0f, 0f)
		};

		internal static readonly string[] SteelKeywords = new string[6] { "_DISABLE_SSR_TRANSPARENT", "_DISPLACEMENT_LOCK_TILING_SCALE", "_MASKMAP", "_NORMALMAP", "_NORMALMAP_TANGENT_SPACE", "_PIXEL_DISPLACEMENT" };

		internal static readonly string[] SteelDisabledPasses = new string[5] { "TransparentDepthPrepass", "TransparentDepthPostpass", "TransparentBackface", "RayTracingPrepass", "MOTIONVECTORS" };

		internal const int SteelQueue = 2225;

		internal static readonly (string, float)[] GlassFloats = new(string, float)[125]
		{
			("_AORemapMax", 1f),
			("_AORemapMin", 0f),
			("_ATDistance", 1f),
			("_AddPrecomputedVelocity", 0f),
			("_AlbedoAffectEmissive", 0f),
			("_AlphaCutoff", 0.5f),
			("_AlphaCutoffEnable", 0f),
			("_AlphaCutoffPostpass", 0.5f),
			("_AlphaCutoffPrepass", 0.5f),
			("_AlphaCutoffShadow", 0.5f),
			("_AlphaDstBlend", 10f),
			("_AlphaRemapMax", 1f),
			("_AlphaRemapMin", 0f),
			("_AlphaSrcBlend", 1f),
			("_AlphaToMask", 0f),
			("_AlphaToMaskInspectorValue", 0f),
			("_Anisotropy", 0f),
			("_BlendMode", 0f),
			("_BumpScale", 1f),
			("_CoatMask", 0f),
			("_CullMode", 2f),
			("_CullModeForward", 2f),
			("_Cutoff", 0.5f),
			("_DepthOffsetEnable", 0f),
			("_DetailAlbedoScale", 1f),
			("_DetailNormalMapScale", 1f),
			("_DetailNormalScale", 1f),
			("_DetailSmoothnessScale", 1f),
			("_DiffusionProfile", 0f),
			("_DiffusionProfileHash", 0f),
			("_DisplacementLockObjectScale", 1f),
			("_DisplacementLockTilingScale", 1f),
			("_DisplacementMode", 0f),
			("_DoubleSidedEnable", 0f),
			("_DoubleSidedGIMode", 0f),
			("_DoubleSidedNormalMode", 1f),
			("_DstBlend", 10f),
			("_EmissiveColorMode", 1f),
			("_EmissiveExposureWeight", 1f),
			("_EmissiveIntensity", 1f),
			("_EmissiveIntensityUnit", 0f),
			("_EnableBlendModePreserveSpecularLighting", 1f),
			("_EnableFogOnTransparent", 1f),
			("_EnableGeometricSpecularAA", 0f),
			("_EnergyConservingSpecularColor", 1f),
			("_GlossMapScale", 1f),
			("_Glossiness", 0f),
			("_GlossyReflections", 1f),
			("_HeightAmplitude", 0.02f),
			("_HeightCenter", 0.5f),
			("_HeightMapParametrization", 0f),
			("_HeightMax", 1f),
			("_HeightMin", -1f),
			("_HeightOffset", 0f),
			("_HeightPoMAmplitude", 2f),
			("_HeightTessAmplitude", 2f),
			("_HeightTessCenter", 0.5f),
			("_InvTilingScale", 1f),
			("_Ior", 1.509f),
			("_IridescenceMask", 1f),
			("_IridescenceThickness", 1f),
			("_LinkDetailsWithBase", 1f),
			("_MaterialID", 1f),
			("_Metallic", 0.118f),
			("_MetallicRemapMax", 1f),
			("_MetallicRemapMin", 0f),
			("_Mode", 0f),
			("_NormalMapSpace", 0f),
			("_NormalScale", 1f),
			("_ObjectSpaceUVMapping", 0f),
			("_ObjectSpaceUVMappingEmissive", 0f),
			("_OcclusionStrength", 1f),
			("_OpaqueCullMode", 2f),
			("_PPDLodThreshold", 5f),
			("_PPDMaxSamples", 15f),
			("_PPDMinSamples", 5f),
			("_PPDPrimitiveLength", 1f),
			("_PPDPrimitiveWidth", 1f),
			("_Parallax", 0.02f),
			("_RayTracing", 0f),
			("_ReceivesSSR", 1f),
			("_ReceivesSSRTransparent", 0f),
			("_RefractionModel", 0f),
			("_Smoothness", 0.816f),
			("_SmoothnessRemapMax", 1f),
			("_SmoothnessRemapMin", 0f),
			("_SmoothnessTextureChannel", 0f),
			("_SpecularAAScreenSpaceVariance", 0.1f),
			("_SpecularAAThreshold", 0.2f),
			("_SpecularHighlights", 1f),
			("_SpecularOcclusionMode", 1f),
			("_SrcBlend", 1f),
			("_StencilRef", 0f),
			("_StencilRefDepth", 0f),
			("_StencilRefGBuffer", 2f),
			("_StencilRefMV", 32f),
			("_StencilWriteMask", 6f),
			("_StencilWriteMaskDepth", 9f),
			("_StencilWriteMaskGBuffer", 15f),
			("_StencilWriteMaskMV", 41f),
			("_SubsurfaceMask", 1f),
			("_SupportDecals", 1f),
			("_SurfaceType", 1f),
			("_TexWorldScale", 1f),
			("_TexWorldScaleEmissive", 1f),
			("_Thickness", 1f),
			("_TransmissionEnable", 1f),
			("_TransmissionMask", 1f),
			("_TransparentBackfaceEnable", 0f),
			("_TransparentCullMode", 2f),
			("_TransparentDepthPostpassEnable", 0f),
			("_TransparentDepthPrepassEnable", 0f),
			("_TransparentSortPriority", 0f),
			("_TransparentWritingMotionVec", 0f),
			("_TransparentZWrite", 0f),
			("_UVBase", 0f),
			("_UVDetail", 0f),
			("_UVEmissive", 0f),
			("_UVSec", 0f),
			("_UseEmissiveIntensity", 0f),
			("_UseShadowThreshold", 0f),
			("_ZTestDepthEqualForOpaque", 4f),
			("_ZTestGBuffer", 4f),
			("_ZTestTransparent", 4f),
			("_ZWrite", 0f)
		};

		internal static readonly (string, float, float, float, float)[] GlassColors = new(string, float, float, float, float)[16]
		{
			("_BaseColor", 0.7165584f, 95f / 106f, 0.5368903f, 13f / 51f),
			("_BaseColorMap_MipInfo", 0f, 0f, 0f, 0f),
			("_Color", 0.7165584f, 95f / 106f, 0.5368903f, 13f / 51f),
			("_DiffusionProfileAsset", 0f, 0f, 0f, 0f),
			("_DoubleSidedConstants", 1f, 1f, -1f, 0f),
			("_EmissionColor", 1f, 1f, 1f, 1f),
			("_EmissiveColor", 0f, 0f, 0f, 0f),
			("_EmissiveColorLDR", 0f, 0f, 0f, 1f),
			("_InvPrimScale", 1f, 1f, 0f, 0f),
			("_IridescenceThicknessRemap", 0f, 1f, 0f, 0f),
			("_SpecularColor", 1f, 1f, 1f, 1f),
			("_ThicknessRemap", 0f, 1f, 0f, 0f),
			("_TransmittanceColor", 1f, 1f, 1f, 1f),
			("_UVDetailsMappingMask", 1f, 0f, 0f, 0f),
			("_UVMappingMask", 1f, 0f, 0f, 0f),
			("_UVMappingMaskEmissive", 1f, 0f, 0f, 0f)
		};

		internal static readonly string[] GlassKeywords = new string[4] { "_DISABLE_SSR_TRANSPARENT", "_ENABLE_FOG_ON_TRANSPARENT", "_NORMALMAP_TANGENT_SPACE", "_SURFACE_TYPE_TRANSPARENT" };

		internal static readonly string[] GlassDisabledPasses = new string[5] { "TransparentDepthPrepass", "TransparentDepthPostpass", "TransparentBackface", "RayTracingPrepass", "MOTIONVECTORS" };

		internal const int GlassQueue = 3000;
	}
}