using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.Notifications;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using MelonLoader;
using UnityEngine;
using jlib;
using vitalshift;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(VitalShift), "VitalShift", "4.0.0", "Jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace vitalshift;
public class VitalShift : MelonMod
{
public const string Version = "4.0.0";
private const string DefaultAvatar = "SLZ.BONELAB.Content.Avatar.FordBW";
private readonly string[] tiers = new string[3] { "High", "Medium", "Low" };
private readonly Color[] tierColors = (Color[])(object)new Color[3]
{
Color.green,
Color.yellow,
Color.red
};
private ModPage menu;
private MelonPreferences_Entry<bool> enableMod;
private readonly MelonPreferences_Entry<string>[] avatars = new MelonPreferences_Entry<string>[3];
public override void OnInitializeMelon()
{
//IL_0006: 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_00af: Unknown result type (might be due to invalid IL or missing references)
menu = JLib.Register("VitalShift", Color.red);
enableMod = menu.Bool("Enable Mod", true, Color.green, (Action<bool>)null);
for (int i = 0; i < tiers.Length; i++)
{
int tier = i;
avatars[tier] = menu.Hidden<string>("Avatar " + tiers[tier], "SLZ.BONELAB.Content.Avatar.FordBW");
menu.Function("Set " + tiers[tier] + " HP Avatar", tierColors[tier], (Action)delegate
{
SetAvatar(tier);
});
}
}
public override void OnUpdate()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
Player_Health playerHealth = JLib.playerHealth;
if (!enableMod.Value || (Object)(object)playerHealth == (Object)null)
{
return;
}
RigManager rigManager = Player.RigManager;
string iD = ((ScannableReference)rigManager.AvatarCrate).Barcode.ID;
if (!(iD != avatars[0].Value) || !(iD != avatars[1].Value) || !(iD != avatars[2].Value))
{
float num = ((Health)playerHealth).curr_Health / ((Health)playerHealth).max_Health;
string value = avatars[(!(num > 0.7f)) ? ((num > 0.3f) ? 1 : 2) : 0].Value;
if (value != iD)
{
rigManager.SwapAvatarCrate(new Barcode(value), false, (Action<bool>)null);
}
}
}
private void SetAvatar(int tier)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
string iD = ((ScannableReference)Player.RigManager.AvatarCrate).Barcode.ID;
menu.Save<string>(avatars[tier], iD);
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit(tiers[tier] + " tier set to:"),
Message = NotificationText.op_Implicit(iD),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
});
}
}