Decompiled source of CanadianCuisine v2.1.0

plugins/com.github.MiiMii1205.CanadianCuisine.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CanadianCuisine.Behaviours;
using CanadianCuisine.Behaviours.Afflictions;
using CanadianCuisine.Behaviours.CookingBehaviours;
using CanadianCuisine.Data;
using CanadianCuisine.Patchers;
using HarmonyLib;
using Md.ItemCooking;
using Md.Peak.Afflictions.Affliction;
using Microsoft.CodeAnalysis;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using PEAKLib.Core;
using Peak;
using Peak.Afflictions;
using Photon.Pun;
using UnityEngine;
using Zorro.Core;
using Zorro.Core.Serizalization;
using pworld.Scripts.Extensions;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Md.ItemCooking
{
	internal static class UpdateCookedBehavior
	{
		public delegate void PrefixSignature(ItemCooking self);

		public delegate void PostfixSignature(ItemCooking self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(ItemCooking);
			MethodInfo method = typeFromHandle.GetMethod("UpdateCookedBehavior", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("ItemCooking", "UpdateCookedBehavior");
			}
			return method;
		}
	}
	internal static class get_timesCookedLocal
	{
	}
	internal static class set_timesCookedLocal
	{
	}
	internal static class get_canBeCooked
	{
	}
	internal static class get_hasExplosion
	{
	}
	internal static class OnInstanceDataSet
	{
	}
	internal static class RunAdditionalCookingBehaviors
	{
	}
	internal static class CookVisually
	{
	}
	internal static class GetCookColor
	{
	}
	internal static class FinishCookingRPC
	{
	}
	internal static class StartCookingVisuals
	{
	}
	internal static class EnableCookingSmokeRPC
	{
	}
	internal static class Wreck
	{
	}
	internal static class ChangeStatsCooked
	{
	}
	internal static class CancelCookingVisuals
	{
	}
	internal static class FinishCooking
	{
	}
	internal static class Explode
	{
	}
	internal static class RPC_CookingExplode
	{
	}
	internal static class _ctor
	{
	}
	internal static class _cctor
	{
	}
	internal static class __c
	{
		internal static class _ctor
		{
		}
	}
}
namespace Md.Peak.Afflictions.Affliction
{
	internal static class Tick
	{
		public delegate void PrefixSignature(Affliction self);

