Decompiled source of Potions v1.1.0

plugins/com.khakixd.potions.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items;
using PEAKLib.Items.UnityEditor;
using Peak.Afflictions;
using Photon.Pun;
using Photon.Realtime;
using Potions.APIs;
using Potions.CustomAfflictions;
using Potions.Juicing;
using Potions.Patches;
using Potions.PotionEffects;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;
using Zorro.Core.Serizalization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.khakixd.potions")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+db1c1c599162d5ad25fa8144cebdad4ad54b18a7")]
[assembly: AssemblyProduct("com.khakixd.potions")]
[assembly: AssemblyTitle("Potions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Potions
{
	public class Biodegradable : MonoBehaviour
	{
		private float lifetime;

		private void Awake()
		{
			lifetime = Random.Range(25f, 50f);
		}

		private void Update()
		{
			lifetime -= Time.deltaTime;
			if (lifetime <= 0f && PhotonNetwork.IsMasterClient)
			{
				PhotonNetwork.Destroy(((Component)this).gameObject);
			}
		}
	}
	public static class BuiltinPotions
	{
		private static Color GetSeededColor(string seed, float saturation)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			int hashCode = seed.GetHashCode();
			Random random = new Random(hashCode);
			float num = (float)random.NextDouble();
			saturation = Mathf.Clamp01(saturation);
			return Color.HSVToRGB(num, saturation, 1f);
		}

		internal static void CreatePotions()
		{
			//IL_0059: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: 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_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0769: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bde: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf4: Unknown result type (might be due to invalid IL or missing references)
			Potion potion = new Potion();
			potion.name = "Vile Potion";
			potion.drinkTime = 4.5f;
			potion.id = "vile";
			potion.effects = new List<PotionEffect>(1)
			{
				new Poisoned(110f)
			};
			potion.liquidColour = new Color(0.1f, 0.9f, 0.4f);
			potion.recipe = new string[2] { "X", "Y" };
			Potion pot = potion;
			PotionAPI.RegisterPotion(pot);
			potion = new Potion();
			potion.name = "Rat Poison";
			potion.drinkTime = 0.5f;
			potion.id = "rat_poison";
			potion.effects = new List<PotionEffect>(1)
			{
				new Die()
			};
			potion.liquidColour = new Color(0f, 0.9f, 0f);
			potion.recipe = new string[2] { "Vile Potion", "Green Crispberry" };
			Potion pot2 = potion;
			PotionAPI.RegisterPotion(pot2);
			potion = new Potion();
			potion.name = "Potion of Happiness";
			potion.drinkTime = 4.5f;
			potion.id = "happiness";
			potion.effects = new List<PotionEffect>(1)
			{
				new Potion_MoraleBoost()
			};
			potion.liquidColour = new Color(1f, 0.922f, 0.102f);
			potion.recipe = new string[2] { "Berrynana Peel", "Yellow Crispberry" };
			Potion pot3 = potion;
			PotionAPI.RegisterPotion(pot3);
			potion = new Potion();
			potion.name = "Erratic Potion";
			potion.drinkTime = 4.5f;
			potion.id = "erratic";
			potion.effects = new List<PotionEffect>(2)
			{
				new InfiniteStamina(20f),
				new IncreasedSpeed(20f)
			};
			potion.liquidColour = new Color(1f, 0.149f, 0.863f, 1f);
			potion.recipe = new string[2] { "Big Lollipop", "Energy Drink" };
			Potion pot4 = potion;
			PotionAPI.RegisterPotion(pot4);
			potion = new Potion();
			potion.name = "Temperate Potion";
			potion.drinkTime = 4.5f;
			potion.id = "temperate";
			potion.effects = new List<PotionEffect>(1)
			{
				new Temperate(120f)
			};
			potion.liquidColour = new Color(0.4f, 0.4f, 0.4f);
			potion.recipe = new string[2] { "Clusterberry!", "Cluster Shroom" };
			Potion pot5 = potion;
			PotionAPI.RegisterPotion(pot5);
			potion = new Potion();
			potion.name = "Numbness Potion";
			potion.drinkTime = 4.5f;
			potion.id = "numbness";
			potion.effects = new List<PotionEffect>(1)
			{
				new Numbness(120f)
			};
			potion.liquidColour = GetSeededColor("numbness", 0.4f);
			potion.recipe = new string[2] { "Shroom!", "Shroom!" };
			Potion pot6 = potion;
			PotionAPI.RegisterPotion(pot6);
			potion = new Potion();
			potion.name = "Potion of Selflessness";
			potion.drinkTime = 4.5f;
			potion.id = "selflessness";
			potion.effects = new List<PotionEffect>(2)
			{
				new ReviveTheHomies(),
				new Die()
			};
			potion.liquidColour = GetSeededColor("selflessness", 0.8f);
			potion.recipe = new string[2] { "Remedy Fungus", "Shelf Fungus" };
			Potion pot7 = potion;
			PotionAPI.RegisterPotion(pot7);
			potion = new Potion();
			potion.name = "Potion of Impatience";
			potion.drinkTime = 4.5f;
			potion.id = "impatience";
			potion.effects = new List<PotionEffect>(4)
			{
				new RemoveStatus(1f, (STATUSTYPE)2),
				new RemoveStatus(1f, (STATUSTYPE)8),
				new RemoveStatus(1f, (STATUSTYPE)3),
				new RemoveStatus(1f, (STATUSTYPE)6)
			};
			potion.liquidColour = GetSeededColor("impatience", 0.2f);
			potion.recipe = new string[2] { "Shroom!", "Crispberry!" };
			Potion pot8 = potion;
			PotionAPI.RegisterPotion(pot8);
			potion = new Potion();
			potion.name = "Potion of Lifesteal";
			potion.drinkTime = 4.5f;
			potion.id = "lifesteal";
			potion.effects = new List<PotionEffect>(1)
			{
				new Lifesteal(60f)
			};
			potion.liquidColour = GetSeededColor("lifesteal", 1f);
			potion.recipe = new string[2] { "Remedy Fungus", "Coconut!" };
			Potion pot9 = potion;
			PotionAPI.RegisterPotion(pot9);
			potion = new Potion();
			potion.name = "Potion of Levitation";
			potion.drinkTime = 4.5f;
			potion.id = "levitation";
			potion.effects = new List<PotionEffect>(1)
			{
				new Levitation(60f)
			};
			potion.liquidColour = GetSeededColor("levitation", 0.401337f);
			potion.recipe = new string[2] { "Scout Cannon", "Coconut!" };
			Potion pot10 = potion;
			PotionAPI.RegisterPotion(pot10);
			potion = new Potion();
			potion.name = "Potion of Negativity";
			potion.drinkTime = 4.5f;
			potion.id = "negativity";
			potion.effects = new List<PotionEffect>(1)
			{
				new ClearAfflictions()
			};
			potion.liquidColour = GetSeededColor("negativity", 0.401337f);
			potion.recipe = new string[2] { "Shroom!", "Remedy Fungus" };
			Potion pot11 = potion;
			PotionAPI.RegisterPotion(pot11);
			potion = new Potion();
			potion.name = "Duck in a Bottle";
			potion.drinkTime = 4.5f;
			potion.id = "ducky";
			potion.effects = new List<PotionEffect>(1)
			{
				new Ducky()
			};
			potion.liquidColour = GetSeededColor("duck", 0.7f);
			potion.recipe = new string[2] { "Napberry", "Kingberry!" };
			Potion pot12 = potion;
			PotionAPI.RegisterPotion(pot12);
			potion = new Potion();
			potion.name = "Pinata Potion";
			potion.drinkTime = 4.5f;
			potion.id = "pinata";
			potion.effects = new List<PotionEffect>(1)
			{
				new Pinata(240f)
			};
			potion.liquidColour = GetSeededColor("pinata", 0.7f);
			potion.recipe = new string[2] { "Shroom!", "Kingberry!" };
			Potion pot13 = potion;
			PotionAPI.RegisterPotion(pot13);
			potion = new Potion();
			potion.name = "Potion of Employment";
			potion.drinkTime = 0.2f;
			potion.id = "employment";
			potion.effects = new List<PotionEffect>(1)
			{
				new ForceQuitTheGameLmfao()
			};
			potion.liquidColour = GetSeededColor("employment", 0.7f);
			potion.recipe = new string[2] { "Ancient Idol", "Potion of Happiness" };
			Potion pot14 = potion;
			PotionAPI.RegisterPotion(pot14);
			potion = new Potion();
			potion.name = "Sandstorm in a Bottle";
			potion.drinkTime = 4.5f;
			potion.id = "tornado";
			potion.effects = new List<PotionEffect>(1)
			{
				new SpawnPrefab("Tornado", separate: false)
			};
			potion.liquidColour = GetSeededColor("sandstorm", 0.7f);
			potion.recipe = new string[2] { "Prickleberry!", "rope spool" };
			Potion pot15 = potion;
			PotionAPI.RegisterPotion(pot15);
			potion = new Potion();
			potion.name = "Antimatter Potion";
			potion.drinkTime = 4.5f;
			potion.id = "antimatter";
			potion.effects = new List<PotionEffect>(2)
			{
				new AntimatterExplosion(),
				new Die()
			};
			potion.liquidColour = new Color(0.2f, 0.2f, 1f);
			potion.recipe = new string[2] { "Crispberry!", "anti-rope!" };
			Potion pot16 = potion;
			PotionAPI.RegisterPotion(pot16);
			potion = new Potion();
			potion.name = "Potion?";
			potion.drinkTime = 4.5f;
			potion.id = "literallynothinglmfao";
			potion.effects = new List<PotionEffect>();
			potion.liquidColour = new Color(1f, 1f, 1f);
			potion.recipe = new string[2] { "Antimatter Potion", "Antimatter Potion" };
			Potion pot17 = potion;
			PotionAPI.RegisterPotion(pot17);
			potion = new Potion();
			potion.name = "Potion of Positivity";
			potion.drinkTime = 4.5f;
			potion.id = "positivity";
			potion.effects = new List<PotionEffect>(12)
			{
				new IncreasedSpeed(60f),
				new InfiniteStamina(60f),
				new Levitation(60f),
				new Lifesteal(60f),
				new Potion_MoraleBoost(),
				new Numbness(60f),
				new Poisoned(50f),
				new Rebirth(60f),
				new ReviveTheHomies(),
				new Temperate(60f),
				new AntimatterExplosion(),
				new Pinata(60f)
			};
			potion.liquidColour = GetSeededColor("positivity", 0.401337f);
			potion.recipe = new string[2] { "Potion of Negativity", "Antimatter Potion" };
			Potion pot18 = potion;
			PotionAPI.RegisterPotion(pot18);
			potion = new Potion();
			potion.name = "Potion of Selfishness";
			potion.drinkTime = 4.5f;
			potion.id = "selfishness";
			potion.effects = new List<PotionEffect>(11)
			{
				new RemoveStatus(255f, (STATUSTYPE)2),
				new RemoveStatus(255f, (STATUSTYPE)8),
				new RemoveStatus(255f, (STATUSTYPE)1),
				new RemoveStatus(255f, (STATUSTYPE)9),
				new RemoveStatus(255f, (STATUSTYPE)0),
				new RemoveStatus(255f, (STATUSTYPE)3),
				new RemoveStatus(255f, (STATUSTYPE)6),
				new RemoveStatus(255f, (STATUSTYPE)5),
				new RemoveStatus(255f, (STATUSTYPE)10),
				new RemoveStatus(255f, (STATUSTYPE)11),
				new KillRandomMf()
			};
			potion.liquidColour = GetSeededColor("selfishness", 0.8f);
			potion.recipe = new string[2] { "Remedy Fungus", "Shelf Fungus" };
			Potion pot19 = potion;
			PotionAPI.RegisterPotion(pot19);
			potion = new Potion();
			potion.name = "Potion of Rebirth";
			potion.drinkTime = 0.5f;
			potion.id = "Rebirth";
			potion.effects = new List<PotionEffect>(1)
			{
				new Rebirth(60f)
			};
			potion.liquidColour = new Color(1f, 1f, 0.2f);
			potion.recipe = new string[2] { "Rat Poison", "Antimatter Potion" };
			Potion pot20 = potion;
			PotionAPI.RegisterPotion(pot20);
			potion = new Potion();
			potion.name = "Tumbleweed(s) in a Bottle";
			potion.drinkTime = 4.5f;
			potion.id = "tumbleweed";
			potion.effects = new List<PotionEffect>(1)
			{
				new SpawnPrefab("Tumbleweed", separate: true, 25)
			};
			potion.liquidColour = GetSeededColor("tumbleweed", 0.2f);
			potion.recipe = new string[2] { "Sandstorm in a Bottle", "Antimatter Potion" };
			Potion pot21 = potion;
			PotionAPI.RegisterPotion(pot21);
			potion = new Potion();
			potion.name = "Potion of Infestation";
			potion.drinkTime = 0.5f;
			potion.id = "infestation";
			potion.effects = new List<PotionEffect>(1)
			{
				new SpawnPrefab("MushroomZombie", separate: true, 5)
			};
			potion.liquidColour = GetSeededColor("infestation", 1f);
			potion.recipe = new string[2] { "Lifesteal Potion", "Antimatter Potion" };
			Potion pot22 = potion;
			PotionAPI.RegisterPotion(pot22);
		}
	}
	public class Cauldron : MonoBehaviour, IInteractibleConstant, IInteractible
	{
		public bool ignited;

		private bool dead;

		private PhotonView photonView;

		private int storedItems;

		private const int maxStoredItems = 2;

		private const float igniteDurationSeconds = 180f;

		private Transform itemsRoot;

		private List<string> itemsStored = new List<string>();

		private Bubbles bubbles;

		private float timeRemaining;

		private double igniteEndTimestamp;

		private AudioSource audioSource;

		private readonly List<ParticleSystem> enableWhenLitParticles = new List<ParticleSystem>();

		private readonly List<Transform> itemSlots = new List<Transform>();

		private Coroutine brewRoutine;

		private static bool HasNetwork
		{
			get
			{
				if (PhotonNetwork.IsConnected)
				{
					return PhotonNetwork.CurrentRoom != null;
				}
				return false;
			}
		}

		private bool HasNetworkAuthority
		{
			get
			{
				if (HasNetwork)
				{
					return PhotonNetwork.IsMasterClient;
				}
				return true;
			}
		}

		public bool holdOnFinish { get; }

		private void Awake()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			bubbles = ((Component)((Component)this).transform.Find("Cylinder").Find("Bubbles")).GetComponent<Bubbles>();
			itemsRoot = ((Component)this).transform.Find("Items");
			photonView = ((Component)this).GetComponent<PhotonView>();
			audioSource = ((Component)this).GetComponent<AudioSource>();
			if ((Object)(object)itemsRoot != (Object)null)
			{
				foreach (Transform item2 in itemsRoot)
				{
					Transform item = item2;
					itemSlots.Add(item);
				}
			}
			foreach (Transform item3 in ((Component)this).transform.Find("EnableWhenLit"))
			{
				Transform val = item3;
				ParticleSystem component = ((Component)val).GetComponent<ParticleSystem>();
				if (!((Object)(object)component == (Object)null))
				{
					enableWhenLitParticles.Add(component);
					component.Stop();
				}
			}
		}

		private void Update()
		{
			if (!ignited)
			{
				return;
			}
			double num = igniteEndTimestamp - GetNetworkTime();
			timeRemaining = Mathf.Max(0f, (float)num);
			if (!(timeRemaining > 0f) && HasNetworkAuthority)
			{
				HandleFireExpired();
				if (HasNetwork)
				{
					photonView.RPC("RPC_HandleFireExpired", (RpcTarget)1, Array.Empty<object>());
				}
			}
		}

		public bool IsInteractible(Character interactor)
		{
			if (dead)
			{
				return false;
			}
			if (storedItems >= 2)
			{
				return true;
			}
			if (ignited)
			{
				return (Object)(object)interactor.data.currentItem != (Object)null;
			}
			return true;
		}

		public void Interact(Character interactor)
		{
		}

		public void HoverEnter()
		{
		}

		public void HoverExit()
		{
		}

		public Vector3 Center()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			Bounds bounds = ((Renderer)((Component)this).GetComponent<MeshRenderer>()).bounds;
			return ((Bounds)(ref bounds)).center;
		}

		public Transform GetTransform()
		{
			return ((Component)this).transform;
		}

		public string GetInteractionText()
		{
			if (storedItems == 2)
			{
				return "boil";
			}
			if (ignited)
			{
				return "add";
			}
			return "light";
		}

		public string GetName()
		{
			return "CAULDRON";
		}

		public bool IsConstantlyInteractable(Character interactor)
		{
			return IsInteractible(interactor);
		}

		public float GetInteractTime(Character interactor)
		{
			if (ignited)
			{
				return 1f;
			}
			return 3f;
		}

		public void Interact_CastFinished(Character interactor)
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			if (storedItems == 2)
			{
				if (HasNetwork)
				{
					photonView.RPC("RPC_RequestBrew", (RpcTarget)2, new object[1] { GetViewId(interactor) });
				}
				else
				{
					HandleBrewOffline(interactor);
				}
			}
			else if (ignited)
			{
				Item currentItem = interactor.data.currentItem;
				if ((Object)(object)currentItem == (Object)null)
				{
					return;
				}
				PhotonView component = ((Component)currentItem).GetComponent<PhotonView>();
				if (HasNetwork)
				{
					if ((Object)(object)component == (Object)null)
					{
						Plugin.Log.LogError((object)"Held item missing PhotonView; cannot add to cauldron across network.");
						return;
					}
					((Component)currentItem).gameObject.SetActive(false);
					photonView.RPC("RPC_RequestAddItem", (RpcTarget)2, new object[2]
					{
						component.ViewID,
						currentItem.UIData.itemName
					});
				}
				else
				{
					HandleAddItemOffline(currentItem, currentItem.UIData.itemName);
				}
				interactor.player.EmptySlot(interactor.refs.items.currentSelectedSlot);
			}
			else if (HasNetwork)
			{
				photonView.RPC("RPC_RequestIgnite", (RpcTarget)2, new object[1] { GetViewId(interactor) });
			}
			else
			{
				double endTimestamp = GetNetworkTime() + 180.0;
				ApplyIgnitedState(endTimestamp);
			}
		}

		private static int GetViewId(Character character)
		{
			if ((Object)(object)character == (Object)null)
			{
				return -1;
			}
			PhotonView component = ((Component)character).GetComponent<PhotonView>();
			if (!((Object)(object)component != (Object)null))
			{
				return -1;
			}
			return component.ViewID;
		}

		private static double GetNetworkTime()
		{
			if (!HasNetwork)
			{
				return Time.time;
			}
			return PhotonNetwork.Time;
		}

		private int ChooseItemSlotIndex()
		{
			if (itemSlots.Count > 0)
			{
				return Random.Range(0, itemSlots.Count);
			}
			if ((Object)(object)itemsRoot == (Object)null || itemsRoot.childCount == 0)
			{
				return 0;
			}
			return Random.Range(0, itemsRoot.childCount);
		}

		private void ApplyIgnitedState(double endTimestamp)
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			ignited = true;
			dead = false;
			igniteEndTimestamp = endTimestamp;
			timeRemaining = Mathf.Max(0f, (float)(igniteEndTimestamp - GetNetworkTime()));
			((Component)((Component)this).transform.Find("Boils")).gameObject.SetActive(true);
			foreach (ParticleSystem enableWhenLitParticle in enableWhenLitParticles)
			{
				enableWhenLitParticle.Play();
			}
			if ((Object)(object)bubbles != (Object)null)
			{
				((Behaviour)bubbles).enabled = true;
				bubbles.__enabled = true;
			}
			AudioSource obj = audioSource;
			if (obj != null)
			{
				obj.Play();
			}
			Plugin.FireStarted.Play(((Component)this).transform.position);
		}

		private void HandleFireExpired()
		{
			StopIgniteVisuals(markDead: true);
		}

		private void StopIgniteVisuals(bool markDead)
		{
			((Component)((Component)this).transform.Find("Boils")).gameObject.SetActive(false);
			ignited = false;
			dead = markDead;
			igniteEndTimestamp = 0.0;
			timeRemaining = 0f;
			foreach (ParticleSystem enableWhenLitParticle in enableWhenLitParticles)
			{
				enableWhenLitParticle.Stop();
			}
			if ((Object)(object)bubbles != (Object)null)
			{
				bubbles.__enabled = false;
			}
			AudioSource obj = audioSource;
			if (obj != null)
			{
				obj.Stop();
			}
		}

		private void HandleAddItemOffline(Item held, string itemName)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 rotation = default(Vector3);
			((Vector3)(ref rotation))..ctor(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f));
			int slotIndex = ChooseItemSlotIndex();
			HandleAddItemConfirmed(-1, itemName, slotIndex, rotation, 3f, held);
			if ((Object)(object)held != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)held).gameObject);
			}
		}

		private void HandleBrewOffline(Character interactor)
		{
			if (itemsStored.Count >= 2)
			{
				((MonoBehaviour)this).StartCoroutine(DunkItemCoroutine(0.2f));
				if (brewRoutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(brewRoutine);
				}
				brewRoutine = ((MonoBehaviour)this).StartCoroutine(SpawnPotionAfterDelay(GetViewId(interactor)));
			}
		}

		private void HandleAddItemConfirmed(int sourceItemViewId, string itemName, int slotIndex, Vector3 rotation, float scaleMultiplier, Item blueprint = null)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (itemsStored.Count >= 2)
			{
				Plugin.Log.LogWarning((object)"Cauldron storage full while handling item addition; ignoring duplicate request.");
				return;
			}
			itemsStored.Add(itemName);
			storedItems = itemsStored.Count;
			AttachStoredItemVisual(sourceItemViewId, slotIndex, rotation, scaleMultiplier, blueprint, itemName);
		}

		private void AttachStoredItemVisual(int sourceItemViewId, int slotIndex, Vector3 rotation, float scaleMultiplier, Item blueprint, string itemName)
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)itemsRoot == (Object)null)
			{
				return;
			}
			Transform val = itemsRoot;
			if (itemSlots.Count > 0)
			{
				slotIndex = Mathf.Clamp(slotIndex, 0, itemSlots.Count - 1);
				val = (((Object)(object)itemSlots[slotIndex] != (Object)null) ? itemSlots[slotIndex] : itemsRoot);
			}
			else if (itemsRoot.childCount > 0)
			{
				slotIndex = Mathf.Clamp(slotIndex, 0, itemsRoot.childCount - 1);
				val = itemsRoot.GetChild(slotIndex);
			}
			Item val2 = (((Object)(object)blueprint != (Object)null) ? blueprint : TryResolveItemFromViewId(sourceItemViewId));
			GameObject val4;
			if ((Object)(object)val2 != (Object)null)
			{
				Item val3 = Object.Instantiate<Item>(val2);
				val4 = ((Component)val3).gameObject;
				PrepareItemVisual(val3);
				if (!val4.activeSelf)
				{
					val4.SetActive(true);
				}
			}
			else
			{
				Plugin.Log.LogWarning((object)$"Unable to resolve source item view {sourceItemViewId}; spawning placeholder for {itemName}.");
				val4 = CreateFallbackVisual(val, itemName);
			}
			Transform transform = val4.transform;
			transform.SetParent(val, false);
			transform.localPosition = Vector3.zero;
			transform.localRotation = Quaternion.Euler(rotation);
			transform.localScale *= scaleMultiplier;
		}

		private Item TryResolveItemFromViewId(int viewId)
		{
			if (viewId <= 0)
			{
				return null;
			}
			PhotonView val = PhotonView.Find(viewId);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).GetComponent<Item>();
		}

		private void PrepareItemVisual(Item dupe)
		{
			if (!((Object)(object)dupe == (Object)null))
			{
				PhotonView component = ((Component)dupe).GetComponent<PhotonView>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				Rigidbody component2 = ((Component)dupe).GetComponent<Rigidbody>();
				if ((Object)(object)component2 != (Object)null)
				{
					Object.Destroy((Object)(object)component2);
				}
				ItemAction[] components = ((Component)dupe).GetComponents<ItemAction>();
				foreach (ItemAction val in components)
				{
					Object.Destroy((Object)(object)val);
				}
				ItemComponent[] components2 = ((Component)dupe).GetComponents<ItemComponent>();
				foreach (ItemComponent val2 in components2)
				{
					Object.Destroy((Object)(object)val2);
				}
				Collider[] componentsInChildren = ((Component)dupe).GetComponentsInChildren<Collider>();
				foreach (Collider val3 in componentsInChildren)
				{
					Object.Destroy((Object)(object)val3);
				}
			}
		}

		private GameObject CreateFallbackVisual(Transform parent, string itemName)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			GameObject val = new GameObject(string.IsNullOrWhiteSpace(itemName) ? "StoredItem" : ("StoredItem_" + itemName));
			val.transform.SetParent(parent, false);
			return val;
		}

		private void ClearStoredItemVisuals()
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			if ((Object)(object)itemsRoot == (Object)null)
			{
				return;
			}
			if (itemSlots.Count > 0)
			{
				foreach (Transform itemSlot in itemSlots)
				{
					if (!((Object)(object)itemSlot == (Object)null))
					{
						List<GameObject> list = new List<GameObject>();
						foreach (Transform item in itemSlot)
						{
							Transform val = item;
							list.Add(((Component)val).gameObject);
						}
						foreach (GameObject item2 in list)
						{
							Object.Destroy((Object)(object)item2);
						}
					}
				}
				return;
			}
			List<GameObject> list2 = new List<GameObject>();
			foreach (Transform item3 in itemsRoot)
			{
				Transform val2 = item3;
				list2.Add(((Component)val2).gameObject);
			}
			foreach (GameObject item4 in list2)
			{
				Object.Destroy((Object)(object)item4);
			}
		}

		private Character ResolveCharacter(int viewId)
		{
			if (viewId <= 0)
			{
				return null;
			}
			PhotonView val = PhotonView.Find(viewId);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).GetComponent<Character>();
		}

		[PunRPC]
		private void RPC_RequestIgnite(int interactorViewId, PhotonMessageInfo info)
		{
			if (HasNetworkAuthority && !ignited && !dead)
			{
				double num = (HasNetwork ? PhotonNetwork.Time : GetNetworkTime());
				double num2 = num + 180.0;
				ApplyIgnitedState(num2);
				if (HasNetwork)
				{
					photonView.RPC("RPC_HandleIgnited", (RpcTarget)1, new object[1] { num2 });
				}
			}
		}

		[PunRPC]
		private void RPC_HandleIgnited(double endTimestamp)
		{
			ApplyIgnitedState(endTimestamp);
		}

		[PunRPC]
		private void RPC_HandleFireExpired()
		{
			HandleFireExpired();
		}

		[PunRPC]
		private void RPC_RequestAddItem(int itemViewId, string itemName, PhotonMessageInfo info)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (!HasNetworkAuthority)
			{
				return;
			}
			if (itemsStored.Count >= 2)
			{
				photonView.RPC("RPC_AddItemRejected", info.Sender, new object[1] { itemViewId });
				return;
			}
			int num = ChooseItemSlotIndex();
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f));
			if (HasNetwork)
			{
				photonView.RPC("RPC_AddItemConfirmed", (RpcTarget)0, new object[7] { itemViewId, itemName, num, val.x, val.y, val.z, 3f });
				PhotonView val2 = PhotonView.Find(itemViewId);
				Player val3 = ((val2 != null) ? val2.Owner : null);
				if (val3 != null)
				{
					photonView.RPC("RPC_DestroyItemOnOwner", val3, new object[1] { itemViewId });
				}
				else if ((Object)(object)val2 != (Object)null)
				{
					RPC_DestroyItemOnOwner(itemViewId);
				}
			}
			else
			{
				HandleAddItemConfirmed(itemViewId, itemName, num, val, 3f);
				RPC_DestroyItemOnOwner(itemViewId);
			}
		}

		[PunRPC]
		private void RPC_AddItemConfirmed(int sourceItemViewId, string itemName, int slotIndex, float rotX, float rotY, float rotZ, float scaleMultiplier)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			HandleAddItemConfirmed(sourceItemViewId, itemName, slotIndex, new Vector3(rotX, rotY, rotZ), scaleMultiplier);
		}

		[PunRPC]
		private void RPC_AddItemRejected(int itemViewId)
		{
			PhotonView val = PhotonView.Find(itemViewId);
			if (!((Object)(object)val == (Object)null))
			{
				Item component = ((Component)val).GetComponent<Item>();
				if ((Object)(object)component != (Object)null)
				{
					Plugin.Log.LogWarning((object)("Add item request rejected; restoring item " + component.UIData.itemName + "."));
					((Component)component).gameObject.SetActive(true);
				}
			}
		}

		[PunRPC]
		private void RPC_DestroyItemOnOwner(int itemViewId)
		{
			PhotonView val = PhotonView.Find(itemViewId);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GameObject gameObject = ((Component)val).gameObject;
			if (!((Object)(object)gameObject == (Object)null))
			{
				if (HasNetwork)
				{
					PhotonNetwork.Destroy(gameObject);
				}
				else
				{
					Object.Destroy((Object)(object)gameObject);
				}
			}
		}

		[PunRPC]
		private void RPC_RequestBrew(int interactorViewId, PhotonMessageInfo info)
		{
			if (HasNetworkAuthority && itemsStored.Count >= 2)
			{
				if (HasNetwork)
				{
					photonView.RPC("RPC_DunkItems", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(DunkItemCoroutine(0.2f));
				}
				if (brewRoutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(brewRoutine);
				}
				brewRoutine = ((MonoBehaviour)this).StartCoroutine(SpawnPotionAfterDelay(interactorViewId));
			}
		}

		private IEnumerator SpawnPotionAfterDelay(int interactorViewId)
		{
			Plugin.Log.LogWarning((object)"Asking host to spawn potion...");
			yield return (object)new WaitForSeconds(0.7f);
			SpawnPotion(interactorViewId);
			Plugin.Log.LogWarning((object)"Asked!");
			brewRoutine = null;
		}

		private void SpawnPotion(int interactorViewId)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (itemsStored.Count < 2)
			{
				Plugin.Log.LogWarning((object)"Potion spawn requested without enough ingredients.");
				return;
			}
			Plugin.Log.LogWarning((object)"Got potion request...");
			Potion recipe = PotionAPI.GetRecipe(itemsStored[0], itemsStored[1]);
			Item val = PotionAPI.CreatePotion(recipe);
			((Component)val).transform.SetParent((Transform)null);
			((Component)val).transform.position = ((Component)this).transform.position + Vector3.up * 2f;
			Character val2 = ResolveCharacter(interactorViewId);
			if ((Object)(object)val2 != (Object)null)
			{
				val.Interact(val2);
			}
			else if (interactorViewId > 0)
			{
				Plugin.Log.LogWarning((object)$"Failed to resolve interactor view {interactorViewId} for potion delivery.");
			}
			if (HasNetwork)
			{
				photonView.RPC("RPC_ResetStoredItems", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				RPC_ResetStoredItems();
			}
			Plugin.Log.LogWarning((object)"Spawned potion!");
		}

		[PunRPC]
		private void RPC_ResetStoredItems()
		{
			ClearStoredItemVisuals();
			itemsStored.Clear();
			storedItems = 0;
		}

		public void CancelCast(Character interactor)
		{
		}

		public void ReleaseInteract(Character interactor)
		{
		}

		[PunRPC]
		private void RPC_DunkItems()
		{
			((MonoBehaviour)this).StartCoroutine(DunkItemCoroutine(0.2f));
		}

		private IEnumerator DunkItemCoroutine(float amnt)
		{
			Plugin.Log.LogWarning((object)"Dunking item...");
			float i = 0f;
			while (i < 1f)
			{
				yield return (object)new WaitForEndOfFrame();
				i += Time.deltaTime;
				Transform obj = itemsRoot;
				obj.position -= Vector3.up * (Time.deltaTime * amnt);
				Transform obj2 = itemsRoot;
				obj2.localScale -= Vector3.one * (Time.deltaTime * amnt * 0.01f);
			}
			if (!(amnt > 0f))
			{
				Plugin.Log.LogWarning((object)"Resetting cauldron visuals.");
				ClearStoredItemVisuals();
			}
			else
			{
				ClearStoredItemVisuals();
				Plugin.Log.LogWarning((object)"Despawning items");
				((MonoBehaviour)this).StartCoroutine(DunkItemCoroutine(0f - amnt));
			}
		}
	}
	public class CauldronSpawner
	{
		public ManualLogSource log;

		private const float Liftup = 5f;

		private const float Radius = 2f;

		private const float NudgeUp = 0.62f;

		public void BindToScene()
		{
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				if (!PhotonNetwork.IsMasterClient || (!((Scene)(ref scene)).name.StartsWith("Level_") && !((Scene)(ref scene)).name.Contains("WilIsland")))
				{
					return;
				}
				log.LogInfo((object)"Started spawning cauldrons...");
				IReadOnlyList<GameObject> readOnlyList = GameObjectFinder.FindByName("Campfire", includeInactive: false);
				foreach (GameObject item in readOnlyList)
				{
					CreateCauldronForCampfire(item);
					log.LogInfo((object)"Spawning Cauldron");
				}
				foreach (GameObject item2 in GameObjectFinder.FindByName("Campfire-Kiln"))
				{
					CreateCauldronForCampfire(item2);
					log.LogInfo((object)"Spawning Cauldron");
				}
			};
		}

		private static Quaternion FromHitNormal(RaycastHit hit, Vector3 upHint)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return FromNormal(((RaycastHit)(ref hit)).normal, upHint);
		}

		private static Quaternion FromNormal(Vector3 normal, Vector3 upHint)
		{
			//IL_0017: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0077: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			normal = ((((Vector3)(ref normal)).sqrMagnitude > 0f) ? ((Vector3)(ref normal)).normalized : Vector3.forward);
			Vector3 val = ((((Vector3)(ref upHint)).sqrMagnitude > 0f) ? ((Vector3)(ref upHint)).normalized : Vector3.up);
			if (!(Mathf.Abs(Vector3.Dot(normal, val)) > 0.999f))
			{
				return Quaternion.LookRotation(normal, val);
			}
			Vector3 val2 = ((Mathf.Abs(normal.x) < 0.9f) ? Vector3.right : Vector3.forward);
			Vector3 val3 = Vector3.Cross(normal, val2);
			val = ((Vector3)(ref val3)).normalized;
			return Quaternion.LookRotation(normal, val);
		}

		private void CreateCauldronForCampfire(GameObject campfire)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			Transform transform = campfire.transform;
			Campfire component = campfire.GetComponent<Campfire>();
			if (!((Object)(object)component == (Object)null))
			{
				Vector3 val = transform.position + Vector3.up * 5f;
				float num = Random.Range(0f, 360f) * (MathF.PI / 180f);
				Vector3 val2 = val + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 2f;
				RaycastHit hit = default(RaycastHit);
				if (Physics.Raycast(val2, Vector3.down, ref hit, float.PositiveInfinity))
				{
					Quaternion val3 = FromHitNormal(hit, Vector3.up);
					GameObject val4 = NetworkPrefabManager.SpawnNetworkPrefab(Plugin.cauldronId, ((RaycastHit)(ref hit)).point + Vector3.up * 0.62f, val3, (byte)0, (object[])null);
				}
				else
				{
					log.LogInfo((object)"AAAAAAA SOMEONE HELP ME IM DYING PLEASE I BEG YOU\nokay but actually what the fuck even happened");
				}
			}
		}
	}
	public static class GameObjectFinder
	{
		public static IReadOnlyList<GameObject> FindByName(string name, bool includeInactive = true)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>(64);
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).IsValid() && ((Scene)(ref activeScene)).isLoaded)
			{
				FindByName(activeScene, name, includeInactive, list);
			}
			return list;
		}

		public static IReadOnlyList<GameObject> FindByNameAllLoadedScenes(string name, bool includeInactive = true)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>(128);
			int sceneCount = SceneManager.sceneCount;
			for (int i = 0; i < sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).IsValid() && ((Scene)(ref sceneAt)).isLoaded)
				{
					FindByName(sceneAt, name, includeInactive, list);
				}
			}
			return list;
		}

		public static IReadOnlyList<GameObject> FindByName(Scene scene, string name, bool includeInactive = true)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>(64);
			FindByName(scene, name, includeInactive, list);
			return list;
		}

		private static void FindByName(Scene scene, string name, bool includeInactive, List<GameObject> results)
		{
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			for (int i = 0; i < rootGameObjects.Length; i++)
			{
				Collect(rootGameObjects[i].transform, name, includeInactive, results);
			}
		}

		private static void Collect(Transform t, string name, bool includeInactive, List<GameObject> results)
		{
			GameObject gameObject = ((Component)t).gameObject;
			if (includeInactive || gameObject.activeInHierarchy)
			{
				if (((Object)gameObject).name == name)
				{
					results.Add(gameObject);
				}
				int childCount = t.childCount;
				for (int i = 0; i < childCount; i++)
				{
					Collect(t.GetChild(i), name, includeInactive, results);
				}
			}
		}
	}
	internal class SpawnRequest
	{
		public string Obj;

		public Vector3 Pos;

		public Quaternion Rot;

		public SpawnRequest(string objectName, Vector3 position, Quaternion rotation)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			Obj = objectName;
			Pos = position;
			Rot = rotation;
		}
	}
	internal sealed class ObjectSpawnerInterface : MonoBehaviour, IOnEventCallback
	{
		public static ObjectSpawnerInterface singleton;

		private const byte EvSpawnRequest = 51;

		private const byte EvSpawnResponse = 52;

		private readonly Dictionary<int, Action<PhotonView>> _callbacks = new Dictionary<int, Action<PhotonView>>();

		private void Awake()
		{
			if ((Object)(object)singleton != (Object)null && (Object)(object)singleton != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			singleton = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		private void OnEnable()
		{
			PhotonNetwork.AddCallbackTarget((object)this);
		}

		private void OnDisable()
		{
			PhotonNetwork.RemoveCallbackTarget((object)this);
		}

		public void SpawnObject(SpawnRequest request, Action<PhotonView> callback)
		{
			//IL_011e: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_012f: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.InRoom)
			{
				throw new InvalidOperationException("Not in a Photon room.");
			}
			if (string.IsNullOrWhiteSpace(request.Obj))
			{
				throw new ArgumentException("Prefab path required.", "request");
			}
			int num = GenerateRequestId();
			_callbacks[num] = callback;
			if (PhotonNetwork.IsMasterClient)
			{
				PhotonView pv = DoMasterSpawn(request.Obj, request.Pos, request.Rot);
				TryInvoke(num, pv);
				return;
			}
			object[] array = new object[10]
			{
				request.Obj,
				request.Pos.x,
				request.Pos.y,
				request.Pos.z,
				request.Rot.x,
				request.Rot.y,
				request.Rot.z,
				request.Rot.w,
				num,
				PhotonNetwork.LocalPlayer.ActorNumber
			};
			RaiseEventOptions val = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)2
			};
			PhotonNetwork.RaiseEvent((byte)51, (object)array, val, SendOptions.SendReliable);
		}

		public void SpawnAndInvokeRPC(string prefabPath, Vector3 position, Quaternion rotation, string rpcMethodName, RpcTarget target = 3, params object[] rpcParams)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			string rpcMethodName2 = rpcMethodName;
			object[] rpcParams2 = rpcParams;
			SpawnObject(new SpawnRequest(prefabPath, position, rotation), delegate(PhotonView pv)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)pv))
				{
					pv.RPC(rpcMethodName2, target, rpcParams2 ?? Array.Empty<object>());
				}
			});
		}

		public void OnEvent(EventData photonEvent)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00e6: Expected O, but got Unknown
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (photonEvent.Code == 51)
			{
				if (PhotonNetwork.IsMasterClient && photonEvent.CustomData is object[] array && array.Length >= 10)
				{
					string text = array[0] as string;
					if (!string.IsNullOrEmpty(text))
					{
						float num = (float)array[1];
						float num2 = (float)array[2];
						float num3 = (float)array[3];
						float num4 = (float)array[4];
						float num5 = (float)array[5];
						float num6 = (float)array[6];
						float num7 = (float)array[7];
						int num8 = (int)array[8];
						int num9 = (int)array[9];
						Vector3 pos = default(Vector3);
						((Vector3)(ref pos))..ctor(num, num2, num3);
						Quaternion rot = default(Quaternion);
						((Quaternion)(ref rot))..ctor(num4, num5, num6, num7);
						PhotonView val = DoMasterSpawn(text, pos, rot);
						object[] array2 = new object[2] { val.ViewID, num8 };
						RaiseEventOptions val2 = new RaiseEventOptions();
						val2.TargetActors = new int[1] { num9 };
						RaiseEventOptions val3 = val2;
						PhotonNetwork.RaiseEvent((byte)52, (object)array2, val3, SendOptions.SendReliable);
					}
				}
			}
			else if (photonEvent.Code == 52 && photonEvent.CustomData is object[] array3 && array3.Length >= 2)
			{
				int num10 = (int)array3[0];
				int requestId = (int)array3[1];
				PhotonView pv = PhotonView.Find(num10);
				TryInvoke(requestId, pv);
			}
		}

		private PhotonView DoMasterSpawn(string objectName, Vector3 pos, Quaternion rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PhotonNetwork.Instantiate(objectName, pos, rot, (byte)0, (object[])null);
			PhotonView component = val.GetComponent<PhotonView>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				throw new InvalidOperationException("Spawned prefab '" + objectName + "' has no PhotonView on root.");
			}
			return component;
		}

		private void TryInvoke(int requestId, PhotonView pv)
		{
			if (_callbacks.TryGetValue(requestId, out Action<PhotonView> value))
			{
				_callbacks.Remove(requestId);
				value?.Invoke(pv);
			}
		}

		private int GenerateRequestId()
		{
			int num;
			do
			{
				num = Random.Range(int.MinValue, int.MaxValue);
			}
			while (_callbacks.ContainsKey(num));
			return num;
		}

		public static void EnsureSingleton()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)singleton) || !Object.op_Implicit((Object)(object)((Component)singleton).gameObject))
			{
				GameObject val = new GameObject("ObjectSpawnerInterface");
				val.AddComponent<ObjectSpawnerInterface>();
			}
		}
	}
	[BepInPlugin("com.khakixd.potions", "Potions", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static CauldronSpawner _spawner;

		internal static ModDefinition modDefinition;

		internal static string cauldronId = "cauldron_campfire";

		internal static GameObject voidTile;

		internal static SFX_Instance FireStarted;

		public const string Id = "com.khakixd.potions";

		internal static ManualLogSource Log { get; private set; } = null;


		public static string Name => "Potions";

		public static string Version => "1.1.0";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			Harmony val = new Harmony("com.khakixd.potions");
			val.PatchAll();
			modDefinition = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info);
			BuiltinPotions.CreatePotions();
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			_spawner = new CauldronSpawner
			{
				log = Log
			};
			_spawner.BindToScene();
			GameObject val2 = new GameObject("ObjSpawner");
			val2.AddComponent<PhotonView>();
			val2.AddComponent<ObjectSpawnerInterface>();
			NetworkPrefabManager.RegisterNetworkPrefab("PotionsObjectSpawner", val2);
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode _mode)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				if ((!(((Scene)(ref scene)).name != "Airport") || !(((Scene)(ref scene)).name != "Wilisland") || ((Scene)(ref scene)).name.StartsWith("Level_")) && PhotonNetwork.IsMasterClient)
				{
					PhotonNetwork.Instantiate("PotionsObjectSpawner", Vector3.zero, Quaternion.identity, (byte)0, (object[])null);
				}
			};
			BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "potions.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Expected O, but got Unknown
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Expected O, but got Unknown
				GameObject val3 = peakBundle.LoadAsset<GameObject>("CauldronPrefab");
				FireStarted = peakBundle.LoadAsset<SFX_Instance>("SFXIIgnite");
				val3.AddComponent<PhotonView>();
				val3.AddComponent<Cauldron>();
				foreach (Transform item in val3.transform)
				{
					Transform val4 = item;
					PatchMaterialShader(((Component)val4).gameObject);
				}
				PatchMaterialShader(val3);
				Transform val5 = val3.transform.Find("Cylinder").Find("ReferenceBubble");
				PatchMaterialShader(((Component)val5).gameObject);
				foreach (Transform item2 in val3.transform.Find("EnableWhenLit"))
				{
					Transform val6 = item2;
					ParticleUnfucker.ReplaceParticleMaterial(((Component)val6).gameObject, ((Object)((Component)val6).gameObject).name);
				}
				NetworkPrefabManager.RegisterNetworkPrefab(cauldronId, val3);
				Bubbles bubbles = ((Component)val5.parent.Find("Bubbles")).gameObject.AddComponent<Bubbles>();
				((Behaviour)bubbles).enabled = false;
				bubbles.__enabled = false;
				bubbles.referenceBubble = val5;
				UnityItemContent basePotion = peakBundle.LoadAsset<UnityItemContent>("GenericPotion");
				PotionAPI.CreatePotionRegisterables(basePotion, peakBundle.Mod);
				peakBundle.Mod.RegisterContent();
				voidTile = peakBundle.LoadAsset<GameObject>("VoidTile");
				PatchMaterialShader(voidTile, "W/Peak_Rock");
				foreach (Transform item3 in voidTile.transform)
				{
					Transform val7 = item3;
					PatchMaterialShader(((Component)val7).gameObject, "W/Peak_Rock");
				}
				GameObject val8 = peakBundle.LoadAsset<GameObject>("RubberFuck");
				PatchMaterialShader(((Component)val8.transform.Find("default")).gameObject, "W/Character");
				((Object)val8).name = "Rubberducky";
				val8.AddComponent<PhotonView>();
				val8.AddComponent<Biodegradable>();
				NetworkPrefabManager.RegisterNetworkPrefab("Rubberducky", val8);
				LocalizedText.mainTable["NAME_CANDY"] = new List<string>(1) { "CANDY" };
			});
		}

		private static void PatchMaterialShader(GameObject toPatch, string shaderId = "W/Peak_Standard")
		{
			MeshRenderer component = toPatch.GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).sharedMaterial.shader = Shader.Find(shaderId);
			}
		}
	}
	public class StringItemData : DataEntryValue
	{
		public string Value;

		public override void SerializeValue(BinarySerializer serializer)
		{
			serializer.WriteString(Value, Encoding.ASCII);
		}

		public override void DeserializeValue(BinaryDeserializer deserializer)
		{
			Value = deserializer.ReadString(Encoding.ASCII);
		}

		public override string ToString()
		{
			return Value;
		}
	}
	public class VoidMaze
	{
		private enum Direction
		{
			North,
			East,
			South,
			West
		}

		private class Cell
		{
			public readonly Transform?[] Walls = (Transform?[])(object)new Transform[4];

			public bool Visited;
		}

		private struct Neighbor
		{
			public Vector2Int Position;

			public Direction Direction;
		}

		private const string RootNamePrefix = "VoidMaze";

		private readonly Cell[,] _cells;

		private readonly Vector2Int _gridSize;

		private readonly float _tileSize;

		private readonly Random _random;

		private readonly List<Neighbor> _neighborBuffer = new List<Neighbor>(4);

		private bool _destroyed;

		private static readonly Vector2Int[] DirectionVectors = (Vector2Int[])(object)new Vector2Int[4]
		{
			new Vector2Int(0, 1),
			new Vector2Int(1, 0),
			new Vector2Int(0, -1),
			new Vector2Int(-1, 0)
		};

		private static readonly Direction[] OppositeDirections = new Direction[4]
		{
			Direction.South,
			Direction.West,
			Direction.North,
			Direction.East
		};

		public GameObject Root { get; }

		public Vector3 StartPosition { get; }

		public Vector3 GoalPosition { get; }

		public VoidMaze(Vector3 origin, int gridX, int gridY, float tileSize, int? seed = null, Transform? parent = null)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_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)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Plugin.voidTile == (Object)null)
			{
				throw new InvalidOperationException("Cannot build a VoidMaze before Plugin.voidTile is initialized.");
			}
			if (gridX <= 0)
			{
				throw new ArgumentOutOfRangeException("gridX", gridX, "Grid X must be greater than zero.");
			}
			if (gridY <= 0)
			{
				throw new ArgumentOutOfRangeException("gridY", gridY, "Grid Y must be greater than zero.");
			}
			if (tileSize <= 0f)
			{
				throw new ArgumentOutOfRangeException("tileSize", tileSize, "Tile size must be greater than zero.");
			}
			_gridSize = new Vector2Int(gridX, gridY);
			_tileSize = tileSize;
			_random = (seed.HasValue ? new Random(seed.Value) : new Random());
			_cells = new Cell[((Vector2Int)(ref _gridSize)).x, ((Vector2Int)(ref _gridSize)).y];
			Root = new GameObject(string.Format("{0}_{1}x{2}", "VoidMaze", gridX, gridY));
			if ((Object)(object)parent != (Object)null)
			{
				Root.transform.SetParent(parent, false);
			}
			Root.transform.position = origin;
			Root.transform.rotation = Quaternion.identity;
			Root.transform.localScale = Vector3.one;
			PopulateTiles();
			GenerateMaze();
			StartPosition = Root.transform.TransformPoint(Vector3.zero);
			GoalPosition = Root.transform.TransformPoint(new Vector3((float)(((Vector2Int)(ref _gridSize)).x - 1) * _tileSize, 0f, (float)(((Vector2Int)(ref _gridSize)).y - 1) * _tileSize));
		}

		public void DestroyMaze(bool immediate = false)
		{
			if (_destroyed)
			{
				return;
			}
			_destroyed = true;
			if (!((Object)(object)Root == (Object)null))
			{
				if (Application.isPlaying && !immediate)
				{
					Object.Destroy((Object)(object)Root);
				}
				else
				{
					Object.DestroyImmediate((Object)(object)Root);
				}
			}
		}

		private void PopulateTiles()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			while (true)
			{
				int num2 = num;
				Vector2Int gridSize = _gridSize;
				if (num2 >= ((Vector2Int)(ref gridSize)).x)
				{
					break;
				}
				int num3 = 0;
				while (true)
				{
					int num4 = num3;
					gridSize = _gridSize;
					if (num4 >= ((Vector2Int)(ref gridSize)).y)
					{
						break;
					}
					Cell cell = new Cell();
					GameObject val = Object.Instantiate<GameObject>(Plugin.voidTile, Root.transform);
					((Object)val).name = $"VoidTile_{num}_{num3}";
					Transform transform = val.transform;
					transform.localRotation = Quaternion.identity;
					transform.localScale = new Vector3(_tileSize, 1f, _tileSize);
					transform.localPosition = new Vector3((float)num * _tileSize, 0f, (float)num3 * _tileSize);
					CacheWall(transform, cell, Direction.North, "North");
					CacheWall(transform, cell, Direction.East, "East");
					CacheWall(transform, cell, Direction.South, "South");
					CacheWall(transform, cell, Direction.West, "West");
					_cells[num, num3] = cell;
					num3++;
				}
				num++;
			}
		}

		private static void CacheWall(Transform root, Cell cell, Direction dir, string baseName)
		{
			Transform val = FindChild(root, baseName);
			if ((Object)(object)val == (Object)null)
			{
				val = FindChild(root, baseName + "Wall");
			}
			if ((Object)(object)val == (Object)null)
			{
				val = FindChild(root, "Wall_" + baseName);
			}
			cell.Walls[(int)dir] = val;
		}

		private static Transform? FindChild(Transform parent, string name)
		{
			if (((Object)parent).name.Equals(name, StringComparison.Ordinal))
			{
				return parent;
			}
			for (int i = 0; i < parent.childCount; i++)
			{
				Transform child = parent.GetChild(i);
				Transform val = FindChild(child, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private void GenerateMaze()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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)
			Vector2Int zero = Vector2Int.zero;
			Vector2Int gridSize = _gridSize;
			int x = ((Vector2Int)(ref gridSize)).x;
			gridSize = _gridSize;
			Stack<Vector2Int> stack = new Stack<Vector2Int>(x * ((Vector2Int)(ref gridSize)).y);
			_cells[((Vector2Int)(ref zero)).x, ((Vector2Int)(ref zero)).y].Visited = true;
			stack.Push(zero);
			while (stack.Count > 0)
			{
				Vector2Int val = stack.Peek();
				List<Neighbor> unvisitedNeighbors = GetUnvisitedNeighbors(val);
				if (unvisitedNeighbors.Count == 0)
				{
					stack.Pop();
					continue;
				}
				Shuffle(unvisitedNeighbors);
				Neighbor neighbor = unvisitedNeighbors[0];
				RemoveWallBetween(val, neighbor.Position, neighbor.Direction);
				Vector2Int position = neighbor.Position;
				_cells[((Vector2Int)(ref position)).x, ((Vector2Int)(ref position)).y].Visited = true;
				stack.Push(position);
			}
		}

		private List<Neighbor> GetUnvisitedNeighbors(Vector2Int cell)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			_neighborBuffer.Clear();
			for (int i = 0; i < 4; i++)
			{
				Direction direction = (Direction)i;
				Vector2Int position = cell + DirectionVectors[i];
				if (((Vector2Int)(ref position)).x < 0)
				{
					continue;
				}
				int x = ((Vector2Int)(ref position)).x;
				Vector2Int gridSize = _gridSize;
				if (x < ((Vector2Int)(ref gridSize)).x && ((Vector2Int)(ref position)).y >= 0)
				{
					int y = ((Vector2Int)(ref position)).y;
					gridSize = _gridSize;
					if (y < ((Vector2Int)(ref gridSize)).y && !_cells[((Vector2Int)(ref position)).x, ((Vector2Int)(ref position)).y].Visited)
					{
						_neighborBuffer.Add(new Neighbor
						{
							Position = position,
							Direction = direction
						});
					}
				}
			}
			return _neighborBuffer;
		}

		private void RemoveWallBetween(Vector2Int current, Vector2Int next, Direction dirFromCurrentToNext)
		{
			Cell cell = _cells[((Vector2Int)(ref current)).x, ((Vector2Int)(ref current)).y];
			Cell cell2 = _cells[((Vector2Int)(ref next)).x, ((Vector2Int)(ref next)).y];
			DisableWall(cell, dirFromCurrentToNext);
			DisableWall(cell2, OppositeDirections[(int)dirFromCurrentToNext]);
		}

		private static void DisableWall(Cell cell, Direction direction)
		{
			Transform val = cell.Walls[(int)direction];
			if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
			{
				((Component)val).gameObject.SetActive(false);
			}
		}

		private void Shuffle(List<Neighbor> list)
		{
			for (int num = list.Count - 1; num > 0; num--)
			{
				int index = _random.Next(num + 1);
				Neighbor value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
		}
	}
}
namespace Potions.PotionEffects
{
	public class AntimatterCurse : PotionEffect
	{
		private const int MapX = 12;

