Decompiled source of UsefulShower v1.0.0

UsefulShower/usefulshower.dll

Decompiled an hour ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UsefulShower")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UsefulShower")]
[assembly: AssemblyTitle("UsefulShower")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 UsefulShower
{
	internal sealed class BloomCure : MonoBehaviour
	{
		private CadaverGrowthAI? bloom;

		private float nextSearch;

		private PlayerInfection? treating;

		internal static void Create()
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			GameObject val = new GameObject("UsefulShower.BloomCure")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<BloomCure>();
		}

		private void Update()
		{
			PlayerInfection val = LocalInfection();
			bool localShowering = ShowerPatch.LocalShowering;
			if (treating != null && (treating != val || !localShowering || !treating.infected))
			{
				StopTreating();
			}
			if (treating == null && val != null && localShowering && Plugin.BloomCureEnabled.Value && val.infected && val.healing <= 0 && val.infectionMeter < 1f && val.infectionMeter <= Plugin.BloomCurePercent.Value / 100f)
			{
				val.healing = Mathf.Max(0, val.healing) + 1;
				treating = val;
			}
		}

		private void StopTreating()
		{
			PlayerInfection val = treating;
			treating = null;
			val.healing = Mathf.Max(0, val.healing - 1);
			if (!val.infected)
			{
				val.multiplier = 1f;
			}
		}

		private PlayerInfection? LocalInfection()
		{
			if (!Object.op_Implicit((Object)(object)bloom) && Time.realtimeSinceStartup >= nextSearch)
			{
				nextSearch = Time.realtimeSinceStartup + 1f;
				bloom = Object.FindObjectOfType<CadaverGrowthAI>();
			}
			GameNetworkManager instance = GameNetworkManager.Instance;
			PlayerControllerB val = (Object.op_Implicit((Object)(object)instance) ? instance.localPlayerController : null);
			if (!Object.op_Implicit((Object)(object)bloom) || !Object.op_Implicit((Object)(object)val) || bloom.playerInfections == null)
			{
				return null;
			}
			ulong playerClientId = val.playerClientId;
			if (playerClientId >= (ulong)bloom.playerInfections.Length)
			{
				return null;
			}
			return bloom.playerInfections[playerClientId];
		}
	}
	internal sealed class MaxHealth : MonoBehaviour
	{
		internal const int Vanilla = 100;

		private const string UpgradesPlugin = "com.malco.lethalcompany.moreshipupgrades";

		private const string Stimpack = "MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades.Stimpack";

		private static PlayerControllerB? tracked;

		private static int peak;

		private static bool searched;

		private static FieldInfo? instance;

		private static FieldInfo? levels;

		private static MethodInfo? healthFor;

		internal static void Create()
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			GameObject val = new GameObject("UsefulShower.MaxHealth")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<MaxHealth>();
		}

		internal static int For(PlayerControllerB player)
		{
			return Math.Max(100, Math.Max(Upgraded(player), ((Object)(object)player == (Object)(object)tracked) ? peak : 0));
		}

		private void Update()
		{
			GameNetworkManager val = GameNetworkManager.Instance;
			PlayerControllerB val2 = (Object.op_Implicit((Object)(object)val) ? val.localPlayerController : null);
			if ((Object)(object)val2 != (Object)(object)tracked)
			{
				tracked = val2;
				peak = 0;
			}
			if (Object.op_Implicit((Object)(object)val2) && val2.isPlayerControlled && !val2.isPlayerDead && Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				peak = (StartOfRound.Instance.inShipPhase ? val2.health : Math.Max(peak, val2.health));
			}
		}

		private static void FindUpgrades()
		{
			searched = true;
			if (Chainloader.PluginInfos.TryGetValue("com.malco.lethalcompany.moreshipupgrades", out var value) && Object.op_Implicit((Object)(object)value.Instance))
			{
				Type type = ((object)value.Instance).GetType().Assembly.GetType("MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades.Stimpack");
				if (!(type == null))
				{
					instance = AccessTools.Field(type, "Instance");
					levels = AccessTools.Field(type, "playerHealthLevels");
					healthFor = AccessTools.Method(type, "GetHealthFromPlayer", new Type[2]
					{
						typeof(int),
						typeof(ulong)
					}, (Type[])null);
				}
			}
		}

		private static int Upgraded(PlayerControllerB player)
		{
			if (!searched)
			{
				FindUpgrades();
			}
			if (instance == null || levels == null || healthFor == null)
			{
				return 100;
			}
			try
			{
				object value = instance.GetValue(null);
				if (value == null || !(levels.GetValue(value) is Dictionary<ulong, int> dictionary) || !dictionary.ContainsKey(player.playerSteamId))
				{
					return 100;
				}
				return (int)healthFor.Invoke(null, new object[2] { 100, player.playerSteamId });
			}
			catch (Exception arg)
			{
				instance = null;
				Plugin.Log.LogWarning((object)$"Lategame Upgrades health lookup failed, using observed max health instead: {arg}");
				return 100;
			}
		}
	}
	[BepInPlugin("achachala.usefulshower", "Useful Shower", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Id = "achachala.usefulshower";

		public const string Version = "1.0.0";

		internal static ConfigEntry<bool> SanityEnabled;

		internal static ConfigEntry<float> SanityPerSecond;

		internal static ConfigEntry<bool> HealingEnabled;

		internal static ConfigEntry<float> HealthPerSecond;

		internal static ConfigEntry<bool> MeterEnabled;

		internal static ConfigEntry<bool> AlwaysInStore;

		internal static ConfigEntry<bool> VisorWaterEnabled;

		internal static ConfigEntry<bool> BloomCureEnabled;

		internal static ConfigEntry<float> BloomCurePercent;

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			SanityEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sanity", "Enabled", true, "Standing under a running shower lowers your insanity.");
			SanityPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Sanity", "PointsPerSecond", 2f, new ConfigDescription("Insanity removed per second while in the shower.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 50f), Array.Empty<object>()));
			HealingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Healing", "Enabled", true, "Standing under a running shower heals you.");
			HealthPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Healing", "HealthPerSecond", 2f, new ConfigDescription("HP restored per second while in the shower, up to your max health (100, or higher with health upgrades).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 100f), Array.Empty<object>()));
			MeterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "SanityMeter", false, "Show a meter at the top of the screen with your current insanity level (0-50).");
			VisorWaterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "VisorWater", true, "Show water running down your visor while you're in the shower.");
			AlwaysInStore = ((BaseUnityPlugin)this).Config.Bind<bool>("Store", "ShowerAlwaysInStore", true, "Keep the shower in the store's decor selection every rotation instead of only sometimes.");
			BloomCureEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("CadaverBloom", "ExtendedCure", true, "Let the shower cure cadaver bloom infections up to CurePercent. Off = vanilla: only infections under 8% are cured.");
			BloomCurePercent = ((BaseUnityPlugin)this).Config.Bind<float>("CadaverBloom", "CurePercent", 50f, new ConfigDescription("With ExtendedCure on, the shower cures an infection at or below this percent.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 99f), Array.Empty<object>()));
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("achachala.usefulshower");
			val.PatchAll(typeof(ShowerPatch));
			val.PatchAll(typeof(StorePatch));
			SanityMeter.Create();
			VisorWater.Create();
			MaxHealth.Create();
			BloomCure.Create();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Useful Shower 1.0.0 loaded.");
		}
	}
	[HarmonyPatch(typeof(ShowerTrigger), "Update")]
	internal static class ShowerPatch
	{
		private static readonly FieldRef<ShowerTrigger, bool> ShowerOn = AccessTools.FieldRefAccess<ShowerTrigger, bool>("showerOn");

		private static float healCarry;

		private static float lastShowerTime = -10f;

		internal static bool LocalShowering => Time.time - lastShowerTime < 0.15f;

		[HarmonyPostfix]
		private static void Postfix(ShowerTrigger __instance)
		{
			PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null);
			if (!IsShowering(__instance, val))
			{
				healCarry = 0f;
				return;
			}
			lastShowerTime = Time.time;
			float deltaTime = Time.deltaTime;
			if (Plugin.SanityEnabled.Value && val.insanityLevel > 0f)
			{
				val.insanityLevel = Mathf.MoveTowards(val.insanityLevel, 0f, Plugin.SanityPerSecond.Value * deltaTime);
			}
			int num = MaxHealth.For(val);
			if (Plugin.HealingEnabled.Value && val.health < num)
			{
				Heal(val, num, deltaTime);
			}
			else
			{
				healCarry = 0f;
			}
		}

		private static bool IsShowering(ShowerTrigger shower, PlayerControllerB? player)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)player) || player.isPlayerDead || !player.isPlayerControlled || !player.isInElevator)
			{
				return false;
			}
			if (!ShowerOn.Invoke(shower) || !Object.op_Implicit((Object)(object)shower.showerCollider) || !Object.op_Implicit((Object)(object)player.gameplayCamera))
			{
				return false;
			}
			Bounds bounds = shower.showerCollider.bounds;
			return ((Bounds)(ref bounds)).Contains(((Component)player.gameplayCamera).transform.position);
		}

		private static void Heal(PlayerControllerB player, int cap, float dt)
		{
			healCarry += Plugin.HealthPerSecond.Value * dt;
			int num = (int)healCarry;
			if (num > 0)
			{
				healCarry -= num;
				player.health = Mathf.Max(player.health, Mathf.Min(player.health + num, cap));
				if (player.criticallyInjured && player.health >= 20)
				{
					player.MakeCriticallyInjured(false);
				}
				HUDManager instance = HUDManager.Instance;
				if (Object.op_Implicit((Object)(object)instance))
				{
					instance.UpdateHealthUI(player.health, false);
					instance.SetCracksOnVisor((float)player.health);
				}
			}
		}
	}
	internal sealed class SanityMeter : MonoBehaviour
	{
		private const float Max = 50f;

		private GUIStyle? label;

		internal static void Create()
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			GameObject val = new GameObject("UsefulShower.SanityMeter")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<SanityMeter>();
		}

		private void OnGUI()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_01c5: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			GUI.depth = 0;
			if (!Plugin.MeterEnabled.Value || (int)Event.current.type != 7)
			{
				return;
			}
			GameNetworkManager instance = GameNetworkManager.Instance;
			PlayerControllerB val = (Object.op_Implicit((Object)(object)instance) ? instance.localPlayerController : null);
			if (Object.op_Implicit((Object)(object)val) && !val.isPlayerDead && val.isPlayerControlled)
			{
				float num = Mathf.Clamp(val.insanityLevel, 0f, 50f);
				float num2 = num / 50f;
				float num3 = (float)Screen.height / 1080f;
				float num4 = 220f * num3;
				float num5 = 14f * num3;
				float num6 = 3f * num3;
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(((float)Screen.width - num4) / 2f, 18f * num3, num4, num5);
				Color color = GUI.color;
				GUI.color = new Color(0f, 0f, 0f, 0.6f);
				GUI.DrawTexture(new Rect(((Rect)(ref val2)).x - num6, ((Rect)(ref val2)).y - num6, ((Rect)(ref val2)).width + num6 * 2f, ((Rect)(ref val2)).height + num6 * 2f), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = new Color(0.25f, 0.25f, 0.28f, 0.8f);
				GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
				GUI.color = Color.Lerp(new Color(0.35f, 0.85f, 0.45f), new Color(0.9f, 0.25f, 0.2f), num2);
				GUI.DrawTexture(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width * num2, ((Rect)(ref val2)).height), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color;
				if (label == null)
				{
					label = new GUIStyle(GUI.skin.label)
					{
						alignment = (TextAnchor)4,
						fontStyle = (FontStyle)1
					};
				}
				label.fontSize = Mathf.Max(10, Mathf.RoundToInt(13f * num3));
				label.normal.textColor = Color.white;
				GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).yMax + num6, ((Rect)(ref val2)).width, 20f * num3), $"Insanity {num:0.0} / {50f:0}", label);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal), "RotateShipDecorSelection")]
	internal static class StorePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Terminal __instance)
		{
			if (!Plugin.AlwaysInStore.Value || !Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				return;
			}
			foreach (UnlockableItem unlockable in StartOfRound.Instance.unlockablesList.unlockables)
			{
				TerminalNode shopSelectionNode = unlockable.shopSelectionNode;
				if (!((Object)(object)shopSelectionNode == (Object)null) && (IsShower(unlockable.unlockableName) || IsShower(shopSelectionNode.creatureName)))
				{
					if (!__instance.ShipDecorSelection.Contains(shopSelectionNode))
					{
						__instance.ShipDecorSelection.Add(shopSelectionNode);
					}
					return;
				}
			}
			Plugin.Log.LogWarning((object)"Couldn't find the Shower in the unlockables list; it won't be added to the store.");
		}

		private static bool IsShower(string? name)
		{
			return name?.Trim().Equals("Shower", StringComparison.OrdinalIgnoreCase) ?? false;
		}
	}
	internal sealed class VisorWater : MonoBehaviour
	{
		private struct Drop
		{
			public float X;

			public float Y;

			public float Size;

			public float Speed;

			public float Stick;

			public float Phase;

			public float Alpha;
		}

		private const int MaxDrops = 140;

		private const float SpawnPerSecond = 32f;

		private readonly List<Drop> drops = new List<Drop>();

		private float intensity;

		private float spawnCarry;

		private Texture2D dropTex;

		private Texture2D trailTex;

		private static bool Showering => ShowerPatch.LocalShowering;

		internal static void Create()
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			GameObject val = new GameObject("UsefulShower.VisorWater")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<VisorWater>();
		}

		private void Awake()
		{
			dropTex = MakeDropTexture(64);
			trailTex = MakeTrailTexture(16, 64);
		}

		private void Update()
		{
			float deltaTime = Time.deltaTime;
			bool flag = Plugin.VisorWaterEnabled.Value && Showering && LocalPlayerAlive();
			intensity = Mathf.MoveTowards(intensity, flag ? 1f : 0f, deltaTime * (flag ? 2f : 0.6f));
			if (!Plugin.VisorWaterEnabled.Value || !LocalPlayerAlive())
			{
				drops.Clear();
				intensity = 0f;
				return;
			}
			if (flag)
			{
				spawnCarry += 32f * intensity * deltaTime;
				while (spawnCarry >= 1f && drops.Count < 140)
				{
					spawnCarry -= 1f;
					drops.Add(NewDrop());
				}
				if (drops.Count >= 140)
				{
					spawnCarry = 0f;
				}
			}
			for (int num = drops.Count - 1; num >= 0; num--)
			{
				Drop value = drops[num];
				if (value.Stick > 0f)
				{
					value.Stick -= deltaTime;
				}
				else
				{
					value.Y += value.Speed * deltaTime;
					value.Phase += deltaTime * 3f;
					value.X += Mathf.Sin(value.Phase) * 0.004f * deltaTime;
					if (value.Size < 0.02f && Random.value < deltaTime * 0.6f)
					{
						value.Stick = Random.Range(0.2f, 0.9f);
					}
				}
				if (!flag)
				{
					value.Alpha -= deltaTime * 0.35f;
				}
				if (value.Y - value.Size > 1.05f || value.Alpha <= 0f)
				{
					drops.RemoveAt(num);
				}
				else
				{
					drops[num] = value;
				}
			}
		}

		private static Drop NewDrop()
		{
			float num = Random.Range(0.008f, 0.03f);
			return new Drop
			{
				X = Random.value,
				Y = ((Random.value < 0.35f) ? (0f - num) : Random.Range(0f, 0.85f)),
				Size = num,
				Speed = Mathf.Lerp(0.04f, 0.45f, Mathf.InverseLerp(0.008f, 0.03f, num)) * Random.Range(0.7f, 1.3f),
				Stick = ((Random.value < 0.3f) ? Random.Range(0.1f, 1.2f) : 0f),
				Phase = Random.value * 6.28f,
				Alpha = Random.Range(0.55f, 0.9f)
			};
		}

		private static bool LocalPlayerAlive()
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			PlayerControllerB val = (Object.op_Implicit((Object)(object)instance) ? instance.localPlayerController : null);
			if (Object.op_Implicit((Object)(object)val) && !val.isPlayerDead)
			{
				return val.isPlayerControlled;
			}
			return false;
		}

		private void OnGUI()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			GUI.depth = 10;
			if ((int)Event.current.type != 7 || (intensity <= 0f && drops.Count == 0))
			{
				return;
			}
			float num = Screen.width;
			float num2 = Screen.height;
			Color color = GUI.color;
			GUI.color = new Color(0.55f, 0.72f, 0.9f, 0.13f * intensity);
			GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)Texture2D.whiteTexture);
			foreach (Drop drop in drops)
			{
				float num3 = drop.Size * num2;
				float num4 = drop.X * num;
				float num5 = drop.Y * num2;
				bool num6 = drop.Stick <= 0f;
				if (num6)
				{
					float num7 = Mathf.Min(drop.Speed * num2 * 0.9f, num5 + num3);
					float num8 = num3 * 0.45f;
					GUI.color = new Color(0.8f, 0.9f, 1f, drop.Alpha * 0.45f);
					GUI.DrawTexture(new Rect(num4 - num8 / 2f, num5 - num7, num8, num7), (Texture)(object)trailTex);
				}
				float num9 = (num6 ? (num3 * 1.25f) : num3);
				GUI.color = new Color(0.85f, 0.93f, 1f, drop.Alpha);
				GUI.DrawTexture(new Rect(num4 - num3 / 2f, num5 - num9 / 2f, num3, num9), (Texture)(object)dropTex);
			}
			GUI.color = color;
		}

		private static Texture2D MakeDropTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			float num = (float)size / 2f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num2 = ((float)j + 0.5f - num) / num;
					float num3 = ((float)i + 0.5f - num) / num;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					if (num4 >= 1f)
					{
						val.SetPixel(j, i, Color.clear);
						continue;
					}
					float num5 = Mathf.SmoothStep(0f, 1f, (1f - num4) / 0.15f);
					float num6 = Mathf.Pow(num4, 3f);
					float num7 = num2 + 0.35f;
					float num8 = num3 - 0.4f;
					float num9 = Mathf.Clamp01(1f - Mathf.Sqrt(num7 * num7 + num8 * num8) / 0.28f);
					float num10 = Mathf.Lerp(0.75f, 0.35f, num6) + num9 * 0.65f;
					float num11 = (0.18f + num6 * 0.55f + num9 * 0.8f) * num5;
					val.SetPixel(j, i, new Color(num10, num10, Mathf.Min(1f, num10 + 0.1f), Mathf.Clamp01(num11)));
				}
			}
			val.Apply();
			return val;
		}

		private static Texture2D MakeTrailTexture(int w, int h)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			for (int i = 0; i < h; i++)
			{
				for (int j = 0; j < w; j++)
				{
					float num = 1f - Mathf.Abs(((float)j + 0.5f) / (float)w * 2f - 1f);
					float num2 = 1f - (float)i / (float)(h - 1);
					float num3 = Mathf.SmoothStep(0f, 1f, num) * num2 * num2 * 0.6f;
					val.SetPixel(j, i, new Color(0.9f, 0.95f, 1f, num3));
				}
			}
			val.Apply();
			return val;
		}
	}
}