		public delegate void PostfixSignature(Affliction self, ref bool returnValue);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(Affliction);
			MethodInfo method = typeFromHandle.GetMethod("Tick", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("Peak.Afflictions.Affliction", "Tick");
			}
			return method;
		}
	}
	internal static class CreateBlankAffliction
	{
		public delegate void PrefixSignature(ref AfflictionType afflictionType);

		public delegate void PostfixSignature(ref AfflictionType afflictionType, ref Affliction returnValue);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(Affliction);
			MethodInfo method = typeFromHandle.GetMethod("CreateBlankAffliction", (BindingFlags)(-1), null, new Type[1] { typeof(AfflictionType) }, null);
			if ((object)method == null)
			{
				throw new MissingMethodException("Peak.Afflictions.Affliction", "CreateBlankAffliction");
			}
			return method;
		}
	}
	internal static class _ctor
	{
	}
	internal static class _ctor_System_Single
	{
	}
	internal static class OnApplied
	{
	}
	internal static class OnRemoved
	{
	}
	internal static class RemoveStack
	{
	}
	internal static class OnStacked
	{
	}
	internal static class get_worksOnBot
	{
	}
	internal static class UpdateEffect
	{
	}
	internal static class UpdateEffectNetworked
	{
	}
	internal static class Copy
	{
	}
	internal static class AfflictionType
	{
		internal static class _ctor
		{
		}
	}
}
namespace MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();

		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets
	{
		public Type? TargetType { get; } = targetType;

		public bool IncludeNestedTypes { get; set; } = true;

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }
	}
}
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 CanadianCuisine
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.github.MiiMii1205.CanadianCuisine", "CanadianCuisine", "2.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static readonly DateTime December1St = new DateTime((DateTime.Now.Month == 1) ? (DateTime.Now.Year - 1) : DateTime.Now.Year, 12, 1);

		private static readonly DateTime January6St = new DateTime(((DateTime.Now.Month == 1) ? (DateTime.Now.Year - 1) : DateTime.Now.Year) + 1, 1, 6);

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

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

		public static GameObject HighJumpEffectPrefab { get; private set; } = null;

		public static bool IsHoliday { get; private set; } = false;

		public static string Name => "CanadianCuisine";

		public static string Version => "2.1.0";

		private void FixColorblindMaterials(GameObject go)
		{
			ColorblindVariant componentInChildren = go.GetComponentInChildren<ColorblindVariant>();
			Shader val = Shader.Find(((Object)componentInChildren.colorblindMaterial.shader).name);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogWarning((object)(": Shader " + ((Object)componentInChildren.colorblindMaterial.shader).name + " was not found."));
			}
			else
			{
				componentInChildren.colorblindMaterial.shader = val;
			}
		}

		private void OnDestroy()
		{
			DefaultMonoDetourManager.Instance.Dispose();
			Harmony.UnpatchID("com.github.MiiMii1205.CanadianCuisine");
			Log.LogInfo((object)("Plugin " + Name + " unloaded!"));
		}

		private void Awake()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			AddLocalizedTextCsv();
			Log.LogInfo((object)("Plugin " + Name + " is loading..."));
			DateTime now = DateTime.Now;
			if (now > December1St && now < January6St)
			{
				IsHoliday = true;
				Log.LogInfo((object)$"Happy Holidays! The holiday season will end in {January6St - now:%d} days");
			}
			else
			{
				IsHoliday = false;
				Log.LogInfo((object)$"Next holiday season will start in {December1St - now:%d} days.");
			}
			BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "canadiansnacks.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
			{
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Expected O, but got Unknown
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Expected O, but got Unknown
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Expected O, but got Unknown
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Expected O, but got Unknown
				//IL_0275: Unknown result type (might be due to invalid IL or missing references)
				//IL_027c: Expected O, but got Unknown
				//IL_0319: Unknown result type (might be due to invalid IL or missing references)
				//IL_031e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_0339: Expected O, but got Unknown
				//IL_039e: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a5: Expected O, but got Unknown
				//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cd: Expected O, but got Unknown
				//IL_0489: Unknown result type (might be due to invalid IL or missing references)
				//IL_048e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0494: Unknown result type (might be due to invalid IL or missing references)
				//IL_049e: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f6: Expected O, but got Unknown
				//IL_0501: Unknown result type (might be due to invalid IL or missing references)
				//IL_0506: Unknown result type (might be due to invalid IL or missing references)
				//IL_0511: Unknown result type (might be due to invalid IL or missing references)
				//IL_0516: Unknown result type (might be due to invalid IL or missing references)
				//IL_0517: Unknown result type (might be due to invalid IL or missing references)
				//IL_051a: Unknown result type (might be due to invalid IL or missing references)
				//IL_051b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0520: Unknown result type (might be due to invalid IL or missing references)
				//IL_0526: Unknown result type (might be due to invalid IL or missing references)
				//IL_0530: Expected O, but got Unknown
				//IL_0531: Unknown result type (might be due to invalid IL or missing references)
				//IL_0536: Unknown result type (might be due to invalid IL or missing references)
				//IL_0537: Unknown result type (might be due to invalid IL or missing references)
				//IL_053a: Unknown result type (might be due to invalid IL or missing references)
				//IL_053b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0540: Unknown result type (might be due to invalid IL or missing references)
				//IL_0546: Unknown result type (might be due to invalid IL or missing references)
				//IL_0550: Expected O, but got Unknown
				//IL_0557: Unknown result type (might be due to invalid IL or missing references)
				//IL_055a: Unknown result type (might be due to invalid IL or missing references)
				//IL_055b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0709: Unknown result type (might be due to invalid IL or missing references)
				//IL_0710: Expected O, but got Unknown
				GameObject val = peakBundle.LoadAsset<GameObject>("HostCuttings.prefab");
				ItemOptimizer orAddComponent = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val);
				orAddComponent.item = val.GetComponent<Item>();
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val);
				ItemCooking val2 = val.AddComponent<ItemCooking>();
				((ItemComponent)val2).item = orAddComponent.item;
				((ItemComponent)val2).item.overrideJetpackFuel = true;
				((ItemComponent)val2).item.overrideJetpackFuelAmount = 10;
				((ItemComponent)val2).item.overrideJetpackFuelPerUse = 20;
				((ItemComponent)val2).item.overrideJetpackFuelPerFuelMult = 1f;
				val2.ignoreDefaultCookBehavior = true;
				AdditionalCookingBehavior[] obj = new AdditionalCookingBehavior[7]
				{
					new CookingBehaviourChangeFeedbackSfx
					{
						cookedAmountToTrigger = 1,
						soundEffectNameToChangeTo = "SFXI Heal Hunger Stamina"
					},
					default(AdditionalCookingBehavior),
					default(AdditionalCookingBehavior),
					default(AdditionalCookingBehavior),
					default(AdditionalCookingBehavior),
					default(AdditionalCookingBehavior),
					default(AdditionalCookingBehavior)
				};
				CookingBehavior_EnableScripts val3 = new CookingBehavior_EnableScripts();
				((AdditionalCookingBehavior)val3).cookedAmountToTrigger = 1;
				val3.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val.GetComponent<Action_GiveExtraStamina>() };
				obj[1] = (AdditionalCookingBehavior)val3;
				obj[2] = new CookingBehaviourChangeFeedbackSfx
				{
					cookedAmountToTrigger = 3,
					soundEffectNameToChangeTo = "SFXI Heal Fortified Milk"
				};
				val3 = new CookingBehavior_EnableScripts();
				((AdditionalCookingBehavior)val3).cookedAmountToTrigger = 3;
				val3.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val.GetComponent<Action_ApplyAffliction>() };
				obj[3] = (AdditionalCookingBehavior)val3;
				val3 = new CookingBehavior_EnableScripts();
				((AdditionalCookingBehavior)val3).cookedAmountToTrigger = 3;
				val3.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val.GetComponent<Action_GiveExtraStamina>() };
				obj[4] = (AdditionalCookingBehavior)val3;
				obj[5] = new CookingBehaviourChangeFeedbackSfx
				{
					cookedAmountToTrigger = 4,
					soundEffectNameToChangeTo = "SFXI Heal Hunger Normal"
				};
				CookingBehavior_DisableScripts val4 = new CookingBehavior_DisableScripts();
				((AdditionalCookingBehavior)val4).cookedAmountToTrigger = 4;
				val4.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[2]
				{
					(MonoBehaviour)val.GetComponent<Action_GiveExtraStamina>(),
					(MonoBehaviour)val.GetComponent<Action_ApplyAffliction>()
				};
				obj[6] = (AdditionalCookingBehavior)val4;
				val2.additionalCookingBehaviors = (AdditionalCookingBehavior[])(object)obj;
				val.AddComponent<CookingHungerController>();
				GameObject val5 = peakBundle.LoadAsset<GameObject>("PapinoCookies.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val5);
				ItemOptimizer orAddComponent2 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val5);
				orAddComponent2.item = val5.GetComponent<Item>();
				orAddComponent2.item.overrideJetpackFuel = true;
				orAddComponent2.item.overrideJetpackFuelAmount = 10;
				orAddComponent2.item.overrideJetpackFuelPerUse = 20;
				orAddComponent2.item.overrideJetpackFuelPerFuelMult = 1f;
				Action_ApplyAffliction val6 = val5.AddComponent<Action_ApplyAffliction>();
				((ItemActionBase)val6).item = orAddComponent2.item;
				((ItemAction)val6).OnCastFinished = true;
				AfflictionWithConsequence affliction = new AfflictionWithConsequence
				{
					mainAffliction = (Affliction?)new Affliction_LowGravity
					{
						totalTime = 12f,
						warning = true,
						lowGravAmount = 3
					},
					delay = 1f,
					consequentAffliction = (Affliction?)(object)new AfflictionParalyzed
					{
						totalTime = 4f
					}
				};
				val6.affliction = (Affliction)(object)affliction;
				val5.AddComponent<CookingHungerController>();
				ItemCooking orAddComponent3 = ExtGameObject.GetOrAddComponent<ItemCooking>(val5);
				AdditionalCookingBehavior[] additionalCookingBehaviors = orAddComponent3.additionalCookingBehaviors;
				val4 = new CookingBehavior_DisableScripts();
				val4.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val6 };
				((AdditionalCookingBehavior)val4).cookedAmountToTrigger = 1;
				orAddComponent3.additionalCookingBehaviors = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(additionalCookingBehaviors, (AdditionalCookingBehavior)(object)val4);
				GameObject val7 = peakBundle.LoadAsset<GameObject>("SugarFudge.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val7);
				ItemOptimizer orAddComponent4 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val7);
				orAddComponent4.item = val7.GetComponent<Item>();
				val7.AddComponent<CookingHungerController>();
				ItemCooking orAddComponent5 = ExtGameObject.GetOrAddComponent<ItemCooking>(val7);
				Action_ApplyAffliction val8 = val7.AddComponent<Action_ApplyAffliction>();
				((ItemAction)val8).OnCastFinished = true;
				val8.affliction = (Affliction)(object)new AfflictionWithConsequence
				{
					mainAffliction = (Affliction?)(object)new AfflictionHighJump
					{
						totalTime = 12f,
						highJumpMultiplier = 6f
					},
					consequentAffliction = (Affliction?)new Affliction_AdjustDrowsyOverTime
					{
						totalTime = 10f,
						statusPerSecond = 0.0333f
					}
				};
				((ItemActionBase)val8).item = orAddComponent4.item;
				Action_ApplyAffliction val9 = val7.AddComponent<Action_ApplyAffliction>();
				((ItemActionBase)val9).item = orAddComponent4.item;
				((ItemAction)val9).OnCastFinished = true;
				val9.affliction = (Affliction)(object)new AfflictionHighJump
				{
					totalTime = 12f,
					highJumpMultiplier = 6f
				};
				((Behaviour)val9).enabled = false;
				AdditionalCookingBehavior[] additionalCookingBehaviors2 = orAddComponent5.additionalCookingBehaviors;
				val4 = new CookingBehavior_DisableScripts();
				val4.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val8 };
				((AdditionalCookingBehavior)val4).cookedAmountToTrigger = 1;
				AdditionalCookingBehavior[] array = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(additionalCookingBehaviors2, (AdditionalCookingBehavior)(object)val4);
				val3 = new CookingBehavior_EnableScripts();
				val3.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val9 };
				((AdditionalCookingBehavior)val3).cookedAmountToTrigger = 1;
				orAddComponent5.additionalCookingBehaviors = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(array, (AdditionalCookingBehavior)(object)val3);
				GameObject val10 = peakBundle.LoadAsset<GameObject>("Tourtiere.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val10);
				ItemOptimizer orAddComponent6 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val10);
				orAddComponent6.item = val10.GetComponent<Item>();
				orAddComponent6.item.overrideJetpackFuel = true;
				orAddComponent6.item.overrideJetpackFuelAmount = 10;
				orAddComponent6.item.overrideJetpackFuelPerUse = 20;
				orAddComponent6.item.overrideJetpackFuelPerFuelMult = 1f;
				val10.AddComponent<CookingHungerController>();
				Item val11 = default(Item);
				if (val10.TryGetComponent<Item>(ref val11))
				{
					val11.carryWeight = 2;
				}
				if (IsHoliday)
				{
					LootData component = val10.GetComponent<LootData>();
					Rarity rarity = component.Rarity;
					component.spawnLocations = EnumFlagExtensions.AddFlag<SpawnPool>(EnumFlagExtensions.AddFlag<SpawnPool>(EnumFlagExtensions.AddFlag<SpawnPool>(EnumFlagExtensions.AddFlag<SpawnPool>(EnumFlagExtensions.AddFlag<SpawnPool>(component.spawnLocations, (SpawnPool)1024), (SpawnPool)2048), (SpawnPool)8192), (SpawnPool)16777216), (SpawnPool)67108864);
					component.rarityOverrides.Add(new ItemRarityOverride
					{
						Rarity = (Rarity)(rarity - 1),
						spawnPool = (SpawnPool)4096
					});
					LootData component2 = val7.GetComponent<LootData>();
					Rarity rarity2 = component2.Rarity;
					component2.rarityOverrides = new List<ItemRarityOverride>(2)
					{
						new ItemRarityOverride
						{
							Rarity = (Rarity)(rarity2 - 2),
							spawnPool = (SpawnPool)4096
						},
						new ItemRarityOverride
						{
							Rarity = (Rarity)(rarity2 - 1),
							spawnPool = (SpawnPool)16777216
						}
					};
					component2.Rarity = (Rarity)(rarity2 - 1);
				}
				GameObject val12 = peakBundle.LoadAsset<GameObject>("Paw Cakes.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val12);
				ItemOptimizer orAddComponent7 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val12);
				orAddComponent7.item = val12.GetComponent<Item>();
				val12.AddComponent<CookingHungerController>();
				GameObject val13 = peakBundle.LoadAsset<GameObject>("MapleCookies.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val13);
				ItemOptimizer orAddComponent8 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val13);
				orAddComponent8.item = val13.GetComponent<Item>();
				orAddComponent8.item.overrideJetpackFuel = true;
				orAddComponent8.item.overrideJetpackFuelAmount = 10;
				orAddComponent8.item.overrideJetpackFuelPerUse = 20;
				orAddComponent8.item.overrideJetpackFuelPerFuelMult = 1f;
				val13.AddComponent<CookingHungerController>();
				GameObject val14 = peakBundle.LoadAsset<GameObject>("Airplane Poutine.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val14);
				ItemOptimizer orAddComponent9 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val14);
				orAddComponent9.item = val14.GetComponent<Item>();
				val14.AddComponent<CookingHungerController>();
				GameObject val15 = peakBundle.LoadAsset<GameObject>("SpruceBeer.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val15);
				ItemOptimizer orAddComponent10 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val15);
				orAddComponent10.item = val15.GetComponent<Item>();
				val15.AddComponent<CookingHungerController>();
				ItemCooking orAddComponent11 = ExtGameObject.GetOrAddComponent<ItemCooking>(val15);
				ActionSpawnOnFirstUse orAddComponent12 = ExtGameObject.GetOrAddComponent<ActionSpawnOnFirstUse>(val15);
				((ItemActionBase)orAddComponent12).item = orAddComponent10.item;
				Action_Spawn component3 = val15.GetComponent<Action_Spawn>();
				Item val16 = default(Item);
				Action_Spawn val17 = default(Action_Spawn);
				if (ItemDatabase.TryGetItem((ushort)27, ref val16) && ((Component)val16).TryGetComponent<Action_Spawn>(ref val17))
				{
					component3.objectToSpawn = val17.objectToSpawn;
				}
				((Action_Spawn)orAddComponent12).objectToSpawn = component3.objectToSpawn;
				((ItemAction)orAddComponent12).OnCastFinished = true;
				((Action_Spawn)orAddComponent12).spawnPoint = component3.spawnPoint;
				((ItemActionBase)orAddComponent12).item = ((ItemActionBase)component3).item;
				((Behaviour)component3).enabled = false;
				((Behaviour)orAddComponent12).enabled = false;
				Object.Destroy((Object)(object)component3);
				AdditionalCookingBehavior[] additionalCookingBehaviors3 = orAddComponent11.additionalCookingBehaviors;
				val3 = new CookingBehavior_EnableScripts();
				((AdditionalCookingBehavior)val3).cookedAmountToTrigger = 1;
				val3.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)orAddComponent12 };
				orAddComponent11.additionalCookingBehaviors = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(additionalCookingBehaviors3, (AdditionalCookingBehavior)(object)val3);
				GameObject val18 = peakBundle.LoadAsset<GameObject>("MapleToffee.prefab");
				ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(val18);
				ItemOptimizer orAddComponent13 = ExtGameObject.GetOrAddComponent<ItemOptimizer>(val18);
				orAddComponent13.item = val18.GetComponent<Item>();
				peakBundle.Mod.RegisterContent();
				HighJumpEffectPrefab = peakBundle.LoadAsset<GameObject>("VFX_Screen_HighJump.prefab");
				Log.LogInfo((object)"Snacks items are loaded!");
			});
			BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "canadianfruits.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
			{
				Shader val = Shader.Find("GD/FoliageGD");
				if ((Object)(object)val == (Object)null)
				{
					Log.LogWarning((object)": Shader GD/FoliageGD was not found.");
				}
				else
				{
					List<GameObject> list = new List<GameObject>
					{
						peakBundle.LoadAsset<GameObject>("Bub Berry Blue.prefab"),
						peakBundle.LoadAsset<GameObject>("Bub Berry Purple.prefab"),
						peakBundle.LoadAsset<GameObject>("Bub Berry White.prefab")
					};
					foreach (GameObject item in list)
					{
						FixColorblindMaterials(item);
						ItemOptimizer orAddComponent = ExtGameObject.GetOrAddComponent<ItemOptimizer>(item);
						orAddComponent.item = item.GetComponent<Item>();
						ExtGameObject.GetOrAddComponent<PhotonCleanupHelper>(item);
						item.AddComponent<CookingHungerController>();
						orAddComponent.item.overrideJetpackFuel = true;
						orAddComponent.item.overrideJetpackFuelAmount = 0;
						orAddComponent.item.overrideJetpackFuelPerUse = Mathf.RoundToInt(8.333333f);
						orAddComponent.item.overrideJetpackFuelPerFuelMult = 1f;
						Renderer[] componentsInChildren = item.GetComponentsInChildren<Renderer>();
						foreach (Renderer val2 in componentsInChildren)
						{
							Material[] sharedMaterials = val2.sharedMaterials;
							foreach (Material val3 in sharedMaterials)
							{
								if (!(((Object)val3.shader).name != ((Object)val).name))
								{
									val3.shader = val;
									val3.EnableKeyword("_ALPHATEST_ON");
									val3.EnableKeyword("_TRIPLANAR1_TOPDOWN");
									val3.EnableKeyword("_TRIPLANAR2_TRIPLANAR");
									val3.EnableKeyword("_TRIPLANAR3_UV");
									val3.EnableKeyword("_USESIMPLEMASK_ON");
								}
							}
							Material[] materials = val2.materials;
							foreach (Material val4 in materials)
							{
								if (!(((Object)val4.shader).name != ((Object)val).name))
								{
									val4.shader = val;
									val4.EnableKeyword("_ALPHATEST_ON");
									val4.EnableKeyword("_TRIPLANAR1_TOPDOWN");
									val4.EnableKeyword("_TRIPLANAR2_TRIPLANAR");
									val4.EnableKeyword("_TRIPLANAR3_UV");
									val4.EnableKeyword("_USESIMPLEMASK_ON");
								}
							}
						}
					}
				}
				peakBundle.Mod.RegisterContent();
				Log.LogInfo((object)"Fruits items are loaded!");
			});
			LoadAllCustomAfflictions();
			MonoDetourManager.InvokeHookInitializers(typeof(Plugin).Assembly);
			new Harmony("com.github.MiiMii1205.CanadianCuisine").PatchAll(typeof(CuisineCharacterPatcher));
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}

		private void LoadAllCustomAfflictions()
		{
			ModDefinition orCreate = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info);
			CuisineAfflictionManager.RegisterAfflictions(new AfflictionDefinition
			{
				Name = CuisineAfflictionValues.HIGH_JUMP_NAME
			}, orCreate);
			CuisineAfflictionManager.RegisterAfflictions(new AfflictionDefinition
			{
				Name = CuisineAfflictionValues.WITH_CONSEQUENCE
			}, orCreate);
			CuisineAfflictionManager.RegisterAfflictions(new AfflictionDefinition
			{
				Name = CuisineAfflictionValues.PARALYZED
			}, orCreate);
		}

		private void AddLocalizedTextCsv()
		{
			using StreamReader streamReader = new StreamReader(Path.Join((ReadOnlySpan<char>)Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), (ReadOnlySpan<char>)"CanadianCuisineLocalizedText.csv"));
			int num = 0;
			while (!streamReader.EndOfStream)
			{
				string text = streamReader.ReadLine();
				if (text == null)
				{
					break;
				}
				num++;
				List<string> list = new List<string>(CSVReader.SplitCsvLine(text, true));
				string text2 = ExtCollections.Deque<string>(list);
				string text3 = ExtCollections.Pop<string>(list);
				if (text3 != "ENDLINE")
				{
					Log.LogError((object)$"Invalid localization at line {num}");
				}
				if (text2 != "CURRENT_LANGUAGE")
				{
					LocalizedText.mainTable[text2] = list;
					Log.LogDebug((object)("Added localization of " + text2));
				}
			}
			Log.LogDebug((object)$"Added {num - 1} localizations");
		}
	}
}
namespace CanadianCuisine.Patchers
{
	public class CuisineCharacterPatcher
	{
		[HarmonyPatch(typeof(CharacterAfflictions), "Awake")]
		[HarmonyPostfix]
		public static void AfflictionAwakePostfix(CharacterAfflictions __instance)
		{
			CuisineCharacterAfflictions orAddComponent = ExtGameObject.GetOrAddComponent<CuisineCharacterAfflictions>(((Component)__instance.character).gameObject);
			if ((Object)(object)orAddComponent == (Object)null)
			{
				Plugin.Log.LogError((object)("Can't add CuisineCharacterAfflictions to " + __instance.character.characterName));
			}
		}