		private const int MapY = 12;

		private const int TileSize = 10;

		public override void Drink(Character character, Item item)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			VoidMaze voidMaze = new VoidMaze(character.Center, 12, 12, 10f);
			GameObject.Find("Map").SetActive(false);
			((MonoBehaviourPun)character).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2]
			{
				voidMaze.StartPosition + Vector3.up * 5f,
				true
			});
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			((Component)instance.sphere).gameObject.SetActive(false);
		}

		public override void Apply(Item item)
		{
		}
	}
	public class AntimatterExplosion : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			ObjectSpawnerInterface.singleton.SpawnObject(new SpawnRequest("0_items/Dynamite", character.Center, Quaternion.identity), delegate(PhotonView view)
			{
				view.RPC("RPC_Explode", (RpcTarget)0, Array.Empty<object>());
			});
		}

		public override void Apply(Item item)
		{
		}
	}
	public class ClearAfflictions : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (Affliction affliction in character.refs.afflictions.afflictionList)
				{
					try
					{
						character.refs.afflictions.RemoveAffliction(affliction.GetAfflictionType());
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
		}

		public override void Apply(Item item)
		{
		}
	}
	public class Die : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			((MonoBehaviour)character).Invoke("DieInstantly", 0.02f);
		}

		public override void Apply(Item item)
		{
		}
	}
	public class Ducky : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			//IL_000f: 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)
			for (int i = 0; i < Random.Range(10, 20); i++)
			{
				ObjectSpawnerInterface.singleton.SpawnObject(new SpawnRequest("Rubberducky", character.Center, Quaternion.identity), delegate(PhotonView view)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					((Component)view).GetComponent<Rigidbody>().AddForce(Random.insideUnitSphere * (float)Random.Range(15, 50), (ForceMode)1);
				});
			}
			character.DieInstantlyWithoutSkeleton();
		}

		public override void Apply(Item item)
		{
		}
	}
	public class ForceQuitTheGameLmfao : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			character.SeekEmployment();
		}

		public override void Apply(Item item)
		{
		}
	}
	public class IncreasedSpeed : PotionEffect
	{
		private float len;

		public IncreasedSpeed(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_FasterBoi affliction = new Affliction_FasterBoi
			{
				drowsyOnEnd = 0f,
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class InfiniteStamina : PotionEffect
	{
		private float len;

		public InfiniteStamina(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyInfiniteStamina val = ((Component)item).gameObject.AddComponent<Action_ApplyInfiniteStamina>();
			((ItemAction)val).OnCastFinished = true;
			val.drowsyAmount = 0f;
			val.buffTime = len;
		}
	}
	public class KillRandomMf : PotionEffect
	{
		public override void Drink(Character character, Item _item)
		{
			Character character2 = character;
			List<Character> list = Character.AllCharacters.Where((Character allCharacter) => !allCharacter.data.dead && !allCharacter.data.fullyPassedOut && (Object)(object)allCharacter != (Object)(object)character2).ToList();
			foreach (Character item in list)
			{
				((MonoBehaviour)item).Invoke("DieInstantly", 0.02f);
			}
		}

		public override void Apply(Item item)
		{
		}
	}
	public class Levitation : PotionEffect
	{
		private float len;

		public Levitation(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Levitation affliction = new Affliction_Levitation
			{
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class Lifesteal : PotionEffect
	{
		private float len;

		public Lifesteal(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Lifesteal affliction = new Affliction_Lifesteal
			{
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class Potion_MoraleBoost : PotionEffect
	{
		public override void Drink(Character character, Item item)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			MoraleBoost.SpawnMoraleBoost(character.Center, 3000f, 255f, 255f, true, 1);
		}

		public override void Apply(Item item)
		{
		}
	}
	public class Numbness : PotionEffect
	{
		private float len;

		public Numbness(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Numbness affliction = new Affliction_Numbness
			{
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class Pinata : PotionEffect
	{
		private float len;

		public Pinata(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Pinata affliction = new Affliction_Pinata
			{
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class Poisoned : PotionEffect
	{
		private float dmg;

		public Poisoned(float damage)
		{
			dmg = damage;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_InflictPoison val = ((Component)item).gameObject.AddComponent<Action_InflictPoison>();
			((ItemAction)val).OnCastFinished = true;
			val.delay = 10f;
			val.inflictionTime = 40f;
			val.poisonPerSecond = dmg / 40f / 100f;
		}
	}
	public class Rebirth : PotionEffect
	{
		private float len;

		public Rebirth(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Rebirth affliction = new Affliction_Rebirth
			{
				totalTime = len
			};
			val.affliction = (Affliction)(object)affliction;
		}
	}
	public class RemoveStatus : PotionEffect
	{
		[CompilerGenerated]
		private float <amount>P;

		[CompilerGenerated]
		private STATUSTYPE <statustype>P;

		public RemoveStatus(float amount, STATUSTYPE statustype)
		{
			//IL_0008: 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)
			<amount>P = amount;
			<statustype>P = statustype;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			character.refs.afflictions.SubtractStatus(<statustype>P, <amount>P, false, false);
		}

		public override void Apply(Item item)
		{
		}
	}
	public class ReviveTheHomies : PotionEffect
	{
		public override void Drink(Character character, Item _item)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = Character.AllCharacters.Where((Character allCharacter) => allCharacter.data.dead || allCharacter.data.fullyPassedOut).ToList();
			foreach (Character item in list)
			{
				((MonoBehaviourPun)item).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
				{
					character.Center + Vector3.up * 3f,
					false
				});
			}
		}

		public override void Apply(Item item)
		{
		}
	}
	public class SpawnPrefab : PotionEffect
	{
		[CompilerGenerated]
		private string <prefab>P;

		[CompilerGenerated]
		private bool <separate>P;

		[CompilerGenerated]
		private int <amount>P;

		public SpawnPrefab(string prefab, bool separate, int amount = 1)
		{
			<prefab>P = prefab;
			<separate>P = separate;
			<amount>P = amount;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_002d: 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)
			for (int i = 0; i < <amount>P; i++)
			{
				Vector3 val = character.Center;
				if (<separate>P)
				{
					val += new Vector3((float)Random.Range(-35, 35), 0f, (float)Random.Range(-35, 35));
				}
				ObjectSpawnerInterface.singleton.SpawnObject(new SpawnRequest(<prefab>P, val, Quaternion.identity), delegate
				{
				});
			}
		}

		public override void Apply(Item item)
		{
		}
	}
	public class Temperate : PotionEffect
	{
		private float len;

		public Temperate(float length)
		{
			len = length;
			base..ctor();
		}

		public override void Drink(Character character, Item item)
		{
		}

		public override void Apply(Item item)
		{
			Action_ApplyAffliction val = ((Component)item).gameObject.AddComponent<Action_ApplyAffliction>();
			((ItemAction)val).OnCastFinished = true;
			Affliction_Temperate affliction = new Affliction_Temperate(0.1f, len);
			val.affliction = (Affliction)(object)affliction;
		}
	}
}
namespace Potions.Patches
{
	public static class AddStatusToMePatch
	{
		[RequireComponent(typeof(PhotonView))]
		public sealed class StatusAdderHelper : MonoBehaviourPun
		{
			public void AddStatus(STATUSTYPE statusType, float amount)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) && ((MonoBehaviourPun)this).photonView.Owner != null)
				{
					((MonoBehaviourPun)this).photonView.RPC("RPCA_AddToStatusOverNetwork", ((MonoBehaviourPun)this).photonView.Owner, new object[2] { statusType, amount });
				}
			}

			[PunRPC]
			public void RPCA_AddToStatusOverNetwork(STATUSTYPE statusType, float amount)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				CharacterAfflictions component = ((Component)this).GetComponent<CharacterAfflictions>();
				if (!((Object)(object)component == (Object)null) && PhotonNetwork.LocalPlayer != null && (Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.Owner == PhotonNetwork.LocalPlayer)
				{
					component.AddStatus(statusType, amount, false, true);
				}
			}
		}

		public static void AddStatusToThisMyselfOverRPCOkayGotIt(this Character self, STATUSTYPE statusType, float amount)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			StatusAdderHelper statusAdderHelper = ((Component)self).GetComponent<StatusAdderHelper>();
			if ((Object)(object)statusAdderHelper == (Object)null)
			{
				statusAdderHelper = ((Component)self).gameObject.AddComponent<StatusAdderHelper>();
			}
			statusAdderHelper.AddStatus(statusType, amount);
		}
	}
	[HarmonyPatch(typeof(Character), "Awake")]
	internal static class EnsureStatusAdderHelperPatch
	{
		private static void Postfix(Character __instance)
		{
			AddStatusToMePatch.StatusAdderHelper statusAdderHelper = default(AddStatusToMePatch.StatusAdderHelper);
			if (!((Component)__instance).TryGetComponent<AddStatusToMePatch.StatusAdderHelper>(ref statusAdderHelper))
			{
				((Component)__instance).gameObject.AddComponent<AddStatusToMePatch.StatusAdderHelper>();
			}
		}
	}
	[HarmonyPatch(typeof(Affliction), "CreateBlankAffliction")]
	public class CreateBlankAfflictionPatch
	{
		private static bool Prefix(AfflictionType afflictionType, ref Affliction __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			switch ((int)afflictionType)
			{
			case 418:
				__result = (Affliction)(object)new Affliction_Temperate();
				return false;
			case 419:
				__result = (Affliction)(object)new Affliction_Numbness();
				return false;
			case 420:
				__result = (Affliction)(object)new Affliction_Lifesteal();
				return false;
			case 421:
				__result = (Affliction)(object)new Affliction_Levitation();
				return false;
			case 422:
				__result = (Affliction)(object)new Affliction_Rebirth();
				return false;
			case 423:
				__result = (Affliction)(object)new Affliction_Pinata();
				return false;
			default:
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(Character), "HandlePassedOut")]
	public class CharacterPatch
	{
		private static bool Prefix(Character __instance)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			Affliction val = default(Affliction);
			if (!(__instance.data.deathTimer > 0.9f) || !__instance.refs.afflictions.HasAfflictionType((AfflictionType)422, ref val))
			{
				return true;
			}
			__instance.view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
			{
				__instance.Center + Vector3.up * 5f,
				false
			});
			return false;
		}
	}
	public static class CharacterNoSkeletonPatch
	{
		private static readonly HashSet<int> SkipNextSkeleton = new HashSet<int>();

		public static void DieInstantlyWithoutSkeleton(this Character self)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)self == (Object)null))
			{
				PhotonView component = ((Component)self).GetComponent<PhotonView>();
				if (!((Object)(object)component == (Object)null))
				{
					SkipNextSkeleton.Add(component.ViewID);
					component.RPC("RPCA_Die", (RpcTarget)0, new object[1] { self.Center });
				}
			}
		}

		private static bool ConsumeSkip(Character c)
		{
			if ((Object)(object)c == (Object)null)
			{
				return false;
			}
			PhotonView component = ((Component)c).GetComponent<PhotonView>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			return SkipNextSkeleton.Remove(component.ViewID);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Skelleton), "SpawnSkelly", new Type[] { typeof(Character) })]
		private static bool Skelly_SpawnSkelly_Prefix(Skelleton __instance, Character c)
		{
			if (!ConsumeSkip(c))
			{
				return true;
			}
			if ((Object)(object)__instance != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
			return false;
		}
	}
	[HarmonyPatch]
	public class PinataDeath
	{
		private static readonly AfflictionType AffType = (AfflictionType)423;

		private static MethodBase TargetMethod()
		{
			Type typeFromHandle = typeof(Character);
			return AccessTools.Method(typeFromHandle, "RPCA_Die", new Type[1] { typeof(Vector3) }, (Type[])null);
		}

		private static void Prefix(Character __instance, Vector3 itemSpawnPoint)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"bro died lmfao");
			Affliction val = default(Affliction);
			if (!__instance.IsLocal || !__instance.refs.afflictions.HasAfflictionType(AffType, ref val))
			{
				return;
			}
			Debug.Log((object)"Spawning in Candy");
			ObjectSpawnerInterface.singleton.SpawnObject(new SpawnRequest("0_items/Lollipop", __instance.Center, Quaternion.identity), delegate(PhotonView view)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((Component)view).GetComponent<Rigidbody>().AddForce(Random.insideUnitSphere * (float)Random.Range(15, 50), (ForceMode)1);
			});
			for (int i = 0; i < 4; i++)
			{
				ObjectSpawnerInterface.singleton.SpawnObject(new SpawnRequest("0_Items/com.khakixd.potions:Candy", __instance.Center, Quaternion.identity), delegate(PhotonView view)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					((Component)view).GetComponent<Rigidbody>().AddForce(Random.insideUnitSphere * (float)Random.Range(15, 50), (ForceMode)1);
				});
			}
		}
	}
	public static class SeekEmploymentExtensions
	{
		public static void SeekEmployment(this Character character)
		{
			GameObject gameObject = ((Component)character).gameObject;
			SeekEmploymentBehaviour seekEmploymentBehaviour = gameObject.GetComponent<SeekEmploymentBehaviour>();
			if ((Object)(object)seekEmploymentBehaviour == (Object)null)
			{
				seekEmploymentBehaviour = gameObject.AddComponent<SeekEmploymentBehaviour>();
			}
			seekEmploymentBehaviour.InvokeSeekEmployment();
		}
	}
	public sealed class SeekEmploymentBehaviour : MonoBehaviourPun
	{
		public void InvokeSeekEmployment()
		{
			((MonoBehaviourPun)this).photonView.RPC("RPCA_SeekEmployment", (RpcTarget)0, Array.Empty<object>());
		}

		[PunRPC]
		private void RPCA_SeekEmployment()
		{
			Application.OpenURL("https://www.linkedin.com/");
			Application.Quit();
		}
	}
}
namespace Potions.Juicing
{
	internal class Bubbles : MonoBehaviour
	{
		private const int BUBBLES_PER_SECOND = 10;

