Decompiled source of shrooms v1.4.0

shrooms.dll

Decompiled 3 weeks ago
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
using UnityEngine.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("socketparams")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("socketparams")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3B95EEF7-4A97-4393-91A0-3626434F3631")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace tripping
{
	[BepInPlugin("1010101110.shrooms", "shrooms", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Mod : BaseUnityPlugin
	{
		public static readonly Harmony harmony = new Harmony(typeof(Mod).GetCustomAttributes(typeof(BepInPlugin), inherit: false).Cast<BepInPlugin>().First()
			.GUID);

		private void Awake()
		{
			harmony.PatchAll();
			PrefabManager.OnVanillaPrefabsAvailable += AddShrooms;
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}

		private void AddShrooms()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0094: 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)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b0: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00e6: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Expected O, but got Unknown
			AssetBundle val = AssetUtils.LoadAssetBundleFromResources("mushroom", typeof(Mod).Assembly);
			ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomBlack"), false, new ItemConfig
			{
				Enabled = false
			}));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_black"), false));
			ItemManager instance = ItemManager.Instance;
			GameObject obj = val.LoadAsset<GameObject>("MushroomPink");
			ItemConfig val2 = new ItemConfig();
			val2.Amount = 2;
			val2.CraftingStation = "piece_cauldron";
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig
				{
					Item = "MushroomYellow",
					Amount = 2
				},
				new RequirementConfig
				{
					Item = "Raspberry",
					Amount = 4
				},
				new RequirementConfig
				{
					Item = "GreydwarfEye",
					Amount = 4
				}
			};
			instance.AddItem(new CustomItem(obj, false, val2));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_pink"), false));
			ItemManager instance2 = ItemManager.Instance;
			GameObject obj2 = val.LoadAsset<GameObject>("MushroomBlood");
			val2 = new ItemConfig();
			val2.Amount = 2;
			val2.CraftingStation = "piece_cauldron";
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "MushroomBlack",
					Amount = 2
				},
				new RequirementConfig
				{
					Item = "Bloodbag",
					Amount = 4
				}
			};
			instance2.AddItem(new CustomItem(obj2, false, val2));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_blood"), false));
			ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomGreen"), false, new ItemConfig
			{
				Enabled = false
			}));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_green"), false));
			ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomPurple"), false, new ItemConfig
			{
				Enabled = false
			}));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_purple"), false));
			ItemManager instance3 = ItemManager.Instance;
			GameObject obj3 = val.LoadAsset<GameObject>("MushroomRainbow");
			val2 = new ItemConfig();
			val2.Amount = 2;
			val2.CraftingStation = "piece_cauldron";
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig
				{
					Item = "MushroomBlack",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "MushroomGreen",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "MushroomBlue",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "MushroomPurple",
					Amount = 1
				}
			};
			instance3.AddItem(new CustomItem(obj3, false, val2));
			PrefabManager.Instance.AddPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_rainbow"));
		}
	}
}
namespace tripping.Patches
{
	public class TrippingPatches
	{
		[HarmonyPatch(typeof(Player), "FixedUpdate")]
		private class playerposty
		{
			private static void Postfix(ref Player __instance)
			{
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Expected O, but got Unknown
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0563: Unknown result type (might be due to invalid IL or missing references)
				//IL_0568: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_050f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0514: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0683: Unknown result type (might be due to invalid IL or missing references)
				//IL_0688: Unknown result type (might be due to invalid IL or missing references)
				if (!((Character)__instance).m_nview.IsValid() || !((Character)__instance).m_nview.IsOwner() || __instance.GetPlayerID() != Player.m_localPlayer.GetPlayerID())
				{
					return;
				}
				StatusEffect statusEffect = ((Character)__instance).m_seman.GetStatusEffect(StringExtensionMethods.GetStableHashCode("se_alcohol"));
				bool flag = false;
				bool flag2 = false;
				bool flag3 = false;
				bool flag4 = false;
				bool flag5 = false;
				bool flag6 = false;
				foreach (Food food in Player.m_localPlayer.m_foods)
				{
					if (food.m_name == "MushroomBlue")
					{
						flag = true;
					}
					if (food.m_name == "MushroomBlack")
					{
						flag2 = true;
						blacktimer += Time.deltaTime;
						if (blacktimer > 0.5f)
						{
							HitData val = new HitData();
							val.m_point = ((Character)__instance).GetCenterPoint();
							val.m_damage.m_spirit = 1f;
							((Character)__instance).ApplyDamage(val, true, false, (DamageModifier)0);
							blacktimer = 0f;
						}
					}
					if (food.m_name == "MushroomBlood")
					{
						flag3 = true;
					}
					if (food.m_name == "MushroomRainbow")
					{
						flag4 = true;
					}
					if (food.m_name == "MushroomPurple")
					{
						flag5 = true;
					}
					if (food.m_name == "MushroomGreen")
					{
						flag6 = true;
					}
				}
				if (flag6 || (((Humanoid)Player.m_localPlayer).m_utilityItem != null && ((Humanoid)Player.m_localPlayer).m_utilityItem.m_shared.m_name.Contains("wishbone")))
				{
					((Character)Player.m_localPlayer).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"), false, 0, 0f);
				}
				else
				{
					((Character)Player.m_localPlayer).m_seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"), false);
				}
				if (flag5 && Time.frameCount % 200 == 0)
				{
					int num = Random.Range(1, 200);
					GameObject val2 = null;
					switch (num)
					{
					case 100:
						val2 = PrefabManager.Instance.GetPrefab("sfx_ghost_alert");
						break;
					case 99:
						val2 = PrefabManager.Instance.GetPrefab("sfx_haldor_laugh");
						break;
					case 98:
						val2 = PrefabManager.Instance.GetPrefab("sfx_land_water");
						break;
					case 97:
						val2 = PrefabManager.Instance.GetPrefab("sfx_offering");
						break;
					case 96:
						val2 = PrefabManager.Instance.GetPrefab("sfx_secretfound");
						break;
					case 95:
						val2 = PrefabManager.Instance.GetPrefab("sfx_tree_fall");
						break;
					case 94:
						val2 = PrefabManager.Instance.GetPrefab("sfx_wraith_idle");
						break;
					case 93:
						val2 = PrefabManager.Instance.GetPrefab("sfx_coins_pile_destroyed");
						break;
					case 92:
						val2 = PrefabManager.Instance.GetPrefab("sfx_eikthyr_idle");
						break;
					case 91:
						val2 = PrefabManager.Instance.GetPrefab("sfx_gui_craftitem_cauldron");
						break;
					case 90:
						val2 = PrefabManager.Instance.GetPrefab("sfx_lootspawn");
						break;
					case 89:
						((Humanoid)Player.m_localPlayer).UnequipAllItems();
						break;
					}
					if (Object.op_Implicit((Object)(object)val2))
					{
						ZLog.LogError((object)("purple sound " + ((Object)val2).name));
						Object.Instantiate<GameObject>(val2, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 2f + Vector3.up, Quaternion.identity);
					}
				}
				PostProcessingBehaviour component = ((Component)GameCamera.instance).gameObject.GetComponent<PostProcessingBehaviour>();
				if (!((Object)(object)component != (Object)null))
				{
					return;
				}
				if (flag4)
				{
					((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true;
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(2f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f);
					rainbowtimer += Time.deltaTime;
					if (rainbowtimer > rainbowchangeevery)
					{
						rainbowcurrent = (rainbowcurrent + 1) % rainbowcolors.Length;
						rainbownext = (rainbowcurrent + 1) % rainbowcolors.Length;
						rainbowtimer = 0f;
					}
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = Color.Lerp(rainbowcolors[rainbowcurrent], rainbowcolors[rainbownext], rainbowtimer / rainbowchangeevery);
				}
				else if (flag3)
				{
					((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true;
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(5f, 0f, 0f, 1f);
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(1f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f);
				}
				else if (flag2)
				{
					((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true;
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(0f, 0f, 0f, 1f);
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(0.8f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f);
				}
				else if (flag)
				{
					((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true;
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(0f, 0f, 2f, 1f);
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(0.2f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f);
				}
				else if (((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity > 0.05f)
				{
					((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Max(0.05f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity - 0.001f);
				}
				else
				{
					((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = false;
				}
				if (flag || flag2 || flag3 || flag4 || flag5)
				{
					((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity = Mathf.Min(20f, ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity + 0.5f);
				}
				else if ((Object)(object)statusEffect != (Object)null)
				{
					((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity += 0.003f;
				}
				else if (((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity > 0.14f)
				{
					((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity = Mathf.Max(0.14f, ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity - 0.01f);
				}
				if (flag || flag4)
				{
					if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 2f)
					{
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Min(2f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation + 0.05f);
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true;
					}
				}
				else if (flag2 || flag6)
				{
					if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 0.2f)
					{
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = 0.2f;
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true;
					}
				}
				else if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 1f)
				{
					if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation < 1f)
					{
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Min(1f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation + 0.01f);
					}
					else
					{
						((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Max(1f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation - 0.01f);
					}
					((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true;
				}
			}
		}

		[HarmonyPatch(typeof(Pickable), "Awake")]
		private class pickableposty
		{
			private static void Postfix(ref Pickable __instance)
			{
				((MonoBehaviour)__instance).StartCoroutine(CheckPinkMushroom(__instance));
			}
		}

		[HarmonyPatch(typeof(Pickable), "SetPicked")]
		private class pickablepostpick
		{
			private static void Postfix(bool picked, ref Pickable __instance)
			{
				if (!picked)
				{
					return;
				}
				GameObject gameObject = ((Component)((Component)__instance).transform).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					Transform val = gameObject.transform.Find("pinkfloaters");
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject))
					{
						Object.Destroy((Object)(object)((Component)val).gameObject);
					}
				}
			}
		}

		private static Color[] rainbowcolors = (Color[])(object)new Color[8]
		{
			new Color(5f, 0f, 0f, 1f),
			new Color(5f, 2f, 0f, 1f),
			new Color(5f, 5f, 0f, 1f),
			new Color(0f, 5f, 0f, 1f),
			new Color(0f, 3f, 2f, 1f),
			new Color(0f, 0f, 5f, 1f),
			new Color(3f, 0f, 5f, 1f),
			new Color(4f, 0f, 2f, 1f)
		};

		private static int rainbowcurrent = 0;

		private static int rainbownext = 1;

		private static float rainbowtimer = 0f;

		private static float rainbowchangeevery = 0.5f;

		private static float blacktimer = 0f;

		public static IEnumerator CheckPinkMushroom(Pickable __instance)
		{
			while (true)
			{
				if (__instance.m_nview.IsValid() && (Object)(object)Player.m_localPlayer != (Object)null && ((Character)Player.m_localPlayer).m_nview.IsValid())
				{
					bool pinkshroom = false;
					foreach (Food food in Player.m_localPlayer.m_foods)
					{
						if (food.m_name == "MushroomPink")
						{
							pinkshroom = true;
						}
					}
					if (!__instance.m_picked && pinkshroom)
					{
						GameObject parento2 = ((Component)((Component)__instance).transform).gameObject;
						if ((Object)(object)parento2 != (Object)null)
						{
							bool found = false;
							Transform floaterstransform2 = parento2.transform.Find("pinkfloaters");
							if (Object.op_Implicit((Object)(object)floaterstransform2) && Object.op_Implicit((Object)(object)((Component)floaterstransform2).gameObject))
							{
								found = true;
							}
							if (!found)
							{
								GameObject pinkprefab = PrefabManager.Instance.GetPrefab("MushroomPink");
								if (Object.op_Implicit((Object)(object)pinkprefab))
								{
									Transform pinkfloaterstransform = pinkprefab.transform.Find("attach/floaters");
									if (Object.op_Implicit((Object)(object)pinkfloaterstransform) && Object.op_Implicit((Object)(object)((Component)pinkfloaterstransform).gameObject))
									{
										GameObject pinkfloaters = Object.Instantiate<GameObject>(((Component)pinkfloaterstransform).gameObject, parento2.transform);
										((Object)pinkfloaters).name = "pinkfloaters";
										pinkfloaters.transform.localScale = new Vector3(2f, 2f, 2f);
									}
									else
									{
										Logger.LogError((object)"failed to find MushroomPink floaters");
									}
								}
								else
								{
									Logger.LogError((object)"failed to find MushroomPink");
								}
							}
						}
					}
					else
					{
						GameObject parento = ((Component)((Component)__instance).transform).gameObject;
						if ((Object)(object)parento != (Object)null)
						{
							Transform floaterstransform = parento.transform.Find("pinkfloaters");
							if (Object.op_Implicit((Object)(object)floaterstransform) && Object.op_Implicit((Object)(object)((Component)floaterstransform).gameObject))
							{
								Object.Destroy((Object)(object)((Component)floaterstransform).gameObject);
							}
						}
					}
				}
				yield return (object)new WaitForSeconds(Random.Range(10f, 20f));
			}
		}
	}
}