		[HarmonyPatch(typeof(GUIManager), "Awake")]
		[HarmonyPostfix]
		public static void GUIAwakePostfix(GUIManager __instance)
		{
			//IL_0063: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			CuisineGUIManager orAddComponent = ExtGameObject.GetOrAddComponent<CuisineGUIManager>(((Component)__instance).gameObject);
			Transform transform = ((Component)__instance.poisonSVFX).transform;
			if ((Object)(object)orAddComponent == (Object)null)
			{
				Plugin.Log.LogError((object)("Can't add CuisineGUIManager to " + __instance.character.characterName + "'s GUI"));
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(Plugin.HighJumpEffectPrefab, transform.parent);
			((Component)val.transform).transform.localPosition = transform.localPosition;
			((Component)val.transform).transform.localRotation = transform.localRotation;
			((Component)val.transform).transform.localScale = transform.localScale;
			orAddComponent.highJumpSvfx = val.GetComponent<ScreenVFX>();
			val.SetActive(false);
		}

		[HarmonyPatch(typeof(CharacterMovement), "CheckForPalJump")]
		[HarmonyPrefix]
		public static void CheckForPalJumpPrefix(CharacterMovement __instance, Character c, ref bool __runOriginal)
		{
			CuisineCharacterAfflictions component = ((Component)c).GetComponent<CuisineCharacterAfflictions>();
			if (component == null || !component.HasHighJump)
			{
				__runOriginal = true;
				return;
			}
			__runOriginal = false;
			Plugin.Log.LogInfo((object)("High Jump boost given to " + __instance.character.characterName + " by " + c.characterName));
			if (__instance.character.data.sinceStandOnPlayer < 0.3f && c.data.sinceJump < 0.3f)
			{
				__instance.character.data.lastStoodOnPlayer = null;
				if (__instance.character.refs.view.IsMine)
				{
					__instance.character.refs.view.RPC("HighJumpRpc", (RpcTarget)0, new object[2]
					{
						true,
						c.refs.movement.jumpImpulse
					});
				}
			}
		}

		[HarmonyPatch(typeof(CharacterClimbing), "RPCA_ClimbJump")]
		[HarmonyPrefix]
		public static void RPCA_ClimbJumpPrefix(CharacterClimbing __instance, ref bool __runOriginal)
		{
			//IL_0062: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			CuisineCharacterAfflictions component = ((Component)__instance).GetComponent<CuisineCharacterAfflictions>();
			if (component == null || !component.HasHighJump)
			{
				__runOriginal = true;
				return;
			}
			__runOriginal = false;
			Plugin.Log.LogInfo((object)(__instance.character.characterName + " lunged while in high jump."));
			__instance.character.data.sinceClimbJump = 0f;
			__instance.character.UseStamina(0.2f, true, false);
			__instance.playerSlide += ((Vector2)(ref __instance.character.input.movementInput)).normalized * (8f * (component.highJumpMultiplier / 4f));
			if (__instance.view.IsMine && !__instance.character.isBot)
			{
				GamefeelHandler.instance.AddPerlinShake(10f, 0.5f, 10f);
				GUIManager.instance.ClimbJump();
			}
		}
	}
}
namespace CanadianCuisine.Patchers.Hooks
{
	[MonoDetourTargets(typeof(Affliction))]
	internal static class AfflictionHooks
	{
		[MonoDetourHookInitialize]
		private static void Init()
		{
			CreateBlankAffliction.Postfix(Postfix_BlankAffliction);
		}

