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.Peak.Afflictions.Affliction;
using Microsoft.CodeAnalysis;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using PEAKLib.Core;
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("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2+ad01329eef1d9c184e6cb2fbd4542075b2e3dd1f")]
[assembly: AssemblyProduct("com.github.MiiMii1205.CanadianCuisine")]
[assembly: AssemblyTitle("CanadianCuisine")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.2.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 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 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 : Attribute, IMonoDetourTargets
{
public Type? TargetType { get; }
public bool IncludeNestedTypes { get; set; }
public string[]? Members { get; set; }
public string[]? MemberNamePrefixes { get; set; }
public string[]? MemberNameSuffixes { get; set; }
public bool GenerateControlFlowVariants { get; set; }
public MonoDetourTargetsAttribute(Type? targetType = null)
{
TargetType = targetType;
IncludeNestedTypes = true;
base..ctor();
}
}
}
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", "1.5.2")]
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 => "1.5.2";
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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0145: 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_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: 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
//IL_0220: 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_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Expected O, but got Unknown
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Expected O, but got Unknown
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: 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_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Expected O, but got Unknown
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Expected O, but got Unknown
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03c7: Expected O, but got Unknown
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
GameObject val5 = peakBundle.LoadAsset<GameObject>("HostCuttings.prefab");
ItemCooking val6 = val5.AddComponent<ItemCooking>();
val6.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 val7 = new CookingBehavior_EnableScripts();
((AdditionalCookingBehavior)val7).cookedAmountToTrigger = 1;
val7.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val5.GetComponent<Action_GiveExtraStamina>() };
obj[1] = (AdditionalCookingBehavior)val7;
obj[2] = new CookingBehaviourChangeFeedbackSfx
{
cookedAmountToTrigger = 3,
soundEffectNameToChangeTo = "SFXI Heal Fortified Milk"
};
val7 = new CookingBehavior_EnableScripts();
((AdditionalCookingBehavior)val7).cookedAmountToTrigger = 3;
val7.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val5.GetComponent<Action_ApplyAffliction>() };
obj[3] = (AdditionalCookingBehavior)val7;
val7 = new CookingBehavior_EnableScripts();
((AdditionalCookingBehavior)val7).cookedAmountToTrigger = 3;
val7.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val5.GetComponent<Action_GiveExtraStamina>() };
obj[4] = (AdditionalCookingBehavior)val7;
obj[5] = new CookingBehaviourChangeFeedbackSfx
{
cookedAmountToTrigger = 4,
soundEffectNameToChangeTo = "SFXI Heal Hunger Normal"
};
CookingBehavior_DisableScripts val8 = new CookingBehavior_DisableScripts();
((AdditionalCookingBehavior)val8).cookedAmountToTrigger = 4;
val8.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[2]
{
(MonoBehaviour)val5.GetComponent<Action_GiveExtraStamina>(),
(MonoBehaviour)val5.GetComponent<Action_ApplyAffliction>()
};
obj[6] = (AdditionalCookingBehavior)val8;
val6.additionalCookingBehaviors = (AdditionalCookingBehavior[])(object)obj;
GameObject val9 = peakBundle.LoadAsset<GameObject>("PapinoCookies.prefab");
Action_ApplyAffliction val10 = val9.AddComponent<Action_ApplyAffliction>();
((ItemAction)val10).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
}
};
val10.affliction = (Affliction)(object)affliction;
ItemCooking orAddComponent = ExtGameObject.GetOrAddComponent<ItemCooking>(val9);
AdditionalCookingBehavior[] additionalCookingBehaviors = orAddComponent.additionalCookingBehaviors;
val8 = new CookingBehavior_DisableScripts();
val8.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val10 };
((AdditionalCookingBehavior)val8).cookedAmountToTrigger = 1;
orAddComponent.additionalCookingBehaviors = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(additionalCookingBehaviors, (AdditionalCookingBehavior)(object)val8);
GameObject val11 = peakBundle.LoadAsset<GameObject>("SugarFudge.prefab");
ItemCooking orAddComponent2 = ExtGameObject.GetOrAddComponent<ItemCooking>(val11);
Action_ApplyAffliction val12 = val11.AddComponent<Action_ApplyAffliction>();
((ItemAction)val12).OnCastFinished = true;
val12.affliction = (Affliction)(object)new AfflictionWithConsequence
{
mainAffliction = (Affliction?)(object)new AfflictionHighJump
{
totalTime = 12f,
highJumpMultiplier = 6f
},
consequentAffliction = (Affliction?)new Affliction_AdjustDrowsyOverTime
{
totalTime = 10f,
statusPerSecond = 0.0333f
}
};
Action_ApplyAffliction val13 = val11.AddComponent<Action_ApplyAffliction>();
((ItemAction)val13).OnCastFinished = true;
val13.affliction = (Affliction)(object)new AfflictionHighJump
{
totalTime = 12f,
highJumpMultiplier = 6f
};
((Behaviour)val13).enabled = false;
AdditionalCookingBehavior[] additionalCookingBehaviors2 = orAddComponent2.additionalCookingBehaviors;
val8 = new CookingBehavior_DisableScripts();
val8.scriptsToDisable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val12 };
((AdditionalCookingBehavior)val8).cookedAmountToTrigger = 1;
AdditionalCookingBehavior[] array = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(additionalCookingBehaviors2, (AdditionalCookingBehavior)(object)val8);
val7 = new CookingBehavior_EnableScripts();
val7.scriptsToEnable = (MonoBehaviour[])(object)new MonoBehaviour[1] { (MonoBehaviour)val13 };
((AdditionalCookingBehavior)val7).cookedAmountToTrigger = 1;
orAddComponent2.additionalCookingBehaviors = CollectionExtensions.AddToArray<AdditionalCookingBehavior>(array, (AdditionalCookingBehavior)(object)val7);
if (IsHoliday)
{
GameObject val14 = peakBundle.LoadAsset<GameObject>("Tourtiere.prefab");
LootData component = val14.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 = val11.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);
}
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);
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_0061: 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_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_0097: 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);
__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();
}
}
}
}
}
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)
string name2 = name;
return registered.FirstOrDefault<KeyValuePair<string, AfflictionDefinition>>((KeyValuePair<string, AfflictionDefinition> x) => x.Value.Name == name2).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)
{
((Action_Spawn)this).RunAction();
}
}
}
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_0068: 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)
//IL_0082: 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)
//IL_008c: 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)
float staminaCostMult = 1f;
float jumpMult = 1f;
Vector3 jumpDir = Vector3.up;
if (isPalJump)
{
staminaCostMult = 0f;
jumpMult = 2f;
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);
}
}
CharacterData data = m_character.data;
data.jumpsRemaining--;
m_character.data.isCrouching = false;
m_character.data.chargingJump = true;
m_character.OnStartJump();
((MonoBehaviour)this).StartCoroutine(IDoJump());
IEnumerator IDoJump()
{
_ = jumpImpulse;
if (!m_character.OutOfStamina())
{
m_character.refs.afflictions.SubtractStatus((STATUSTYPE)11, 0.05f, 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;
bool flag = m_character.GetTotalStamina() > m_characterMovement.jumpStaminaUsageSprinting && m_character.input.sprintIsPressed;
m_character.data.sprintJump = flag;
m_character.UseStamina((flag ? m_characterMovement.jumpStaminaUsageSprinting : m_characterMovement.jumpStaminaUsage) * staminaCostMult, flag);
foreach (Bodypart part in m_character.refs.ragdoll.partList)
{
part.AddForce(jumpDir * (jumpImpulse * jumpMult * m_characterMovement.balloonJumpMultiplier), (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 afflictionWithConsequence && afflictionWithConsequence.mainAffliction != null && 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_0033: Expected I4, but got O
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected I4, but got O
//IL_002e->IL002e: Incompatible stack types: O vs I4
//IL_0029->IL002e: Incompatible stack types: I4 vs O
//IL_0029->IL002e: Incompatible stack types: O vs I4
//IL_0055->IL0055: Incompatible stack types: O vs I4
//IL_0050->IL0055: Incompatible stack types: I4 vs O
//IL_0050->IL0055: Incompatible stack types: O vs I4
serializer.WriteFloat(delay);
serializer.WriteBool(mainAffliction != null);
object obj = serializer;
Affliction? obj2 = mainAffliction;
int num;
if (obj2 != null)
{
obj = obj2.GetAfflictionType();
num = (int)obj;
}
else
{
num = -1;
obj = num;
num = (int)obj;
}
((BinarySerializer)num).WriteInt((int)obj);
serializer.WriteBool(consequentAffliction != null);
object obj3 = serializer;
Affliction? obj4 = consequentAffliction;
int num2;
if (obj4 != null)
{
obj3 = obj4.GetAfflictionType();
num2 = (int)obj3;
}
else
{
num2 = -1;
obj3 = num2;
num2 = (int)obj3;
}
((BinarySerializer)num2).WriteInt((int)obj3);
Affliction? obj5 = mainAffliction;
if (obj5 != null)
{
obj5.Serialize(serializer);
}
Affliction? obj6 = consequentAffliction;
if (obj6 != null)
{
obj6.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)
{
}
}
}