using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLabScaling;
using BoneLabScaling.Avatar;
using BoneLabScaling.Objects;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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("Scaling")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+66397dea7a2a59cf1370d11951d580f428b95c98")]
[assembly: AssemblyProduct("Scaling")]
[assembly: AssemblyTitle("Scaling")]
[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 Page objectScalingSubCategory { get; private set; }
public static FloatElement setAvatarScaleMenu { get; private set; }
public static FunctionElement applyAvatarScaleMenu { get; private set; }
public static FunctionElement resetAvatarScaleMenu { get; private set; }
public static FloatElement setObjectScaleMenu { get; private set; }
public static FunctionElement applyObjectScaleLHandMenu { get; private set; }
public static FunctionElement applyObjectScaleRHandMenu { get; private set; }
public static FunctionElement resetObjectScaleMenu { get; private set; }
public override void OnInitializeMelon()
{
MelonLogger.Msg("Scaling mod has initialized.");
CreateMenu();
}
private void CreateMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: 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);
objectScalingSubCategory = menuPage.CreatePage("Object", Color.blue, 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();
});
resetAvatarScaleMenu = avatarScalingSubCategory.CreateFunction("Reset", Color.green, (Action)delegate
{
AvatarScale.ResetScale();
});
setObjectScaleMenu = objectScalingSubCategory.CreateFloat("Scale", Color.yellow, AvatarScale.scale, 0.1f, 0.1f, 10f, (Action<float>)delegate(float f)
{
ObjectScale.scale = f;
});
applyObjectScaleLHandMenu = objectScalingSubCategory.CreateFunction("Scale from Left Hand", Color.green, (Action)delegate
{
ObjectScale.ScaleObject("left");
});
applyObjectScaleRHandMenu = objectScalingSubCategory.CreateFunction("Scale from Right Hand", Color.green, (Action)delegate
{
ObjectScale.ScaleObject("right");
});
resetObjectScaleMenu = objectScalingSubCategory.CreateFunction("Reset", Color.green, (Action)delegate
{
ObjectScale.ResetScale();
});
}
public static void BoneMenuNotif(NotificationType type, string content)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Scaling"),
Message = NotificationText.op_Implicit(content),
Type = type,
PopupLength = 3f,
ShowTitleOnPopup = true
});
}
}
}
namespace BoneLabScaling.Objects
{
internal class ObjectScale
{
public static float scale;
public static GameObject inLeftHand;
public static GameObject inRightHand;
private static Dictionary<GameObject, Vector3> originalScales;
static ObjectScale()
{
scale = 1f;
inLeftHand = null;
inRightHand = null;
originalScales = new Dictionary<GameObject, Vector3>();
inLeftHand = null;
inRightHand = null;
}
public static void ScaleObject(string hand)
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
if (hand == "left")
{
val = Player.GetObjectInHand(Player.LeftHand);
}
else
{
if (!(hand == "right"))
{
Main.BoneMenuNotif((NotificationType)2, "Invalid hand specified.");
return;
}
val = Player.GetObjectInHand(Player.RightHand);
}
if ((Object)(object)val != (Object)null)
{
Rigidbody componentInParent = ((Component)val.transform).GetComponentInParent<Rigidbody>();
if (!((Object)(object)componentInParent == (Object)null))
{
if (!originalScales.ContainsKey(((Component)componentInParent).gameObject))
{
originalScales[((Component)componentInParent).gameObject] = ((Component)componentInParent).transform.localScale;
}
Vector3 val2 = originalScales[((Component)componentInParent).gameObject];
Vector3 val3 = val2 * scale;
((Component)componentInParent).transform.localScale = val3;
componentInParent.mass = componentInParent.mass / (val2.x * val2.y * val2.z) * (val3.x * val3.y * val3.z);
if (hand == "left")
{
inLeftHand = val;
}
else
{
inRightHand = val;
}
}
}
else
{
Main.BoneMenuNotif((NotificationType)2, "No object found in " + hand + " hand.");
}
}
public static void ResetScale()
{
if ((Object)(object)inLeftHand != (Object)null)
{
ResetScaleForHand(inLeftHand);
}
if ((Object)(object)inRightHand != (Object)null)
{
ResetScaleForHand(inRightHand);
}
}
private static void ResetScaleForHand(GameObject obj)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)obj == (Object)null)
{
Main.BoneMenuNotif((NotificationType)2, "You are not holding anything.");
return;
}
Rigidbody componentInParent = obj.GetComponentInParent<Rigidbody>();
if ((Object)(object)componentInParent != (Object)null && originalScales.ContainsKey(((Component)componentInParent).gameObject))
{
((Component)componentInParent).transform.localScale = originalScales[((Component)componentInParent).gameObject];
componentInParent.mass /= scale * scale * scale;
}
}
}
}
namespace BoneLabScaling.Avatar
{
internal class AvatarScale
{
public static float scale = 1f;
private static GameObject avatarObject;
public static void ScaleAvatar()
{
AvatarCrate val = default(AvatarCrate);
if (!AssetWarehouse.Instance.TryGetCrate<AvatarCrate>(((ScannableReference)Player.RigManager._avatarCrate)._barcode, ref val))
{
return;
}
Action<GameObject> action = delegate(GameObject obj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
avatarObject = Object.Instantiate<GameObject>(obj);
avatarObject.transform.localScale = new Vector3(scale, scale, scale);
avatarObject.transform.parent = ((Component)Player.RigManager).transform;
avatarObject.transform.localPosition = Vector3.zero;
Avatar componentInChildren = avatarObject.GetComponentInChildren<Avatar>();
foreach (SkinnedMeshRenderer item in (Il2CppArrayBase<SkinnedMeshRenderer>)(object)componentInChildren.hairMeshes)
{
((Renderer)item).enabled = false;
}
componentInChildren.PrecomputeAvatar();
componentInChildren.RefreshBodyMeasurements();
Player.RigManager.SwitchAvatar(componentInChildren);
PlayerRefs.Instance._bodyVitals.PROPEGATE();
PullCordDevice componentInChildren2 = ((Component)Player.GetPhysicsRig()).GetComponentInChildren<PullCordDevice>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
((Component)componentInChildren2).transform.localScale = new Vector3(scale, scale, scale);
}
foreach (SlotContainer item2 in (Il2CppArrayBase<SlotContainer>)(object)Player.RigManager.inventory.bodySlots)
{
((Component)item2).transform.localScale = new Vector3(scale, scale, scale);
if (((Object)item2).name.Equals("BeltLf1"))
{
InventoryAmmoReceiver componentInChildren3 = ((Component)item2).GetComponentInChildren<InventoryAmmoReceiver>();
if (!((Object)(object)componentInChildren3 == (Object)null))
{
Enumerator<Magazine> enumerator3 = componentInChildren3._magazineArts.GetEnumerator();
while (enumerator3.MoveNext())
{
((Component)enumerator3.Current).transform.localScale = new Vector3(scale, scale, scale);
}
}
}
}
};
((CrateT<GameObject>)(object)val).LoadAsset(Action<GameObject>.op_Implicit(action));
}
public static void ResetScale()
{
AvatarCrate val = default(AvatarCrate);
if (!AssetWarehouse.Instance.TryGetCrate<AvatarCrate>(((ScannableReference)Player.RigManager._avatarCrate)._barcode, ref val))
{
return;
}
Action<GameObject> action = delegate(GameObject obj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
avatarObject = Object.Instantiate<GameObject>(obj);
avatarObject.transform.localScale = new Vector3(1f, 1f, 1f);
avatarObject.transform.parent = ((Component)Player.RigManager).transform;
avatarObject.transform.localPosition = Vector3.zero;
Avatar componentInChildren = avatarObject.GetComponentInChildren<Avatar>();
foreach (SkinnedMeshRenderer item in (Il2CppArrayBase<SkinnedMeshRenderer>)(object)componentInChildren.hairMeshes)
{
((Renderer)item).enabled = false;
}
componentInChildren.PrecomputeAvatar();
componentInChildren.RefreshBodyMeasurements();
Player.RigManager.SwitchAvatar(componentInChildren);
PlayerRefs.Instance._bodyVitals.PROPEGATE();
PullCordDevice componentInChildren2 = ((Component)Player.GetPhysicsRig()).GetComponentInChildren<PullCordDevice>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
((Component)componentInChildren2).transform.localScale = new Vector3(1f, 1f, 1f);
}
foreach (SlotContainer item2 in (Il2CppArrayBase<SlotContainer>)(object)Player.RigManager.inventory.bodySlots)
{
((Component)item2).transform.localScale = new Vector3(1f, 1f, 1f);
if (((Object)item2).name.Equals("BeltLf1"))
{
InventoryAmmoReceiver componentInChildren3 = ((Component)item2).GetComponentInChildren<InventoryAmmoReceiver>();
if (!((Object)(object)componentInChildren3 == (Object)null))
{
Enumerator<Magazine> enumerator3 = componentInChildren3._magazineArts.GetEnumerator();
while (enumerator3.MoveNext())
{
((Component)enumerator3.Current).transform.localScale = new Vector3(1f, 1f, 1f);
}
}
}
}
};
((CrateT<GameObject>)(object)val).LoadAsset(Action<GameObject>.op_Implicit(action));
}
}
}