Decompiled source of Badges For Bobas Hats v0.1.2

BadgesForBobasHats.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Badges_for_Bobas_Hats.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreBadges;
using UnityEngine;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Badges_for_Bobas_Hats
{
	public class AchievementFlagManager
	{
		public static bool HasConsumedRed;

		public static bool HasConsumedOrange;

		public static bool HasConsumedYellow;

		public static bool HasConsumedGreen;

		public static bool HasConsumedBlue;

		public static bool HasConsumedPurple;

		public static bool HasConsumedPink;

		public static bool HasConsumedNaturalFood;

		public static bool HasHealedThisGame;

		static AchievementFlagManager()
		{
			HasConsumedRed = false;
			HasConsumedOrange = false;
			HasConsumedYellow = false;
			HasConsumedGreen = false;
			HasConsumedBlue = false;
			HasConsumedPurple = false;
			HasConsumedPink = false;
			HasConsumedNaturalFood = false;
			HasHealedThisGame = false;
			GlobalEvents.OnSomeoneWonRun = (Action)Delegate.Combine(GlobalEvents.OnSomeoneWonRun, new Action(UnlockWinBasedAchievements));
			GlobalEvents.OnRunEnded = (Action)Delegate.Combine(GlobalEvents.OnRunEnded, new Action(ResetAchievementFlags));
		}

		private static void ResetAchievementFlags()
		{
			FieldInfo[] fields = typeof(AchievementFlagManager).GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.FieldType == typeof(bool))
				{
					fieldInfo.SetValue(null, false);
				}
			}
		}

		private static void UnlockWinBasedAchievements()
		{
			if (!HasConsumedNaturalFood)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Mustard", 1);
			}
		}
	}
	public static class BadgeNames
	{
		public const string BadgePrefix = "Badge_Badges_For_Bobas_Hats_";

		public const string BoingBadge = "Badge_Badges_For_Bobas_Hats_Boing";

		public const string BoingBadge2 = "Badge_Badges_For_Bobas_Hats_Boing_2";

		public const string BoingBadge3 = "Badge_Badges_For_Bobas_Hats_Boing_3";

		public const string BoingBadge4 = "Badge_Badges_For_Bobas_Hats_Boing_4";

		public const string BoingBadge5 = "Badge_Badges_For_Bobas_Hats_Boing_5";

		public const string BoingBadge6 = "Badge_Badges_For_Bobas_Hats_Boing_6";

		public const string BoingBadge7 = "Badge_Badges_For_Bobas_Hats_Boing_7";

		public const string BoingBadge8 = "Badge_Badges_For_Bobas_Hats_Boing_8";

		public const string BoingBadge9 = "Badge_Badges_For_Bobas_Hats_Boing_9";

		public const string ToastBadge = "Badge_Badges_For_Bobas_Hats_Toast";

		public const string MagicBeanVineBadge = "Badge_Badges_For_Bobas_Hats_Magic_Bean_Vine";

		public const string BearBadge = "Badge_Badges_For_Bobas_Hats_Bear";

		public const string DiscoBadge = "Badge_Badges_For_Bobas_Hats_Disco";

		public const string JamiroBadge = "Badge_Badges_For_Bobas_Hats_Jamiro";

		public const string RainbowBadge = "Badge_Badges_For_Bobas_Hats_Rainbow";

		public const string MustardBadge = "Badge_Badges_For_Bobas_Hats_Mustard";

		public const string PenguinBadge = "Badge_Badges_For_Bobas_Hats_Penguin";

		public const string ChairBadge = "Badge_Badges_For_Bobas_Hats_Chair";

		public const string BowBadge = "Badge_Badges_For_Bobas_Hats_Bow";
	}
	public static class BadgeRegistry
	{
		private static readonly Texture2D PlaceholderBadgeIcon = Texture2D.whiteTexture;

		private static Dictionary<string, Texture2D> _badgeIcons = new Dictionary<string, Texture2D>();

		public static void Init()
		{
			LoadBadgeResources();
			RegisterBadges();
		}

		private static List<string> CreateFakeLocalisations(string badgeInfo)
		{
			int num = 13;
			List<string> list = new List<string>();
			for (int i = 0; i < num; i++)
			{
				list.Add(badgeInfo);
			}
			return list;
		}

		private static void RegisterBadges()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Expected O, but got Unknown
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Expected O, but got Unknown
			RegisterLabubuBadges();
			Texture2D val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Toast"];
			CustomBadge val2 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Toast", "YOU'RE TOAST!", "Singed to the absolute max.", CreateFakeLocalisations("YOU'RE TOAST!"), CreateFakeLocalisations("Singed to the absolute max."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val2, "Boba_toast");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Magic_Bean_Vine"];
			CustomBadge val3 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Magic_Bean_Vine", "GREEN THUMB!", "Grow a magical vine.", CreateFakeLocalisations("GREEN THUMB!"), CreateFakeLocalisations("You traded the family cow for what??"), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val3, "Boba_sprout");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Bear"];
			CustomBadge val4 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Bear", "MMM HONEY!", "Consume the nectar of the gods.", CreateFakeLocalisations("MMM HONEY!"), CreateFakeLocalisations("Consume the nectar of the gods."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val4, "Boba_bear");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Disco"];
			CustomBadge val5 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Disco", "SCOUT RAVE!", "Dance at an epic performance.", CreateFakeLocalisations("SCOUT RAVE!"), CreateFakeLocalisations("Dance at an epic performance."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val5, "Boba_disco");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Jamiro"];
			CustomBadge val6 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Jamiro", "VIRTUAL INSANITY!", "Move like magic with your arm out.", CreateFakeLocalisations("VIRTUAL INSANITY!"), CreateFakeLocalisations("Move like magic with your arm out."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val6, "Boba_jamiro_hat");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Rainbow"];
			CustomBadge val7 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Rainbow", "TASTE THE RAINBOW!", "Eat a rainbow of fruit.", CreateFakeLocalisations("TASTE THE RAINBOW!"), CreateFakeLocalisations("Eat a rainbow of fruit."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val7, "Boba_knit_rainbow");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Mustard"];
			CustomBadge val8 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Mustard", "HEALTH ADVERSE!", "Fruit and veg? Over your dead body.", CreateFakeLocalisations("HEALTH ADVERSE!"), CreateFakeLocalisations("Fruit and veg? Over your dead body."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val8, "Boba_mustard");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Penguin"];
			CustomBadge val9 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Penguin", "CHILLY!", "It's a bit nippy out isn't it?", CreateFakeLocalisations("CHILLY!"), CreateFakeLocalisations("It's a bit nippy out isn't it?"), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val9, "Boba_penguin");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Chair"];
			CustomBadge val10 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Chair", "ETERNAL SIT!", "Be carried into the afterlife.", CreateFakeLocalisations("ETERNAL SIT!"), CreateFakeLocalisations("Be carried into the afterlife."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val10, "Boba_chair_hat");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Bow"];
			CustomBadge val11 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Bow", "SUCH A CUTIE!", "Give the bestest boys some pets.", CreateFakeLocalisations("SUCH A CUTIE!"), CreateFakeLocalisations("Give the bestest furballs some pets."), val, 1, true, false);
			MoreBadgesPlugin.RegisterBadge(val11, "Boba_bow");
		}

		private static void LoadBadgeResources()
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			string[] array = manifestResourceNames;
			foreach (string text in array)
			{
				Plugin.Logger.LogInfo((object)("Trying to load resource: " + text));
				if (!text.EndsWith(".png") || !text.Contains(".Resources."))
				{
					continue;
				}
				using Stream stream = executingAssembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					Plugin.Logger.LogError((object)("Failed to load resource: " + text));
					continue;
				}
				byte[] array2 = new byte[stream.Length];
				stream.Read(array2, 0, array2.Length);
				string text2 = "Badge_Badges_For_Bobas_Hats_" + text.Split('.')[^2];
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				ImageConversion.LoadImage(val, array2);
				_badgeIcons[text2] = val;
				Plugin.Logger.LogInfo((object)$"Loaded embedded badge texture {text2} ({((Texture)val).width}x{((Texture)val).height})");
			}
		}

		private static void RegisterLabubuBadges()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected O, but got Unknown
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Expected O, but got Unknown
			Texture2D val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing"];
			CustomBadge val2 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing", "BOING!", "Jump 50 times.", CreateFakeLocalisations("BOING!"), CreateFakeLocalisations("Jump 50 times."), val, 50, false, false);
			MoreBadgesPlugin.RegisterBadge(val2, "Boba_labubu");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_2"];
			CustomBadge val3 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_2", "BOING... AGAIN?!", "Jump 250 times.", CreateFakeLocalisations("BOING... AGAIN?!"), CreateFakeLocalisations("Jump 250 times."), val, 250, false, false);
			MoreBadgesPlugin.RegisterBadge(val3, "Boba_labubu_blue");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_3"];
			CustomBadge val4 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_3", "BOING... AGAIN AGAIN?!", "Jump 500 times.", CreateFakeLocalisations("BOING... AGAIN AGAIN?!"), CreateFakeLocalisations("Jump 500 times."), val, 500, false, false);
			MoreBadgesPlugin.RegisterBadge(val4, "Boba_labubu_cyan");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_4"];
			CustomBadge val5 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_4", "BOING... AGAIN AGAIN AGAIN?!", "Jump 1000 times.", CreateFakeLocalisations("BOING... AGAIN AGAIN AGAIN?!"), CreateFakeLocalisations("Jump 1000 times."), val, 1000, false, false);
			MoreBadgesPlugin.RegisterBadge(val5, "Boba_labubu_green");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_5"];
			CustomBadge val6 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_5", "BOING... DON'T YOU GET TIRED?!", "Jump 2000 times.", CreateFakeLocalisations("BOING... DON'T YOU GET TIRED?!"), CreateFakeLocalisations("Jump 2000 times."), val, 2000, false, false);
			MoreBadgesPlugin.RegisterBadge(val6, "Boba_labubu_orange");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_6"];
			CustomBadge val7 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_6", "BOING... YOU REALLY LIKE JUMPING!", "Jump 3000 times.", CreateFakeLocalisations("BOING... YOU REALLY LIKE JUMPING!"), CreateFakeLocalisations("Jump 3000 times."), val, 3000, false, false);
			MoreBadgesPlugin.RegisterBadge(val7, "Boba_labubu_pink");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_7"];
			CustomBadge val8 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_7", "BOING.. WOW YOU DON'T STOP!", "Jump 5000 times.", CreateFakeLocalisations("BOING.. WOW YOU DON'T STOP!"), CreateFakeLocalisations("Jump 5000 times."), val, 5000, false, false);
			MoreBadgesPlugin.RegisterBadge(val8, "Boba_labubu_purple");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_8"];
			CustomBadge val9 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_8", "BOING... BASICALLY A RABIT!", "Jump 7500 times.", CreateFakeLocalisations("BOING... BASICALLY A RABIT!"), CreateFakeLocalisations("Jump 7500 times."), val, 7500, false, false);
			MoreBadgesPlugin.RegisterBadge(val9, "Boba_labubu_red");
			val = _badgeIcons["Badge_Badges_For_Bobas_Hats_Boing_9"];
			CustomBadge val10 = new CustomBadge("Badge_Badges_For_Bobas_Hats_Boing_9", "BOING... YOU'VE JUMPED HOW MANY TIMES?!", "Jump 10000 times.", CreateFakeLocalisations("BOING... YOU'VE JUMPED HOW MANY TIMES?!"), CreateFakeLocalisations("Jump 10000 times."), val, 10000, false, false);
			MoreBadgesPlugin.RegisterBadge(val10, "Boba_labubu_yellow");
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("BadgesForBobasHats", "Badges_for_Bobas_Hats", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private readonly Harmony _harmony = new Harmony("BadgesForBobasHats");

		public const string Id = "BadgesForBobasHats";

		public static string Name => "Badges_for_Bobas_Hats";

		public static string Version => "0.1.0";

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)("Plugin " + Name + " is loaded!"));
			BadgeRegistry.Init();
			Logger.LogInfo((object)"Badges for Bobas Hats are loaded!");
			_harmony.PatchAll(typeof(CharacterOnJumpPatch));
			_harmony.PatchAll(typeof(CharacterAfflictionsAddStatusPatch));
			_harmony.PatchAll(typeof(MagicBeanGrowVineRPCPatch));
			_harmony.PatchAll(typeof(ActionRestoreHungerRunActionPatch));
			_harmony.PatchAll(typeof(CharacterAnimationsRPCAPlayRemove));
			_harmony.PatchAll(typeof(BugleSFXRPCStartTootPatch));
			_harmony.PatchAll(typeof(BugleSFXRPCEndTootPatch));
			_harmony.PatchAll(typeof(PlayerMoveZoneAddForceToCharacterPatch));
			_harmony.PatchAll(typeof(BodypartOnCollisionEnterPatch));
			_harmony.PatchAll(typeof(CharacterRPCADiePatch));
		}
	}
}
namespace Badges_for_Bobas_Hats.Patches
{
	public class ActionRestoreHungerRunActionPatch
	{
		private const int HoneycombItemID = 38;

