using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using MelonLoader;
using Microsoft.CodeAnalysis;
using StandaloneBodyLogColor;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(BodyLogColorMod), "BodyLog & Radial Color", "1.0.0", "DOOBER", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("StandaloneBodyLogColor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StandaloneBodyLogColor")]
[assembly: AssemblyTitle("StandaloneBodyLogColor")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace StandaloneBodyLogColor
{
public class BodyLogColorMod : MelonMod
{
private static Page _mainPage;
public override void OnInitializeMelon()
{
((MelonBase)this).LoggerInstance.Msg("BodyLog & Radial Menu Color mod loaded");
}
public override void OnLateInitializeMelon()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
_mainPage = Page.Root.CreatePage("BodyLog Color", Color.magenta, 0, true);
BuildMenu();
}
public override void OnUpdate()
{
BodyLogColorController.Update();
}
private void BuildMenu()
{
//IL_000a: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
_mainPage.CreateBool("Enabled", Color.white, BodyLogColorController.Enabled, (Action<bool>)delegate(bool value)
{
BodyLogColorController.Enabled = value;
});
_mainPage.CreateFunction("Apply Colors Now", Color.green, (Action)delegate
{
BodyLogColorController.ApplyAll();
});
Page obj = _mainPage.CreatePage("Body Log Tint", Color.cyan, 0, true);
obj.CreateFloat("R", Color.red, BodyLogColorController.BodyLogR, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BodyLogR = value;
});
obj.CreateFloat("G", Color.green, BodyLogColorController.BodyLogG, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BodyLogG = value;
});
obj.CreateFloat("B", Color.blue, BodyLogColorController.BodyLogB, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BodyLogB = value;
});
obj.CreateFloat("A", Color.white, BodyLogColorController.BodyLogA, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BodyLogA = value;
});
Page obj2 = _mainPage.CreatePage("Ball Color", Color.yellow, 0, true);
obj2.CreateFloat("R", Color.red, BodyLogColorController.BallR, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BallR = value;
});
obj2.CreateFloat("G", Color.green, BodyLogColorController.BallG, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BallG = value;
});
obj2.CreateFloat("B", Color.blue, BodyLogColorController.BallB, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BallB = value;
});
obj2.CreateFloat("A", Color.white, BodyLogColorController.BallA, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.BallA = value;
});
Page obj3 = _mainPage.CreatePage("Line Color", Color.green, 0, true);
obj3.CreateFloat("R", Color.red, BodyLogColorController.LineR, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.LineR = value;
});
obj3.CreateFloat("G", Color.green, BodyLogColorController.LineG, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.LineG = value;
});
obj3.CreateFloat("B", Color.blue, BodyLogColorController.LineB, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.LineB = value;
});
obj3.CreateFloat("A", Color.white, BodyLogColorController.LineA, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.LineA = value;
});
Page obj4 = _mainPage.CreatePage("Radial Menu Color", Color.red, 0, true);
obj4.CreateFloat("R", Color.red, BodyLogColorController.RadialR, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.RadialR = value;
});
obj4.CreateFloat("G", Color.green, BodyLogColorController.RadialG, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.RadialG = value;
});
obj4.CreateFloat("B", Color.blue, BodyLogColorController.RadialB, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.RadialB = value;
});
obj4.CreateFloat("A", Color.white, BodyLogColorController.RadialA, 5f, 0f, 255f, (Action<float>)delegate(float value)
{
BodyLogColorController.RadialA = value;
});
}
}
public static class BodyLogColorController
{
private static bool _enabled = false;
private static float _bodyLogR = 255f;
private static float _bodyLogG = 255f;
private static float _bodyLogB = 255f;
private static float _bodyLogA = 255f;
private static float _ballR = 255f;
private static float _ballG = 255f;
private static float _ballB = 255f;
private static float _ballA = 255f;
private static float _lineR = 255f;
private static float _lineG = 255f;
private static float _lineB = 255f;
private static float _lineA = 255f;
private static float _radialR = 255f;
private static float _radialG = 255f;
private static float _radialB = 255f;
private static float _radialA = 255f;
public static bool Enabled
{
get
{
return _enabled;
}
set
{
_enabled = value;
}
}
public static float BodyLogR
{
get
{
return _bodyLogR;
}
set
{
_bodyLogR = value;
}
}
public static float BodyLogG
{
get
{
return _bodyLogG;
}
set
{
_bodyLogG = value;
}
}
public static float BodyLogB
{
get
{
return _bodyLogB;
}
set
{
_bodyLogB = value;
}
}
public static float BodyLogA
{
get
{
return _bodyLogA;
}
set
{
_bodyLogA = value;
}
}
public static float BallR
{
get
{
return _ballR;
}
set
{
_ballR = value;
}
}
public static float BallG
{
get
{
return _ballG;
}
set
{
_ballG = value;
}
}
public static float BallB
{
get
{
return _ballB;
}
set
{
_ballB = value;
}
}
public static float BallA
{
get
{
return _ballA;
}
set
{
_ballA = value;
}
}
public static float LineR
{
get
{
return _lineR;
}
set
{
_lineR = value;
}
}
public static float LineG
{
get
{
return _lineG;
}
set
{
_lineG = value;
}
}
public static float LineB
{
get
{
return _lineB;
}
set
{
_lineB = value;
}
}
public static float LineA
{
get
{
return _lineA;
}
set
{
_lineA = value;
}
}
public static float RadialR
{
get
{
return _radialR;
}
set
{
_radialR = value;
}
}
public static float RadialG
{
get
{
return _radialG;
}
set
{
_radialG = value;
}
}
public static float RadialB
{
get
{
return _radialB;
}
set
{
_radialB = value;
}
}
public static float RadialA
{
get
{
return _radialA;
}
set
{
_radialA = value;
}
}
private static Color BodyLogColor => ToUnityColor(_bodyLogR, _bodyLogG, _bodyLogB, _bodyLogA);
private static Color BallColor => ToUnityColor(_ballR, _ballG, _ballB, _ballA);
private static Color LineColor => ToUnityColor(_lineR, _lineG, _lineB, _lineA);
private static Color RadialColor => ToUnityColor(_radialR, _radialG, _radialB, _radialA);
private static Color ToUnityColor(float r, float g, float b, float a)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
return new Color(r / 255f, g / 255f, b / 255f, a / 255f);
}
public static void ApplyBodyLogColors()
{
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
try
{
PhysicsRig physicsRig = Player.PhysicsRig;
if ((Object)(object)physicsRig == (Object)null)
{
return;
}
Transform elbow = GetElbow(physicsRig, "m_elbowRt");
if ((Object)(object)elbow == (Object)null)
{
elbow = GetElbow(physicsRig, "m_elbowLf");
}
if ((Object)(object)elbow == (Object)null)
{
return;
}
Transform val = elbow.Find("BodyLogSlot/BodyLog");
if ((Object)(object)val == (Object)null)
{
return;
}
Component val2 = ((Component)val).GetComponent<Component>();
if ((Object)(object)val2 == (Object)null)
{
return;
}
Type type = ((object)val2).GetType();
if (type.Name != "PullCordDevice")
{
foreach (Component component2 in ((Component)val).GetComponents<Component>())
{
if (((object)component2).GetType().Name == "PullCordDevice")
{
val2 = component2;
type = ((object)component2).GetType();
break;
}
}
}
if (type.Name == "PullCordDevice")
{
PropertyInfo propertyInfo = type.GetProperty("hologramTint") ?? type.GetProperty("hologramTint", BindingFlags.Instance | BindingFlags.Public);
if (propertyInfo != null)
{
propertyInfo.SetValue(val2, BodyLogColor);
}
else
{
type.GetField("hologramTint", BindingFlags.Instance | BindingFlags.Public)?.SetValue(val2, BodyLogColor);
}
PropertyInfo propertyInfo2 = type.GetProperty("lineRenderer") ?? type.GetProperty("lineRenderer", BindingFlags.Instance | BindingFlags.Public);
if (propertyInfo2 != null)
{
object? value = propertyInfo2.GetValue(val2);
LineRenderer val3 = (LineRenderer)((value is LineRenderer) ? value : null);
if ((Object)(object)val3 != (Object)null)
{
val3.SetColors(LineColor, LineColor);
}
}
else
{
FieldInfo field = type.GetField("lineRenderer", BindingFlags.Instance | BindingFlags.Public);
if (field != null)
{
object? value2 = field.GetValue(val2);
object? obj = ((value2 is LineRenderer) ? value2 : null);
if (obj != null)
{
((LineRenderer)obj).SetColors(LineColor, LineColor);
}
}
}
}
Transform val4 = val.Find("spheregrip/Sphere/Art/GrabGizmo");
if ((Object)(object)val4 != (Object)null)
{
MeshRenderer component = ((Component)val4).GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
((Renderer)component).material.color = BallColor;
}
}
}
catch (Exception ex)
{
MelonLogger.Warning("[BodyLogColor] Apply body log error: " + ex.Message);
}
}
public static void ApplyRadialMenuColors()
{
//IL_009d: 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_00de: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
try
{
UIRig uIRig = Player.UIRig;
if ((Object)(object)uIRig == (Object)null)
{
return;
}
object obj = ((object)uIRig).GetType().GetProperty("popUpMenu", BindingFlags.Instance | BindingFlags.Public)?.GetValue(uIRig);
if (obj == null)
{
return;
}
object obj2 = obj.GetType().GetProperty("radialPageView", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj);
if (obj2 == null)
{
return;
}
object obj3 = obj2.GetType().GetProperty("buttons", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj2);
if (obj3 == null || !(obj3 is IEnumerable enumerable))
{
return;
}
Color radialColor = RadialColor;
foreach (object item in enumerable)
{
if (item == null)
{
continue;
}
Type type = item.GetType();
type.GetProperty("color2", BindingFlags.Instance | BindingFlags.Public)?.SetValue(item, radialColor);
object obj4 = type.GetProperty("textMesh", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item);
obj4?.GetType().GetProperty("color", BindingFlags.Instance | BindingFlags.Public)?.SetValue(obj4, radialColor);
object obj5 = type.GetProperty("icon", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item);
if (obj5 != null)
{
MethodInfo method = obj5.GetType().GetMethod("GetComponent", new Type[1] { typeof(string) });
if (method != null)
{
object obj6 = method.Invoke(obj5, new object[1] { "CanvasRenderer" });
obj6?.GetType().GetMethod("SetColor", new Type[1] { typeof(Color) })?.Invoke(obj6, new object[1] { radialColor });
}
}
}
}
catch (Exception ex)
{
MelonLogger.Warning("[BodyLogColor] Apply radial menu error: " + ex.Message);
}
}
public static void ApplyAll()
{
ApplyBodyLogColors();
ApplyRadialMenuColors();
}
public static void Update()
{
if (!_enabled)
{
return;
}
try
{
UIRig uIRig = Player.UIRig;
if ((Object)(object)uIRig == (Object)null)
{
return;
}
object obj = ((object)uIRig).GetType().GetProperty("popUpMenu", BindingFlags.Instance | BindingFlags.Public)?.GetValue(uIRig);
if (obj != null)
{
PropertyInfo property = obj.GetType().GetProperty("gameObject", BindingFlags.Instance | BindingFlags.Public);
if (property == null)
{
property = typeof(Component).GetProperty("gameObject");
}
object? obj2 = property?.GetValue(obj);
GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null);
if ((Object)(object)val != (Object)null && val.activeInHierarchy)
{
ApplyRadialMenuColors();
}
}
}
catch
{
}
}
private static Transform GetElbow(object physRig, string fieldName)
{
try
{
Type type = physRig.GetType();
while (type != null)
{
FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(physRig);
return (Transform)((value is Transform) ? value : null);
}
PropertyInfo property = type.GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
object? value2 = property.GetValue(physRig);
return (Transform)((value2 is Transform) ? value2 : null);
}
type = type.BaseType;
}
}
catch
{
}
return null;
}
}
}