		private const float BUBBLE_GROW_TIME = 0.4f;

		private const float BUBBLE_IDLE_TIME = 0.5f;

		private const float BUBBLE_POP_TIME = 0.08f;

		private const float POP_SCALE_MULTIPLIER = 1.4f;

		private float currentBubbles;

		private AudioSource boilingSfx;

		public Transform referenceBubble;

		public bool __enabled = true;

		private void Awake()
		{
			boilingSfx = ((Component)this).GetComponent<AudioSource>();
			boilingSfx.Play();
		}

		private void Update()
		{
			boilingSfx.volume = currentBubbles / 10f * 0.5f;
			float num = Time.deltaTime * currentBubbles;
			if (Random.Range(0f, 1f) < num)
			{
				((MonoBehaviour)this).StartCoroutine(Bubble());
			}
			int num2 = 10;
			if (!__enabled)
			{
				num2 = 0;
			}
			currentBubbles = Mathf.Lerp(currentBubbles, (float)num2, Time.deltaTime / 13f);
		}

		private IEnumerator Bubble()
		{
			Transform bubble = Object.Instantiate<Transform>(referenceBubble);
			Vector2 val = Random.insideUnitCircle * 0.4f;
			Vector3 val2 = ((Component)this).transform.right * val.x + ((Component)this).transform.up * val.y;
			Vector3 position = ((Component)this).transform.position + val2;
			float num = Random.Range(0.8f, 1.2f);
			Vector3 goalScale = referenceBubble.lossyScale * num;
			float rotationSpeed = Random.Range(-180f, 180f);
			bubble.localScale = Vector3.zero;
			bubble.position = position;
			float t3 = 0f;
			while (t3 < 0.4f)
			{
				yield return null;
				t3 += Time.deltaTime;
				float num2 = t3 / 0.4f;
				float num3 = 1f - Mathf.Pow(1f - num2, 3f);
				float num4 = ((num2 < 0.8f) ? num3 : (num3 * (1f + Mathf.Sin((num2 - 0.8f) * MathF.PI * 5f) * 0.1f)));
				bubble.localScale = Vector3.Lerp(Vector3.zero, goalScale, num4);
				float num5 = Mathf.Sin(num2 * MathF.PI * 4f) * 0.15f * (1f - num2);
				bubble.localScale += new Vector3(num5 * goalScale.x, (0f - num5) * goalScale.y, num5 * goalScale.z);
			}
			bubble.localScale = goalScale;
			t3 = 0f;
			while (t3 < 0.5f)
			{
				yield return null;
				t3 += Time.deltaTime;
				float num6 = t3 / 0.5f;
				bubble.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
				float num7 = 1f + Mathf.Sin(num6 * MathF.PI * 6f) * 0.05f;
				bubble.localScale = goalScale * num7;
			}
			t3 = 0f;
			Vector3 popScale = goalScale * 1.4f;
			while (t3 < 0.08f)
			{
				yield return null;
				t3 += Time.deltaTime;
				float num8 = t3 / 0.08f;
				float num9 = 1f - Mathf.Pow(1f - num8, 2f);
				bubble.localScale = Vector3.Lerp(goalScale, popScale, num9);
			}
			Object.Destroy((Object)(object)((Component)bubble).gameObject);
		}
	}
	internal static class ParticleUnfucker
	{
		internal static void ReplaceParticleMaterial(GameObject targetObject, string shaderName = "SmokeParticleSimple")
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if ((Object)(object)targetObject == (Object)null || string.IsNullOrEmpty(shaderName))
			{
				Debug.LogWarning((object)"wtf");
				return;
			}
			Shader shader = Shader.Find(shaderName);
			ParticleSystemRenderer[] componentsInChildren = targetObject.GetComponentsInChildren<ParticleSystemRenderer>();
			ParticleSystemRenderer[] array = componentsInChildren;
			foreach (ParticleSystemRenderer val in array)
			{
				if ((Object)(object)((Renderer)val).sharedMaterial != (Object)null)
				{
					Material val2 = new Material(((Renderer)val).sharedMaterial);
					val2.shader = shader;
					((Renderer)val).material = val2;
				}
			}
		}
	}
}
namespace Potions.CustomAfflictions
{
	public class Affliction_Antimatter
	{
	}
	public sealed class Affliction_Levitation : Affliction
	{
		private int stacking;