		[HarmonyPatch(typeof(Action_RestoreHunger), "RunAction")]
		[HarmonyPostfix]
		private static void Postfix(Action_RestoreHunger __instance)
		{
			if (((ItemActionBase)__instance).item.itemID == 38)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Bear", 1);
			}
			if (!MoreBadgesPlugin.GetCustomBadgeStatus("Badge_Badges_For_Bobas_Hats_Rainbow").isUnlocked)
			{
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("red"))
				{
					AchievementFlagManager.HasConsumedRed = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("orange"))
				{
					AchievementFlagManager.HasConsumedOrange = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("yellow"))
				{
					AchievementFlagManager.HasConsumedYellow = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("green"))
				{
					AchievementFlagManager.HasConsumedGreen = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("blue"))
				{
					AchievementFlagManager.HasConsumedBlue = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("purple"))
				{
					AchievementFlagManager.HasConsumedPurple = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("pink"))
				{
					AchievementFlagManager.HasConsumedPink = true;
				}
				Plugin.Logger.LogInfo((object)($"Red {AchievementFlagManager.HasConsumedRed} Orange {AchievementFlagManager.HasConsumedOrange} Yellow {AchievementFlagManager.HasConsumedYellow}" + $"Green {AchievementFlagManager.HasConsumedGreen} Blue {AchievementFlagManager.HasConsumedBlue} Purple {AchievementFlagManager.HasConsumedPurple}" + $"Pink {AchievementFlagManager.HasConsumedPink}"));
				if (AchievementFlagManager.HasConsumedRed && AchievementFlagManager.HasConsumedOrange && AchievementFlagManager.HasConsumedYellow && AchievementFlagManager.HasConsumedGreen && AchievementFlagManager.HasConsumedBlue && AchievementFlagManager.HasConsumedPurple && AchievementFlagManager.HasConsumedPink)
				{
					MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Rainbow", 1);
				}
			}
			if (!MoreBadgesPlugin.GetCustomBadgeStatus("Badge_Badges_For_Bobas_Hats_Mustard").isUnlocked)
			{
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("coconut"))
				{
					AchievementFlagManager.HasConsumedNaturalFood = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("berry"))
				{
					AchievementFlagManager.HasConsumedNaturalFood = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("root"))
				{
					AchievementFlagManager.HasConsumedNaturalFood = true;
				}
				if (((Object)((ItemActionBase)__instance).item).name.ToLower().Contains("shroom"))
				{
					AchievementFlagManager.HasConsumedNaturalFood = true;
				}
				Plugin.Logger.LogInfo((object)$"Anti-naturalist: {AchievementFlagManager.HasConsumedNaturalFood}");
			}
		}
	}
	public class BodypartOnCollisionEnterPatch
	{
		[HarmonyPatch(typeof(Bodypart), "OnCollisionEnter")]
		[HarmonyPostfix]
		private static void Postfix(Bodypart __instance, Collision collision)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)__instance.partType != 8 || !__instance.character.input.useSecondaryIsPressed)
			{
				return;
			}
			Transform val = ((Component)collision.collider).transform;
			while ((Object)(object)val != (Object)null)
			{
				if (((Object)val).name.StartsWith("Capybara"))
				{
					MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Bow", 1);
					break;
				}
				val = val.parent;
			}
		}
	}
	public class BugleSFXRPCEndTootPatch
	{
		[HarmonyPatch(typeof(BugleSFX), "RPC_EndToot")]
		[HarmonyPostfix]
		private static void Postfix(BugleSFX __instance)
		{
			BugleSFXRPCStartTootPatch.BuglesPlaying--;
		}
	}
	public class BugleSFXRPCStartTootPatch
	{
		public static int BuglesPlaying;

		[HarmonyPatch(typeof(BugleSFX), "RPC_StartToot")]
		[HarmonyPostfix]
		private static void Postfix(BugleSFX __instance)
		{
			BuglesPlaying++;
			Plugin.Logger.LogInfo((object)$"Toot happened at: {Time.time} Dance time: {CharacterAnimationsRPCAPlayRemove.EmoteTime}");
			if (CharacterAnimationsRPCAPlayRemove.EmoteTime + 3f >= Time.time)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Disco", 1);
			}
		}
	}
	public class CharacterAfflictionsAddStatusPatch
	{
		[HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")]
		[HarmonyPostfix]
		private static void Postfix(CharacterAfflictions __instance, STATUSTYPE statusType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Expected I4, but got Unknown
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			int num = (int)statusType;
			if ((int)statusType == 8)
			{
				if (__instance.currentStatuses[num] >= 1f)
				{
					MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Toast", 1);
				}
			}
			else if ((int)statusType == 2 && __instance.currentStatuses[num] >= 1f)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Penguin", 1);
			}
		}
	}
	public class CharacterAnimationsRPCAPlayRemove
	{
		public static float EmoteTime;

		[HarmonyPatch(typeof(CharacterAnimations), "RPCA_PlayRemove")]
		[HarmonyPostfix]
		private static void Postfix(BugleSFX __instance, string emoteName)
		{
			EmoteTime = Time.time;
			Plugin.Logger.LogInfo((object)$"Dance happened at: {EmoteTime}");
			if (BugleSFXRPCStartTootPatch.BuglesPlaying > 0 && emoteName.Equals("A_Scout_Emote_Dance1"))
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Disco", 1);
			}
		}
	}
	public class CharacterOnJumpPatch
	{
		[HarmonyPatch(typeof(Character), "OnJump")]
		[HarmonyPostfix]
		private static void Postfix(Character __instance)
		{
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_2", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_3", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_4", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_5", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_6", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_7", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_8", 1);
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Boing_9", 1);
		}
	}
	public class CharacterRPCADiePatch
	{
		[HarmonyPatch(typeof(Character), "RPCA_Die")]
		[HarmonyPrefix]
		private static void Prefix(Character __instance)
		{
			if (__instance.data.isCarried)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Chair", 1);
			}
		}
	}
	public class MagicBeanGrowVineRPCPatch
	{
		[HarmonyPatch(typeof(MagicBean), "GrowVineRPC")]
		[HarmonyPostfix]
		private static void Postfix()
		{
			MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Magic_Bean_Vine", 1);
		}
	}
	public class PlayerMoveZoneAddForceToCharacterPatch
	{
		private static float _startTime = 0f;

		private static float _lastTime = 0f;

		private static readonly float DurationRequired = 5f;

		[HarmonyPatch(typeof(PlayerMoveZone), "AddForceToCharacter")]
		[HarmonyPostfix]
		private static void Postfix(PlayerMoveZone __instance)
		{
			if (Time.time - _lastTime > 1f)
			{
				_startTime = Time.time;
			}
			if (Character.localCharacter.input.useSecondaryIsPressed)
			{
				_lastTime = Time.time;
			}
			if (_lastTime - _startTime > DurationRequired)
			{
				MoreBadgesPlugin.AddProgress("Badge_Badges_For_Bobas_Hats_Jamiro", 1);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}