using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 BetterVisualCues;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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("SuperKeith333.BetterVisualCues")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("SuperKeith333.BetterVisualCues")]
[assembly: AssemblyTitle("BetterVisualCues")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
}
public class AirlinefoodPatch : ItemPatch
{
public override string ItemName => "Airplane Food";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Airline Food") == (Object)null)
{
MeshRegistry.SetOriginal("Airline Food", ((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
if (__instance.castProgress > 0.25f && ((Component)__instance.transform.Find("airplane food (1)/plastic")).gameObject.activeInHierarchy)
{
((Component)__instance.transform.Find("airplane food (1)/plastic")).gameObject.SetActive(false);
}
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Airlinefood_Eat_2"))
{
((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Airlinefood_Eat_2");
__instance.transform.Find("airplane food (1)").localRotation = Quaternion.Euler(270.41f, 0f, 0f);
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Airlinefood_Eat_3"))
{
((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Airlinefood_Eat_3");
__instance.transform.Find("airplane food (1)").localRotation = Quaternion.Euler(270.41f, 0f, 0f);
}
}
public override void CancelUsed(Item __instance)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
((Component)__instance.transform.Find("airplane food (1)/plastic")).gameObject.SetActive(true);
((Component)__instance.transform.Find("airplane food (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Airline Food");
__instance.transform.Find("airplane food (1)").localRotation = Quaternion.Euler(323.41f, 180f, 90f);
}
}
public class AntiZookaPatch : ItemPatch
{
public override string ItemName => "AntiZooka";
public override void Created(Item __instance)
{
//IL_0075: 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)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
((Component)__instance.transform.Find("Anti-Zooka")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Anti_Zooka_New");
if (__instance.HasData((DataEntryKey)2))
{
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 3)
{
Transform val = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val.localPosition = new Vector3(-0.017f, 2.5f, 0.125f);
val.localRotation = Quaternion.identity;
((Object)val).name = "AmmoSphere";
}
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value >= 2)
{
Transform val2 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val2.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val2.localPosition = new Vector3(-0.017f, 2.91f, 0.15f);
val2.localRotation = Quaternion.identity;
((Object)val2).name = "AmmoSphere";
}
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value >= 1)
{
Transform val3 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val3.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val3.localPosition = new Vector3(-0.017f, 3.27f, 0.125f);
val3.localRotation = Quaternion.identity;
((Object)val3).name = "AmmoSphere";
}
}
}
public override void UsedFinished(Item __instance)
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < __instance.transform.Find("Anti-Zooka/Shell").childCount; i++)
{
if (((Object)__instance.transform.Find("Anti-Zooka/Shell").GetChild(i)).name == "AmmoSphere")
{
Object.Destroy((Object)(object)((Component)__instance.transform.Find("Anti-Zooka/Shell").GetChild(i)).gameObject);
}
}
if (__instance.HasData((DataEntryKey)2))
{
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 3)
{
Transform val = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val.localPosition = new Vector3(-0.017f, 2.5f, 0.125f);
val.localRotation = Quaternion.identity;
((Object)val).name = "AmmoSphere";
}
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value >= 2)
{
Transform val2 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val2.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val2.localPosition = new Vector3(-0.017f, 2.91f, 0.15f);
val2.localRotation = Quaternion.identity;
((Object)val2).name = "AmmoSphere";
}
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value >= 1)
{
Transform val3 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val3.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val3.localPosition = new Vector3(-0.017f, 3.27f, 0.125f);
val3.localRotation = Quaternion.identity;
((Object)val3).name = "AmmoSphere";
}
}
}
public override void ItemDataUpdate(ItemInstanceData instanceData, Item __instance)
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < __instance.transform.Find("Anti-Zooka/Shell").childCount; i++)
{
if (((Object)__instance.transform.Find("Anti-Zooka/Shell").GetChild(i)).name == "AmmoSphere")
{
Object.Destroy((Object)(object)((Component)__instance.transform.Find("Anti-Zooka/Shell").GetChild(i)).gameObject);
}
}
if (instanceData.HasData((DataEntryKey)2))
{
if (((OptionableIntItemData)instanceData.data[(DataEntryKey)2]).Value == 3)
{
Transform val = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val.localPosition = new Vector3(-0.017f, 2.5f, 0.125f);
val.localRotation = Quaternion.identity;
((Object)val).name = "AmmoSphere";
}
if (((OptionableIntItemData)instanceData.data[(DataEntryKey)2]).Value >= 2)
{
Transform val2 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val2.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val2.localPosition = new Vector3(-0.017f, 2.91f, 0.15f);
val2.localRotation = Quaternion.identity;
((Object)val2).name = "AmmoSphere";
}
if (((OptionableIntItemData)instanceData.data[(DataEntryKey)2]).Value >= 1)
{
Transform val3 = Object.Instantiate<Transform>(__instance.transform.Find("Anti-Zooka/Shell/AntiSphere"), __instance.transform.Find("Anti-Zooka/Shell"));
val3.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val3.localPosition = new Vector3(-0.017f, 3.27f, 0.125f);
val3.localRotation = Quaternion.identity;
((Object)val3).name = "AmmoSphere";
}
}
}
}
public class BerrynanaPatch : ItemPatch
{
public override string ItemName => "Berrynana";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Berrynana") == (Object)null)
{
MeshRegistry.SetOriginal("Berrynana", ((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
if (__instance.castProgress > 0.5f && ((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials.Length == 1)
{
((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Berrynana_Eat_2");
List<Material> list = ((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials.ToList();
Material item = null;
if (((Object)__instance).name.StartsWith("Berrynana Blue"))
{
item = MaterialRegistry.GetMaterial("M_BananaBlue_Inside");
}
else if (((Object)__instance).name.StartsWith("Berrynana Yellow"))
{
item = MaterialRegistry.GetMaterial("M_Banana_Inside");
}
else if (((Object)__instance).name.StartsWith("Berrynana Brown"))
{
item = MaterialRegistry.GetMaterial("M_BananaBrown_Inside");
}
else if (((Object)__instance).name.StartsWith("Berrynana Pink"))
{
item = MaterialRegistry.GetMaterial("M_BananaPink_Inside");
}
list.Add(item);
list.Add(((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials[0]);
list[0] = list[1];
((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).sharedMaterials = list.ToArray();
((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials = list.ToArray();
__instance.transform.Find("Bananna Berry (1)").localPosition = new Vector3(-0.046f, -0.149f, -0.022f);
__instance.transform.Find("Bananna Berry (1)/Leaves.002").localPosition = new Vector3(-0.0265f, -0.0117f, 0.1f);
}
}
public override void CancelUsed(Item __instance)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)__instance).name.Contains("Peel") && ((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials.Length >= 3)
{
__instance.transform.Find("Bananna Berry (1)/Leaves.002").localPosition = new Vector3(-0.0265f, -0.0117f, 0f);
((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Berrynana");
List<Material> list = new List<Material>();
list.Add(((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials[2]);
((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).materials = list.ToArray();
((Renderer)((Component)__instance.transform.Find("Bananna Berry (1)")).GetComponent<MeshRenderer>()).sharedMaterials = list.ToArray();
__instance.transform.Find("Bananna Berry (1)").localPosition = new Vector3(-0.046f, -0.049f, -0.022f);
}
}
}
public class BugleShroom : ItemPatch
{
public override string ItemName => "Mushroom Lace(";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Bugle Shroom") == (Object)null)
{
MeshRegistry.SetOriginal("Bugle Shroom", ((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Eat_2");
}
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Eat_3");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Eat_4"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Eat_4");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Bugle Shroom");
}
}
public class BugleShroomPoison : ItemPatch
{
public override string ItemName => "Mushroom Lace Poison";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Bugle Shroom Poison") == (Object)null)
{
MeshRegistry.SetOriginal("Bugle Shroom Poison", ((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Poison_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Poison_Eat_2");
}
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Poison_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Poison_Eat_3");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Bugle_Shroom_Poison_Eat_4"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Bugle_Shroom_Poison_Eat_4");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Bugle Shroom Poison");
}
}
public class ButtonShroom : ItemPatch
{
public override string ItemName => "Mushroom Normie(";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Button Shroom") == (Object)null)
{
MeshRegistry.SetOriginal("Button Shroom", ((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Eat_2");
}
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Eat_3");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Eat_4"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Eat_4");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Button Shroom");
}
}
public class ButtonShroomPoison : ItemPatch
{
public override string ItemName => "Mushroom Normie Poison";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Button Shroom Poison") == (Object)null)
{
MeshRegistry.SetOriginal("Button Shroom Poison", ((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Poison_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Poison_Eat_2");
}
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Poison_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Poison_Eat_3");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Button_Shroom_Poison_Eat_4"))
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Button_Shroom_Poison_Eat_4");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Normie (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Button Shroom Poison");
}
}
public class ChickenPatch : ItemPatch
{
public override string ItemName => "EggTurkey";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Chicken") == (Object)null)
{
MeshRegistry.SetOriginal("Chicken", ((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Chicken_Eat_2"))
{
((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Chicken_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Chicken_Eat_3"))
{
((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Chicken_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Chicken")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Chicken");
}
}
public class ChubbyShroom : ItemPatch
{
public override string ItemName => "Mushroom Chubby";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Chubby Shroom") == (Object)null)
{
MeshRegistry.SetOriginal("Chubby Shroom", ((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Chubby_Shroom_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Chubby_Shroom_Eat_2");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Chubby")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Chubby Shroom");
}
}
public class ClusterberryPatch : ItemPatch
{
public override string ItemName => "Clusterberry";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Clusterberry") == (Object)null)
{
if (!((Object)__instance).name.Contains("Red"))
{
MeshRegistry.SetOriginal("Clusterberry", ((Component)__instance.transform.Find("Cluster Berry (1)")).GetComponent<MeshFilter>().sharedMesh);
}
else
{
MeshRegistry.SetOriginal("Clusterberry", ((Component)__instance.transform.Find("Raspberry)")).GetComponent<MeshFilter>().sharedMesh);
}
}
}
public override void BeingUsed(Item __instance)
{
if (!((Object)__instance).name.Contains("Red"))
{
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Cluster Berry (1)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("ClusterBerry_Eat_2"))
{
((Component)__instance.transform.Find("Cluster Berry (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("ClusterBerry_Eat_2");
}
}
else if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("Raspberry")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("ClusterBerry_Eat_2"))
{
((Component)__instance.transform.Find("Raspberry")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("ClusterBerry_Eat_2");
}
}
public override void CancelUsed(Item __instance)
{
if (!((Object)__instance).name.Contains("Red"))
{
((Component)__instance.transform.Find("Cluster Berry (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Clusterberry");
}
else
{
((Component)__instance.transform.Find("Raspberry")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Clusterberry");
}
}
}
public class ClusterShroom : ItemPatch
{
public override string ItemName => "Mushroom Cluster(";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Cluster Shroom") == (Object)null)
{
MeshRegistry.SetOriginal("Cluster Shroom", ((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Cluster_Shroom_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Cluster_Shroom_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Cluster_Shroom_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Cluster_Shroom_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Cluster Shroom");
}
}
public class ClusterShroomPoison : ItemPatch
{
public override string ItemName => "Mushroom Cluster Poison";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Cluster Shroom Poison") == (Object)null)
{
MeshRegistry.SetOriginal("Cluster Shroom Poison", ((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Cluster_Shroom_Poison_Eat_2"))
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Cluster_Shroom_Poison_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Cluster_Shroom_Poison_Eat_3"))
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Cluster_Shroom_Poison_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Mushroom Cluster")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Cluster Shroom Poison");
}
}
public class CureAllPatch : ItemPatch
{
public override string ItemName => "Cure-All";
public override void Created(Item __instance)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if (__instance.HasData((DataEntryKey)2))
{
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 2)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_2_Uses");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
else if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 1)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_1_Use");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
}
}
public override void UsedFinished(Item __instance)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if (__instance.HasData((DataEntryKey)2))
{
if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 2)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_2_Uses");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
else if (__instance.GetData<OptionableIntItemData>((DataEntryKey)2).Value == 1)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_1_Use");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
}
}
public override void ItemDataUpdate(ItemInstanceData instanceData, Item __instance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
if (instanceData.HasData((DataEntryKey)2))
{
if (((OptionableIntItemData)instanceData.data[(DataEntryKey)2]).Value == 2)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_2_Uses");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
else if (((OptionableIntItemData)instanceData.data[(DataEntryKey)2]).Value == 1)
{
((Component)__instance.transform.Find("Jug/Jug (1)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("CureAll_1_Use");
__instance.transform.Find("Jug/Jug (1)").localPosition = new Vector3(0f, 0f, -1f);
}
}
}
}
public class EggPatch : ItemPatch
{
public override string ItemName => "Egg(";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Egg") == (Object)null)
{
MeshRegistry.SetOriginal("Egg", ((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Egg_Eat_2"))
{
((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Egg_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Egg_Eat_3"))
{
((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Egg_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Egg_SunnySideUp")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Egg");
}
}
public class FrogLegs : ItemPatch
{
public override string ItemName => "FrogLegs";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Frog Legs") == (Object)null)
{
MeshRegistry.SetOriginal("Frog Legs", ((Component)__instance.transform.Find("FrogLegs (1)/FrogLegsGreen")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.5f && (Object)(object)((Component)__instance.transform.Find("FrogLegs (1)/FrogLegsGreen")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Frog_Legs_Eat_2"))
{
((Component)__instance.transform.Find("FrogLegs (1)/FrogLegsGreen")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Frog_Legs_Eat_2");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("FrogLegs (1)/FrogLegsGreen")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Frog Legs");
}
}
public class GranolaBar : ItemPatch
{
public override string ItemName => "Granola Bar";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Granola Bar") == (Object)null)
{
MeshRegistry.SetOriginal("Granola Bar", ((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Granola_Bar_Eat_2"))
{
((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Granola_Bar_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Granola_Bar_Eat_3"))
{
((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Granola_Bar_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("GranolaBar")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Granola Bar");
}
}
public class ItemPatch
{
public virtual string ItemName => "";
public virtual void Created(Item __instance)
{
}
public virtual void BeingUsed(Item __instance)
{
}
public virtual void UsedFinished(Item __instance)
{
}
public virtual void CancelUsed(Item __instance)
{
}
public virtual void ItemDataUpdate(ItemInstanceData instanceData, Item __instance)
{
}
}
public class LollipopPatch : ItemPatch
{
public override string ItemName => "Lollipop";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Lollipop") == (Object)null)
{
MeshRegistry.SetOriginal("Lollipop", ((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Lollipop_Eat_2"))
{
((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Lollipop_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Lollipop_Eat_3"))
{
((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Lollipop_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Lollipop/Cube")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Lollipop");
}
}
public class Prickleberry : ItemPatch
{
public override string ItemName => "Prickleberry";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Prickleberry") == (Object)null)
{
MeshRegistry.SetOriginal("Prickleberry", ((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Prickleberry_Eat_2"))
{
((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Prickleberry_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Prickleberry_Eat_3"))
{
((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Prickleberry_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Prickleberry (3)")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Prickleberry");
}
}
public class ShroomberryPatch : ItemPatch
{
public override string ItemName => "Shroomberry";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Shroomberry") == (Object)null)
{
MeshRegistry.SetOriginal("Shroomberry", ((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Shroomberry_Eat_2"))
{
((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Shroomberry_Eat_2");
((Component)__instance.transform.Find("shroomberry/Leaves.001 (1)")).gameObject.SetActive(false);
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Shroomberry_Eat_3"))
{
((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Shroomberry_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("shroomberry")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Shroomberry");
((Component)__instance.transform.Find("shroomberry/Leaves.001 (1)")).gameObject.SetActive(true);
}
}
public class SmallEggPatch : ItemPatch
{
public override string ItemName => "EggRaven";
public override void Created(Item __instance)
{
if ((Object)(object)MeshRegistry.GetOriginal("Egg") == (Object)null)
{
MeshRegistry.SetOriginal("Egg", ((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh);
}
}
public override void BeingUsed(Item __instance)
{
if (__instance.castProgress > 0.25f && (Object)(object)((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Egg_Eat_2"))
{
((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Egg_Eat_2");
}
if (__instance.castProgress > 0.75f && (Object)(object)((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh != (Object)(object)MeshRegistry.Get("Egg_Eat_3"))
{
((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.Get("Egg_Eat_3");
}
}
public override void CancelUsed(Item __instance)
{
((Component)__instance.transform.Find("Egg_SunnySideUp/Mesh")).GetComponent<MeshFilter>().sharedMesh = MeshRegistry.GetOriginal("Egg");
}
}
[HarmonyPatch(typeof(Item), "ContinueUsePrimary")]
internal static class ItemBeingUsedPatch
{
private static void Prefix(Item __instance)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
ItemPatch itemPatch = (from type in executingAssembly.GetTypes()
where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(ItemPatch))
select Activator.CreateInstance(type)).Cast<ItemPatch>().FirstOrDefault((ItemPatch patch) => ((Object)__instance).name.StartsWith(patch.ItemName));
if (__instance.isUsingPrimary && __instance.usingTimePrimary > 0f)
{
itemPatch?.BeingUsed(__instance);
}
}
}
[HarmonyPatch(typeof(Item), "Start")]
internal static class ItemCreatedPatch
{
private static void Postfix(Item __instance)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
(from type in executingAssembly.GetTypes()
where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(ItemPatch))
select Activator.CreateInstance(type)).Cast<ItemPatch>().FirstOrDefault((ItemPatch patch) => ((Object)__instance).name.StartsWith(patch.ItemName))?.Created(__instance);
}
}
[HarmonyPatch(typeof(Item), "CancelUsePrimary")]
internal static class ItemStopUsedPatch
{
private static void Prefix(Item __instance)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
(from type in executingAssembly.GetTypes()
where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(ItemPatch))
select Activator.CreateInstance(type)).Cast<ItemPatch>().FirstOrDefault((ItemPatch patch) => ((Object)__instance).name.StartsWith(patch.ItemName))?.CancelUsed(__instance);
}
}
[HarmonyPatch(typeof(Item), "SetItemInstanceDataRPC")]
internal static class ItemUpdatePatch
{
private static void Prefix(ItemInstanceData instanceData, Item __instance)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
(from type in executingAssembly.GetTypes()
where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(ItemPatch))
select Activator.CreateInstance(type)).Cast<ItemPatch>().FirstOrDefault((ItemPatch patch) => ((Object)__instance).name.StartsWith(patch.ItemName))?.ItemDataUpdate(instanceData, __instance);
}
}
[HarmonyPatch(typeof(Item), "FinishCastPrimary")]
internal static class ItemUsedPatch
{
private static void Postfix(Item __instance)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
(from type in executingAssembly.GetTypes()
where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(ItemPatch))
select Activator.CreateInstance(type)).Cast<ItemPatch>().FirstOrDefault((ItemPatch patch) => ((Object)__instance).name.StartsWith(patch.ItemName))?.UsedFinished(__instance);
}
}
public static class MaterialRegistry
{
private static readonly Dictionary<string, Material> materials = new Dictionary<string, Material>();
public static void loadMaterialFromItem(string itemName, string materialName)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
GameObject val = Resources.Load<GameObject>("0_Items/" + itemName);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("[Telltale] prefab not found: " + itemName));
return;
}
Material val2 = null;
Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
foreach (Renderer val3 in componentsInChildren)
{
Material[] sharedMaterials = val3.sharedMaterials;
foreach (Material val4 in sharedMaterials)
{
if ((Object)(object)val4 != (Object)null && ((Object)val4).name == materialName)
{
val2 = val4;
}
}
}
materials[materialName] = new Material(val2);
((Object)materials[materialName]).hideFlags = (HideFlags)32;
}
public static Material GetMaterial(string name)
{
if (materials.TryGetValue(name, out Material value) && (Object)(object)value != (Object)null)
{
return value;
}
Plugin.Log.LogWarning((object)("Material not found: " + name));
return null;
}
}
public static class MeshRegistry
{
private static readonly Dictionary<string, Mesh> meshes = new Dictionary<string, Mesh>();
private static readonly Dictionary<string, Mesh> originals = new Dictionary<string, Mesh>();
public static readonly Dictionary<string, Material> materials = new Dictionary<string, Material>();
private static AssetBundle bundle;
public static bool loaded => (Object)(object)bundle != (Object)null;
public static void Init()
{
if (loaded)
{
return;
}
string text = FindBundle("meshes");
if (text == null)
{
Plugin.Log.LogError((object)"Bundle not found: meshes");
return;
}
foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
{
if (((Object)allLoadedAssetBundle).name == "meshes")
{
allLoadedAssetBundle.Unload(true);
}
}
bundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)bundle == (Object)null)
{
Plugin.Log.LogError((object)("Failed to load mesh bundle at " + text));
return;
}
Mesh[] array = bundle.LoadAllAssets<Mesh>();
foreach (Mesh val in array)
{
((Object)val).hideFlags = (HideFlags)32;
meshes[((Object)val).name] = val;
Plugin.Log.LogInfo((object)("Registered mesh: " + ((Object)val).name));
}
}
private static string FindBundle(string fileName)
{
string[] directories = Directory.GetDirectories(Paths.PluginPath, "*", SearchOption.AllDirectories);
foreach (string path in directories)
{
string text = Path.Combine(path, fileName);
if (File.Exists(text))
{
return text;
}
}
string text2 = Path.Combine(Paths.PluginPath, fileName);
if (File.Exists(text2))
{
return text2;
}
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text3 = Path.Combine(directoryName, fileName);
if (!File.Exists(text3))
{
return null;
}
return text3;
}
public static Mesh Get(string name)
{
if (meshes.TryGetValue(name, out Mesh value) && (Object)(object)value != (Object)null)
{
return value;
}
Plugin.Log.LogWarning((object)("Mesh not found: " + name));
return null;
}
public static Mesh GetOriginal(string key)
{
if (originals.TryGetValue(key, out Mesh value) && (Object)(object)value != (Object)null)
{
return value;
}
Plugin.Log.LogWarning((object)("Original Mesh not found: " + key));
return null;
}
public static void SetOriginal(string key, Mesh mesh)
{
originals[key] = mesh;
}
public static void Unload()
{
foreach (Mesh value in meshes.Values)
{
if ((Object)(object)value != (Object)null)
{
((Object)value).hideFlags = (HideFlags)0;
}
}
meshes.Clear();
if ((Object)(object)bundle != (Object)null)
{
bundle.Unload(true);
bundle = null;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
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")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace BetterVisualCues
{
[BepInPlugin("SuperKeith333.BetterVisualCues", "BetterVisualCues", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("SuperKeith333.BetterVisualCues");
public const string Id = "SuperKeith333.BetterVisualCues";
internal static ManualLogSource Log { get; private set; }
public static string Name => "BetterVisualCues";
public static string Version => "0.1.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
MeshRegistry.Init();
MaterialRegistry.loadMaterialFromItem("Berrynana Peel Blue Variant", "M_BananaBlue_Inside");
MaterialRegistry.loadMaterialFromItem("Berrynana Peel Yellow", "M_Banana_Inside");
MaterialRegistry.loadMaterialFromItem("Berrynana Peel Pink Variant", "M_BananaPink_Inside");
MaterialRegistry.loadMaterialFromItem("Berrynana Peel Brown Variant", "M_BananaBrown_Inside");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
private void OnDestroy()
{
MeshRegistry.Unload();
_harmony.UnpatchSelf();
Log.LogInfo((object)("Plugin " + Name + " unloaded!"));
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}