		public override void UpdateEffect()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (!base.character.IsLocal)
			{
				return;
			}
			for (int i = 0; i < base.character.refs.ragdoll.partList.Count; i++)
			{
				if (!base.character.data.isGrounded)
				{
					base.character.refs.ragdoll.partList[i].Gravity(base.character.refs.movement.GetGravityForce() * base.character.data.currentRagdollControll * (-2.5f * (float)stacking));
				}
			}
		}

		public override void OnApplied()
		{
		}

		public override void OnRemoved()
		{
		}

		public override void Stack(Affliction incomingAffliction)
		{
			if (incomingAffliction is Affliction_Levitation)
			{
				base.totalTime += incomingAffliction.totalTime;
				stacking++;
			}
		}

		public override AfflictionType GetAfflictionType()
		{
			return (AfflictionType)CustomAfflictionHelper.WhatIsMyNumber(3);
		}

		public override void Serialize(BinarySerializer serializer)
		{
			serializer.WriteFloat(base.totalTime);
			serializer.WriteInt(stacking);
		}

		public override void Deserialize(BinaryDeserializer serializer)
		{
			base.totalTime = serializer.ReadFloat();
			stacking = serializer.ReadInt();
		}
	}
	public sealed class Affliction_Lifesteal : Affliction
	{
		private const float DISTANCE = 15f;

		private const float SPEED = 0.02f;

		public override void UpdateEffect()
		{
			//IL_00dd: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			if (!base.character.IsLocal)
			{
				return;
			}
			CharacterRefs refs = base.character.refs;
			CharacterAfflictions val = refs?.afflictions;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			float num = 0.02f * Time.deltaTime;
			if (num <= 0f)
			{
				return;
			}
			float num2 = 0f;
			bool flag = false;
			float maxDistanceSqr = 225f;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)base.character || allCharacter.IsLocal)
				{
					continue;
				}
				CharacterData data = allCharacter.data;
				if ((Object)(object)data == (Object)null || data.dead || data.fullyPassedOut)
				{
					continue;
				}
				Vector3 val2 = allCharacter.Center - base.character.Center;
				if (((Vector3)(ref val2)).sqrMagnitude > maxDistanceSqr)
				{
					continue;
				}
				CharacterRefs refs2 = allCharacter.refs;
				if ((Object)(object)refs2?.afflictions == (Object)null)
				{
					continue;
				}
				CharacterCustomization customization = refs2.customization;
				if ((double)val.GetCurrentStatus((STATUSTYPE)0) > 0.02)
				{
					allCharacter.AddStatusToThisMyselfOverRPCOkayGotIt((STATUSTYPE)0, num);
					if (customization != null)
					{
						customization.PulseStatus(Color.black, 1f);
					}
					num2 += num;
				}
				flag = true;
			}
			foreach (MushroomZombie item in from <>h__TransparentIdentifier0 in ZombieManager._instance.zombies.Select((MushroomZombie zombie) => new
				{
					zombie = zombie,
					dist = zombie.character.Center - base.character.Center
				}).Where(<>h__TransparentIdentifier0 =>
				{
					//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)
					Vector3 dist = <>h__TransparentIdentifier0.dist;
					return !(((Vector3)(ref dist)).sqrMagnitude > maxDistanceSqr);
				})
				where (int)<>h__TransparentIdentifier0.zombie.currentState != 6
				select <>h__TransparentIdentifier0.zombie)
			{
				item.lifetime -= Time.deltaTime * 3f;
				flag = true;
				num2 += num;
				item.character.refs.customization.PulseStatus(Color.black, 1f);
				if (item.lifetime - (Time.time - item.timeAwoke) <= 0f)
				{
					item.Die();
				}
			}
			if (!flag)
			{
				return;
			}
			if (num2 > 0f)
			{
				val.SubtractStatus((STATUSTYPE)0, num2, false, false);
			}
			if (refs != null)
			{
				CharacterCustomization customization2 = refs.customization;
				if (customization2 != null)
				{
					customization2.PulseStatus(new Color(0.1f, 1f, 0.1f), 1f);
				}
			}
		}

		public override void OnApplied()
		{
		}

		public override void OnRemoved()
		{
		}

		public override void Stack(Affliction incomingAffliction)
		{
			if (incomingAffliction is Affliction_Lifesteal)
			{
				base.totalTime += incomingAffliction.totalTime;
			}
		}

		public override AfflictionType GetAfflictionType()
		{
			return (AfflictionType)CustomAfflictionHelper.WhatIsMyNumber(2);
		}

		public override void Serialize(BinarySerializer serializer)
		{
			serializer.WriteFloat(base.totalTime);
		}

		public override void Deserialize(BinaryDeserializer serializer)
		{
			base.totalTime = serializer.ReadFloat();
		}
	}
	public sealed class Affliction_Numbness : Affliction
	{
		private float buildup;

		public override void UpdateEffect()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (base.character.IsLocal)
			{
				float currentStatus = base.character.refs.afflictions.GetCurrentStatus((STATUSTYPE)0);
				base.character.refs.afflictions.SubtractStatus((STATUSTYPE)0, currentStatus, false, false);
				buildup += currentStatus;
			}
			base.character.refs.customization.PulseStatus(new Color(0.7f, 0.2f, 0.2f), 1f);
		}

		public override void OnApplied()
		{
		}

		public override void OnRemoved()
		{
			base.character.refs.afflictions.AddStatus((STATUSTYPE)0, buildup, false, true);
		}

		public override void Stack(Affliction incomingAffliction)
		{
			if (incomingAffliction is Affliction_Numbness)
			{
				base.totalTime += incomingAffliction.totalTime;
			}
		}

		public override Af