using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using FrooxEngine;
using FrooxEngine.CommonAvatar;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("art0007i")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+2a0f91a43b619814aea22bea11ec83531847705d")]
[assembly: AssemblyProduct("BadgeRemover")]
[assembly: AssemblyTitle("BadgeRemover")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/BadgeRemover")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace BadgeRemover;
[ResonitePlugin("art0007i.BadgeRemover", "BadgeRemover", "0.1.0", "art0007i", "https://github.com/art0007i/BadgeRemover")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
[HarmonyPatch(typeof(AvatarManager), "AddBadgeTemplate")]
public class GlobalBadgeRemover
{
public static bool Prefix(Slot template)
{
if (!DisableForEveryone.Value)
{
return true;
}
template.Destroy();
return false;
}
}
[HarmonyPatch(typeof(UserRoot), "OnCommonUpdate")]
public class LocalBadgeRemover
{
public static void Postfix(Slot ____localNameplate)
{
if (____localNameplate != null)
{
____localNameplate.ForeachComponentInChildren<AvatarBadgeManager>((Action<AvatarBadgeManager>)delegate(AvatarBadgeManager x)
{
((Component)x).Slot.ActiveSelf = !DisableLocally.Value;
}, false, false);
}
}
}
internal static ManualLogSource Log;
internal static ConfigEntry<bool> DisableForEveryone;
internal static ConfigEntry<bool> DisableLocally;
public override void Load()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("art0007i.BadgeRemover");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
DisableForEveryone = ((BasePlugin)this).Config.Bind<bool>("General", "DisableForEveryone", true, new ConfigDescription("When true, this will make all users in sessions hosted by you not generate badges.\n\nChanging this option will require everyone to respawn to apply properly.", (AcceptableValueBase)null, global::System.Array.Empty<object>()));
DisableLocally = ((BasePlugin)this).Config.Bind<bool>("General", "DisableLocally", true, new ConfigDescription("When true, this will make so when you have default nameplates enabled, those will not have badges.", (AcceptableValueBase)null, global::System.Array.Empty<object>()));
((BasePlugin)this).HarmonyInstance.PatchAll();
}
}
public static class PluginMetadata
{
public const string GUID = "art0007i.BadgeRemover";
public const string NAME = "BadgeRemover";
public const string VERSION = "0.1.0";
public const string AUTHORS = "art0007i";
public const string REPOSITORY_URL = "https://github.com/art0007i/BadgeRemover";
}