using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BonkBadge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0ef510756e25825637f99f0db830cc3e701ed577")]
[assembly: AssemblyProduct("BonkBadge")]
[assembly: AssemblyTitle("BonkBadge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace BonkBadgeMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.snosz.bonkbadge", "BonkBadge", "0.1.3")]
public class Plugin : BaseUnityPlugin
{
public static class BadgeNames
{
public const string BonkBadge = "Badge_BonkBadge_Bonk";
}
[HarmonyPatch(typeof(CharacterItems), "DropItemRpc")]
public static class DropItemRpcPatch
{
private static bool Prefix(CharacterItems __instance, ItemInstanceData itemInstanceData)
{
if ((Object)(object)__instance.character == (Object)null || !__instance.character.IsLocal)
{
return true;
}
if ((Object)(object)__instance.character.data.currentItem != (Object)null && __instance.character.data.currentItem.itemID == 36)
{
Instance.thrownCoconutID = itemInstanceData.guid;
}
return true;
}
}
[HarmonyPatch(typeof(Bonkable), "Bonk")]
public static class BonkPatch
{
private static void Postfix(Bonkable __instance, Collision coll)
{
Character componentInParent = coll.gameObject.GetComponentInParent<Character>();
Item val = default(Item);
if (!((Object)(object)componentInParent == (Object)null) && componentInParent.IsLocal && ((Component)__instance).gameObject.TryGetComponent<Item>(ref val))
{
Guid guid = val.data.guid;
Guid? thrownCoconutID = Instance.thrownCoconutID;
if (guid == thrownCoconutID)
{
MoreBadgesPlugin.AddProgress("Badge_BonkBadge_Bonk", 1);
Instance.thrownCoconutID = null;
}
}
}
}
public static Plugin Instance;
private static Harmony _harmony;
public Guid? thrownCoconutID;
private AssetBundle iconBundle;
private AssetBundle badgesBundle;
private void Awake()
{
Instance = this;
_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.snosz.bonkbadge");
byte[] custombadges = Resource1.custombadges;
badgesBundle = AssetBundle.LoadFromMemory(custombadges);
MoreBadgesPlugin.RegisterBadgeAssetBundle(badgesBundle, Assembly.GetExecutingAssembly().Location);
}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resource1
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("BonkBadgeMod.Resource1", typeof(Resource1).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] badges
{
get
{
object @object = ResourceManager.GetObject("badges", resourceCulture);
return (byte[])@object;
}
}
internal static byte[] custombadges
{
get
{
object @object = ResourceManager.GetObject("custombadges", resourceCulture);
return (byte[])@object;
}
}
internal Resource1()
{
}
}
}