		private static void Postfix_BlankAffliction(ref AfflictionType afflictionType, ref Affliction returnValue)
		{
			if (returnValue == null)
			{
				AfflictionDefinition afflictionDefinition = CuisineAfflictionManager.StatusByType(afflictionType);
				Plugin.Log.LogInfo((object)("Found affliction type " + afflictionDefinition.Name));
				if (afflictionDefinition.Name == CuisineAfflictionValues.HIGH_JUMP_NAME)
				{
					returnValue = (Affliction)(object)new AfflictionHighJump();
				}
				else if (afflictionDefinition.Name == CuisineAfflictionValues.WITH_CONSEQUENCE)
				{
					returnValue = (Affliction)(object)new AfflictionWithConsequence();
				}
				else if (afflictionDefinition.Name == CuisineAfflictionValues.PARALYZED)
				{
					returnValue = (Affliction)(object)new AfflictionParalyzed();
				}
			}
		}
	}
	[MonoDetourTargets(typeof(ItemCooking))]
	public class CookingHooks
	{
		[MonoDetourHookInitialize]
		private static void Init()
		{
			UpdateCookedBehavior.Prefix(Prefix_UpdateCookedBehavior);
		}

		private static void Prefix_UpdateCookedBehavior(ItemCooking self)
		{
			CookingHungerController cookingHungerController = default(CookingHungerController);
			if (!((Component)((ItemComponent)self).item).TryGetComponent<CookingHungerController>(ref cookingHungerController))
			{
				return;
			}
			IntItemData data = ((ItemComponent)self).item.GetData<IntItemData>((DataEntryKey)1);
			if (data.Value == 0)
			{
				data.Value += self.preCooked;
			}
			int num = data.Value - self.timesCookedLocal;
			if (num > 0)
			{
				for (int i = 1 + self.timesCookedLocal; i <= data.Value; i++)
				{
					cookingHungerController.UpdateCookingHunger(i);
				}
			}
		}
	}
}
namespace CanadianCuisine.Data
{
	public class AfflictionDefinition
	{
		internal int index;

