using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;
using melon;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Avatar Locker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("Avatar Locker")]
[assembly: AssemblyCopyright("Created by Bread Soup")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Melon), "Avatar Locker", "2.0.0", "Bread Soup", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace melon;
public static class BuildInfo
{
public const string Name = "Avatar Locker";
public const string Author = "Bread Soup";
public const string Company = null;
public const string Version = "2.0.0";
public const string DownloadLink = null;
}
public class Melon : MelonMod
{
private static FunctionElement CurrentName;
public static MelonPreferences_Category MelonPrefCategory { get; private set; }
public static BoolElement BoneMenuEnabledElement { get; private set; }
public static Page BoneMenuCategory { get; private set; }
public static MelonPreferences_Entry<bool> MelonPrefEnabled { get; private set; }
public static MelonPreferences_Entry<string> CurrentBarcode { get; private set; }
public static bool IsEnabled { get; private set; }
public static MelonPreferences_Entry<string> CurrentNameValue { get; private set; }
public override void OnInitializeMelon()
{
MelonPrefs();
CreateBoneMenu();
CreateCurrentAvatarLockNameThing();
Hooking.OnLevelLoaded += delegate
{
OnSceneAwake();
};
}
public static void MelonPrefs()
{
MelonPrefCategory = MelonPreferences.CreateCategory("Avatar Locker");
MelonPrefEnabled = MelonPrefCategory.CreateEntry<bool>("IsEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
IsEnabled = MelonPrefEnabled.Value;
CurrentBarcode = MelonPrefCategory.CreateEntry<string>("Currently locked avatar", (string)null, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
CurrentNameValue = MelonPrefCategory.CreateEntry<string>("Current name of locked avatar", (string)null, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
}
public static void CreateBoneMenu()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
BoneMenuCategory = Page.Root.CreatePage("Avatar Locker", Color.cyan, 0, true);
BoneMenuCategory.CreateBool("Mod Toggle", Color.yellow, IsEnabled, (Action<bool>)OnSetEnabled);
BoneMenuCategory.CreateFunction("Switch lock to current avatar", Color.white, (Action)delegate
{
if (!((Object)(object)Player.RigManager == (Object)null) && Player.RigManager._avatarCrate != null && !((Object)(object)Player.Avatar == (Object)null))
{
CurrentBarcode.Value = ((ScannableReference)Player.RigManager._avatarCrate).Barcode.ID;
Avatar avatar = Player.Avatar;
CurrentNameValue.Value = HelperMethods.GetCleanObjectName(((Object)avatar).name);
((Element)CurrentName).ElementName = CurrentNameValue.Value;
}
});
}
private static void OnSceneAwake()
{
if (CurrentName != null && CurrentBarcode != null)
{
((Element)CurrentName).ElementName = CurrentNameValue.Value;
}
}
public static void CreateCurrentAvatarLockNameThing()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
CurrentName = BoneMenuCategory.CreateFunction("No avatar lock found set one with the button above", Color.white, (Action)delegate
{
});
}
public static void OnSetEnabled(bool value)
{
IsEnabled = value;
MelonPrefEnabled.Value = value;
MelonPrefCategory.SaveToFile(false);
}
public override void OnPreferencesLoaded()
{
IsEnabled = MelonPrefEnabled.Value;
}
public override void OnUpdate()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
if (IsEnabled && !string.IsNullOrEmpty(CurrentBarcode.Value) && (Object)(object)Player.RigManager != (Object)null && Player.RigManager._avatarCrate != null)
{
string iD = ((ScannableReference)Player.RigManager._avatarCrate).Barcode.ID;
if (iD != CurrentBarcode.Value)
{
Player.RigManager.SwapAvatarCrate(new Barcode(CurrentBarcode.Value), false, (Action<bool>)null);
}
}
}
}