using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLabScaling;
using BoneLabScaling.Avatar;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "Scaling", "1.0.0", "VeygaX", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BoneLabScaling")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f39f889ed42f82931d395eab901d9e49cab31916")]
[assembly: AssemblyProduct("BoneLabScaling")]
[assembly: AssemblyTitle("BoneLabScaling")]
[assembly: AssemblyVersion("1.0.0.0")]
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 BoneLabScaling
{
public class Main : MelonMod
{
public static Page menuPage { get; private set; }
public static Page avatarScalingSubCategory { get; private set; }
public static FloatElement setAvatarScaleMenu { get; private set; }
public static FunctionElement applyAvatarScaleMenu { get; private set; }
public override void OnInitializeMelon()
{
MelonLogger.Msg("Scaling mod has initialized.");
CreateMenu();
}
private void CreateMenu()
{
//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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
menuPage = Page.Root.CreatePage("Scaling", Color.blue, 0, true);
avatarScalingSubCategory = menuPage.CreatePage("Avatar", Color.green, 0, true);
setAvatarScaleMenu = avatarScalingSubCategory.CreateFloat("Scale", Color.yellow, AvatarScale.scale, 0.1f, 0.1f, 10f, (Action<float>)delegate(float f)
{
AvatarScale.scale = f;
});
applyAvatarScaleMenu = avatarScalingSubCategory.CreateFunction("Apply", Color.green, (Action)delegate
{
AvatarScale.ScaleAvatar();
});
}
}
}
namespace BoneLabScaling.Avatar
{
internal class AvatarScale
{
public static float scale = 1f;
public static void ScaleAvatar()
{
AvatarCrate val = default(AvatarCrate);
if (AssetWarehouse.Instance.TryGetCrate<AvatarCrate>(((ScannableReference)Player.RigManager._avatarCrate)._barcode, ref val))
{
Action<GameObject> action = delegate(GameObject obj)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
GameObject val2 = Object.Instantiate<GameObject>(obj);
Vector3 localScale = val2.transform.localScale;
localScale.x *= scale;
localScale.y *= scale;
localScale.z *= scale;
val2.transform.localScale = localScale;
val2.transform.parent = ((Component)Player.RigManager).transform;
val2.transform.localPosition = Vector3.zero;
Avatar componentInChildren = val2.GetComponentInChildren<Avatar>();
foreach (SkinnedMeshRenderer item in (Il2CppArrayBase<SkinnedMeshRenderer>)(object)componentInChildren.hairMeshes)
{
((Renderer)item).enabled = false;
}
MelonLogger.Msg("Changed scale to " + scale + "x");
componentInChildren.PrecomputeAvatar();
componentInChildren.RefreshBodyMeasurements();
Player.RigManager.SwitchAvatar(componentInChildren);
PlayerRefs.Instance._bodyVitals.PROPEGATE();
};
((CrateT<GameObject>)(object)val).LoadAsset(Action<GameObject>.op_Implicit(action));
}
else
{
MelonLogger.Msg("Failed to find avatar crate.");
}
}
}
}