		public string Name { get; set; } = "";

		public AfflictionType Type => (AfflictionType)index;
	}
	public static class CuisineAfflictionManager
	{
		private static SortedList<string, AfflictionDefinition> registered = new SortedList<string, AfflictionDefinition>();

		public static IList<AfflictionDefinition> Afflictions => registered.Values;

		public static int length => registered.Count;

		internal static void RegisterAfflictions(AfflictionDefinition affliction, ModDefinition owner)
		{
			string text = owner.Id + "->" + affliction.Name;
			if (!registered.TryAdd(text, affliction))
			{
				throw new ArgumentException("Affliction with name " + text + " already registered. Choose a unique name.");
			}
			ReIndex();
		}

		internal static AfflictionDefinition StatusByType(AfflictionType type)
		{
			//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 registered.FirstOrDefault<KeyValuePair<string, AfflictionDefinition>>((KeyValuePair<string, AfflictionDefinition> x) => x.Value.Type == type).Value;
		}

		internal static AfflictionType TypeByName(string name)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			return registered.FirstOrDefault<KeyValuePair<string, AfflictionDefinition>>((KeyValuePair<string, AfflictionDefinition> x) => x.Value.Name == name).Value.Type;
		}

		private static void ReIndex()
		{
			List<AfflictionType> list = Enum.GetValues(typeof(AfflictionType)).OfType<AfflictionType>().ToList();
			List<AfflictionDefinition> list2 = registered.Values.ToList();
			int i = 0;
			int num = 0;
			for (; i < list.Count + list2.Count; i++)
			{
				if (num >= list2.Count)
				{
					break;
				}
				if (!Enum.IsDefined(typeof(AfflictionType), i))
				{
					list2[num].index = i;
					num++;
				}
			}
		}
	}
	public static class CuisineAfflictionValues
	{
		public static readonly string PARALYZED = "Paralyzed";

