using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using HarmonyLib;
using Il2CppSLZ.VRMK;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using StrengthMod;
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(global::StrengthMod.StrengthMod), "StrengthMod", "1.0.0", "YourName", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("StrengthMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StrengthMod")]
[assembly: AssemblyTitle("StrengthMod")]
[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 StrengthMod
{
public class StrengthMod : MelonMod
{
private static MelonPreferences_Category _prefCat;
private static MelonPreferences_Entry<float> _prefStrength;
private static MelonPreferences_Entry<float> _prefAgility;
private static MelonPreferences_Entry<bool> _prefEnabled;
private const float DEFAULT_STRENGTH = 1f;
private const float DEFAULT_AGILITY = 1f;
private const float MIN_VAL = 0f;
private const float MAX_VAL = 999f;
private const float STEP = 0.5f;
public static bool IsEnabled = true;
public static float StrengthMult = 1f;
public static float AgilityMult = 1f;
private static FloatElement _strengthElement;
private static FloatElement _agilityElement;
public override void OnInitializeMelon()
{
_prefCat = MelonPreferences.CreateCategory("StrengthMod");
_prefEnabled = _prefCat.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefStrength = _prefCat.CreateEntry<float>("Strength", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefAgility = _prefCat.CreateEntry<float>("Agility", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
IsEnabled = _prefEnabled.Value;
StrengthMult = _prefStrength.Value;
AgilityMult = _prefAgility.Value;
SetupBoneMenu();
((MelonBase)this).HarmonyInstance.PatchAll();
((MelonBase)this).LoggerInstance.Msg("[StrengthMod] Initialized. Harmony patched.");
}
private void SetupBoneMenu()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("Strength Mod", Color.cyan, 0, true);
val.CreateBool("Enabled", Color.green, IsEnabled, (Action<bool>)delegate(bool v)
{
IsEnabled = v;
_prefEnabled.Value = v;
_prefCat.SaveToFile(true);
});
_strengthElement = val.CreateFloat("Strength Multiplier", Color.yellow, StrengthMult, 0.5f, 0f, 999f, (Action<float>)delegate(float v)
{
StrengthMult = v;
_prefStrength.Value = v;
_prefCat.SaveToFile(true);
});
_agilityElement = val.CreateFloat("Agility Multiplier", Color.magenta, AgilityMult, 0.5f, 0f, 999f, (Action<float>)delegate(float v)
{
AgilityMult = v;
_prefAgility.Value = v;
_prefCat.SaveToFile(true);
});
Page val2 = val.CreatePage("Presets", Color.white, 0, true);
val2.CreateFunction("Normal (1x)", Color.white, (Action)delegate
{
ApplyPreset(1f, 1f);
});
val2.CreateFunction("Strong (5x)", Color.green, (Action)delegate
{
ApplyPreset(5f, 2f);
});
val2.CreateFunction("Superhero (25x)", Color.cyan, (Action)delegate
{
ApplyPreset(25f, 5f);
});
val2.CreateFunction("Titan (100x)", Color.red, (Action)delegate
{
ApplyPreset(100f, 10f);
});
val2.CreateFunction("God (999x)", Color.yellow, (Action)delegate
{
ApplyPreset(999f, 999f);
});
val2.CreateFunction("Reset", Color.gray, (Action)delegate
{
ApplyPreset(1f, 1f);
});
}
private void ApplyPreset(float strength, float agility)
{
StrengthMult = strength;
AgilityMult = agility;
_strengthElement.Value = strength;
_agilityElement.Value = agility;
_prefStrength.Value = strength;
_prefAgility.Value = agility;
_prefCat.SaveToFile(true);
}
}
[HarmonyPatch(typeof(Avatar), "ComputeBaseStats")]
public static class AvatarStatsPatch
{
public static void Postfix(Avatar __instance)
{
if (StrengthMod.IsEnabled && !((Object)(object)__instance == (Object)null) && !(((Object)__instance).name == "[RealHeptaRig (Marrow1)]"))
{
__instance._strengthUpper = StrengthMod.StrengthMult;
__instance._strengthLower = StrengthMod.StrengthMult;
__instance._agility = StrengthMod.AgilityMult;
}
}
}
}