		public static readonly string HIGH_JUMP_NAME = "HighJump";

		public static readonly string WITH_CONSEQUENCE = "WithConsequences";
	}
}
namespace CanadianCuisine.Behaviours
{
	public class ActionSpawnOnFirstUse : Action_Spawn
	{
		public override void RunAction()
		{
			OptionableIntItemData data = ((ItemActionBase)this).item.GetData<OptionableIntItemData>((DataEntryKey)2);
			if (!data.HasData || data.Value == ((ItemActionBase)this).item.totalUses - 1)
			{
				((Action_Spawn)this).RunAction();
			}
		}
	}
	public class CookingHungerController : MonoBehaviour
	{
		public Item item;

		public Action_RestoreHunger restoreHunger;

		private void Awake()
		{
			item = ThrowHelper.ThrowIfArgumentNull<Item>(((Component)this).GetComponent<Item>(), "GetComponent<Item>()");
			restoreHunger = ThrowHelper.ThrowIfArgumentNull<Action_RestoreHunger>(((Component)this).GetComponent<Action_RestoreHunger>(), "GetComponent<Action_RestoreHunger>()");
		}

		public void UpdateCookingHunger(int totalCooked)
		{
			if (Object.op_Implicit((Object)(object)restoreHunger))
			{
				if (totalCooked < 2)
				{
					Action_RestoreHunger obj = restoreHunger;
					obj.restorationAmount *= 2f;
				}
				else if (totalCooked > 2)
				{
					restoreHunger.restorationAmount = Mathf.Max(restoreHunger.restorationAmount - 0.05f, 0f);
				}
			}
		}
	}
	public class CuisineCharacterAfflictions : MonoBehaviourPunCallbacks
	{
		private Character m_character;

		private bool m_hasHighJump;

		private float m_originalJumpImpulse;

		public float highJumpMultiplier = 2f;

		private CharacterMovement m_characterMovement;

		public bool HasHighJump => m_hasHighJump;

		private void Awake()
		{
			m_character = ((Component)this).GetComponent<Character>();
			m_characterMovement = ((Component)m_character).GetComponent<CharacterMovement>();
			m_originalJumpImpulse = m_characterMovement.jumpImpulse;
		}

		public void RecalculateHighJump()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			m_hasHighJump = false;
			Affliction val = default(Affliction);
			if (m_character.refs.afflictions.HasAfflictionType(CuisineAfflictionManager.TypeByName(CuisineAfflictionValues.HIGH_JUMP_NAME), ref val) && val is AfflictionHighJump afflictionHighJump)
			{
				m_hasHighJump = true;
				highJumpMultiplier = afflictionHighJump.highJumpMultiplier;
			}
			m_characterMovement.jumpImpulse = (m_hasHighJump ? (m_originalJumpImpulse * highJumpMultiplier) : m_originalJumpImpulse);
		}

		[PunRPC]
		public void HighJumpRpc(bool isPalJump, float jumpImpulse)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			float staminaCostMult = 1f;
			float jumpMult = 1f;
			Vector3 jumpDir = Vector3.up;
			if (isPalJump)
			{
				staminaCostMult = 0f;
				float num = jumpMult + 1f;
				jumpMult = num;
				m_character.data.sincePalJump = 0f;
				jumpDir += m_character.data.lookDirection_Flat * 0.25f;
				SFX_Instance[] boostPlayer = m_characterMovement.boostPlayer;
				foreach (SFX_Instance val in boostPlayer)
				{
					val.Play(m_character.Center);
				}
			}
			bool flag = false;
			if (m_character.data.jumpsRemaining > 0)
			{
				CharacterData data = m_character.data;
				data.jumpsRemaining--;
			}
			else if (m_character.data.extraJumps > 0)
			{
				flag = true;
				CharacterData data2 = m_character.data;
				data2.extraJumps--;
			}
			m_character.data.isCrouching = false;
			m_character.data.chargingJump = true;
			if (flag && !isPalJump)
			{
				float num = jumpMult + 1f;
				jumpMult = num;
			}
			m_character.OnStartJump();
			((MonoBehaviour)this).StartCoroutine(IDoJump());
			GlobalEvents.TriggerCharacterJumped(m_character, flag);
			IEnumerator IDoJump()
			{
				_ = jumpImpulse;
				m_character.refs.afflictions.SubtractStatus((STATUSTYPE)11, 0.05f, true, false);
				m_character.refs.afflictions.SubtractStatus((STATUSTYPE)14, 0.03f, true, false);
				float c = 0f;
				while (c < 0.1f)
				{
					m_character.data.sinceGrounded = 0f;
					m_character.data.sinceJump = 0f;
					c += Time.deltaTime;
					yield return null;
				}
				m_character.OnJump();
				m_character.data.chargingJump = false;
				m_character.data.isJumping = true;
				m_character.UseStamina(((!m_characterMovement.sprintAnimationDisabled && m_character.data.isSprinting) ? m_characterMovement.jumpStaminaUsageSprinting : m_characterMovement.jumpStaminaUsage) * staminaCostMult, false, false);
				if (!m_character.refs.afflictions.isStruggling)
				{
					foreach (Bodypart part in m_character.refs.ragdoll.partList)
					{
						part.AddForce(jumpDir * (jumpImpulse * jumpMult * m_characterMovement.balloonJumpMultiplier * m_characterMovement.waterJumpModifier), (ForceMode)5);
					}
				}
			}
		}
	}
	public class CuisineGUIManager : MonoBehaviour
	{
		public ScreenVFX highJumpSvfx;

		public static CuisineGUIManager instance;

		private void Awake()
		{
			instance = this;
		}

		public void StartHighJump()
		{
			highJumpSvfx.StartFX(0.15f);
		}

		public void EndHighJump()
		{
			highJumpSvfx.EndFX();
		}
	}
	public class MapleToffeeVariantController : MonoBehaviour
	{
		private void Start()
		{
			Transform transform = ((Component)this).transform;
			int num = Random.Range(0, transform.childCount);
			MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>();
			MeshRenderer[] array = componentsInChildren;
			foreach (MeshRenderer val in array)
			{
				((Component)val).gameObject.SetActive(false);
			}
			((Component)transform.GetChild(num)).gameObject.SetActive(true);
		}
	}
}
namespace CanadianCuisine.Behaviours.CookingBehaviours
{
	public class CookingBehaviourChangeFeedbackSfx : AdditionalCookingBehavior
	{
		public string soundEffectNameToChangeTo = "";

		public CookingBehaviourChangeFeedbackSfx()
		{
			if (soundEffectNameToChangeTo == "")
			{
				Plugin.Log.LogWarning((object)"Cooking Behaviour will try to change to an empty sound effect name.");
			}
		}

		public override void TriggerBehaviour(int cookedAmount)
		{
			ItemUseFeedback[] components = ((Component)((ItemComponent)base.itemCooking).item).gameObject.GetComponents<ItemUseFeedback>();
			ItemUseFeedback useFeedback = ((ItemComponent)base.itemCooking).item._useFeedback;
			ItemUseFeedback val = null;
			ItemUseFeedback[] array = components;
			foreach (ItemUseFeedback val2 in array)
			{
				if ((Object)(object)val2 != (Object)(object)useFeedback && ((Object)val2.sfxUsed).name == soundEffectNameToChangeTo)
				{
					val = val2;
				}
			}
			if ((Object)(object)val != (Object)null && (Object)(object)useFeedback != (Object)null)
			{
				useFeedback.sfxUsed = val.sfxUsed;
				Plugin.Log.LogDebug((object)("Changed Feedback SFX to \"" + soundEffectNameToChangeTo + "\""));
			}
		}
	}
}
namespace CanadianCuisine.Behaviours.Afflictions
{
	public class AfflictionHighJump : Affliction
	{
		public float highJumpMultiplier = 2f;

		private CuisineCharacterAfflictions? m_cuisineAfflictionCharacter;

		private Color m_jumpy = new Color(0.48599997f, 0.73300004f, 0.59599996f, 0.125f);

		public override void UpdateEffectNetworked()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			base.character.refs.customization.PulseStatus(m_jumpy, m_jumpy.a);
		}

		public AfflictionHighJump(float totalTime, float highJumpMultiplier)
			: base(totalTime)
		{
			//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)
			this.highJumpMultiplier = highJumpMultiplier;
		}

		public AfflictionHighJump(float totalTime)
			: base(totalTime)
		{
		}//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)


		public AfflictionHighJump()
		{
		}//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)


		public override AfflictionType GetAfflictionType()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return CuisineAfflictionManager.TypeByName(CuisineAfflictionValues.HIGH_JUMP_NAME);
		}

		public override void Stack(Affliction incomingAffliction)
		{
			base.totalTime = incomingAffliction.totalTime;
			if (incomingAffliction is AfflictionHighJump afflictionHighJump)
			{
				highJumpMultiplier = Mathf.Max(highJumpMultiplier, afflictionHighJump.highJumpMultiplier);
			}
			base.timeElapsed = 0f;
			if (m_cuisineAfflictionCharacter == null)
			{
				m_cuisineAfflictionCharacter = ((Component)base.character).GetComponent<CuisineCharacterAfflictions>();
			}
			m_cuisineAfflictionCharacter.RecalculateHighJump();
		}

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

		public override void Deserialize(BinaryDeserializer serializer)
		{
			base.totalTime = serializer.ReadFloat();
			highJumpMultiplier = serializer.ReadFloat();
		}

		public override void OnApplied()
		{
			if (m_cuisineAfflictionCharacter == null)
			{
				m_cuisineAfflictionCharacter = ((Component)base.character).GetComponent<CuisineCharacterAfflictions>();
			}
			m_cuisineAfflictionCharacter.RecalculateHighJump();
			if (base.character.IsLocal)
			{
				CuisineGUIManager.instance.StartHighJump();
			}
		}

		public override void OnRemoved()
		{
			m_cuisineAfflictionCharacter?.RecalculateHighJump();
			if (base.character.IsLocal)
			{
				CuisineGUIManager.instance.EndHighJump();
			}
		}
	}
	public class AfflictionParalyzed : Affliction
	{
		public override AfflictionType GetAfflictionType()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return CuisineAfflictionManager.TypeByName(CuisineAfflictionValues.PARALYZED);
		}

		public override void Stack(Affliction incomingAffliction)
		{
		}

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

		public override void Deserialize(BinaryDeserializer serializer)
		{
			base.totalTime = serializer.ReadFloat();
		}

		public override void OnApplied()
		{
			base.character.Fall(base.totalTime, 0f);
		}
	}
	public class AfflictionWithConsequence : Affliction
	{
		[SerializeReference]
		public Affliction? mainAffliction;

		[SerializeReference]
		public Affliction? consequentAffliction;

		public float delay;

		public AfflictionWithConsequence(float totalTime)
			: base(totalTime)
		{
		}

		public AfflictionWithConsequence()
		{
		}

		public override AfflictionType GetAfflictionType()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return CuisineAfflictionManager.TypeByName(CuisineAfflictionValues.WITH_CONSEQUENCE);
		}

		public override void Stack(Affliction incomingAffliction)
		{
			//IL_0023: 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)
			//IL_0062: 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)
			if (incomingAffliction is AfflictionWithConsequence { mainAffliction: not null } afflictionWithConsequence && mainAffliction != null && afflictionWithConsequence.mainAffliction.GetAfflictionType() == mainAffliction.GetAfflictionType())
			{
				base.totalTime = ((Affliction)afflictionWithConsequence).totalTime;
				base.timeElapsed = 0f;
				if (afflictionWithConsequence.consequentAffliction != null && consequentAffliction != null && afflictionWithConsequence.consequentAffliction.GetAfflictionType() == consequentAffliction.GetAfflictionType())
				{
					Affliction? obj = consequentAffliction;
					obj.totalTime += afflictionWithConsequence.consequentAffliction.totalTime;
				}
			}
		}

		public override void Serialize(BinarySerializer serializer)
		{
			//IL_0029: 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)
			serializer.WriteFloat(delay);
			serializer.WriteBool(mainAffliction != null);
			Affliction? obj = mainAffliction;
			serializer.WriteInt((obj == null) ? (-1) : ((int)obj.GetAfflictionType()));
			serializer.WriteBool(consequentAffliction != null);
			Affliction? obj2 = consequentAffliction;
			serializer.WriteInt((obj2 == null) ? (-1) : ((int)obj2.GetAfflictionType()));
			Affliction? obj3 = mainAffliction;
			if (obj3 != null)
			{
				obj3.Serialize(serializer);
			}
			Affliction? obj4 = consequentAffliction;
			if (obj4 != null)
			{
				obj4.Serialize(serializer);
			}
		}

		public override bool Tick()
		{
			if (mainAffliction != null && (Object)(object)mainAffliction.character != (Object)null)
			{
				base.timeElapsed = Mathf.Max(mainAffliction.timeElapsed, base.timeElapsed);
				return (double)mainAffliction.timeElapsed >= (double)mainAffliction.totalTime;
			}
			return ((Affliction)this).Tick();
		}

		public override void Deserialize(BinaryDeserializer serializer)
		{
			delay = serializer.ReadFloat();
			bool flag = serializer.ReadBool();
			int num = serializer.ReadInt();
			bool flag2 = serializer.ReadBool();
			int num2 = serializer.ReadInt();
			if (flag)
			{
				mainAffliction = Affliction.CreateBlankAffliction((AfflictionType)num);
				mainAffliction.Deserialize(serializer);
			}
			if (flag2)
			{
				consequentAffliction = Affliction.CreateBlankAffliction((AfflictionType)num2);
				consequentAffliction.Deserialize(serializer);
			}
			base.totalTime = delay + (mainAffliction?.totalTime ?? 0f);
		}

		public override void OnApplied()
		{
			if (base.character.IsLocal)
			{
				base.character.refs.afflictions.AddAffliction(mainAffliction, false);
			}
		}

		public override void OnRemoved()
		{
			if (base.character.IsLocal)
			{
				base.character.refs.afflictions.AddAffliction(consequentAffliction, false);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}