using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VitalShift;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "VitalShift", "2.0.0", "jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("VitalShift")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aaffe927d3198820cbcb46561f1b9c561592fd98")]
[assembly: AssemblyProduct("VitalShift")]
[assembly: AssemblyTitle("VitalShift")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 VitalShift
{
public class Core : MelonMod
{
private MelonPreferences_Category category;
private MelonPreferences_Entry<bool> EnableModEntry;
private MelonPreferences_Entry<string> SavedAvatarHigh;
private MelonPreferences_Entry<string> SavedAvatarMedium;
private MelonPreferences_Entry<string> SavedAvatarLow;
private Barcode AvatarHigh;
private Barcode AvatarMedium;
private Barcode AvatarLow;
private Barcode CurrentAvatarSet;
private float HighHealthThreshold;
private float MediumHealthThreshold;
public override void OnInitializeMelon()
{
SetupMelonPreferences();
SetupBoneMenu();
Hooking.OnLevelLoaded += OnLevelLoaded;
Hooking.OnPlayerDamageReceived += OnPlayerDamageReceived;
Hooking.OnPlayerResurrected += OnPlayerResurrected;
}
private void SetupBoneMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Jorink", Color.red, 0, true).CreatePage("VitalShift", Color.red, 0, true);
obj.CreateBool("Enable Mod", Color.blue, EnableModEntry.Value, (Action<bool>)delegate(bool a)
{
EnableModEntry.Value = a;
});
obj.CreateFunction("Set High HP Avatar", Color.green, (Action)delegate
{
SetAvatarHigh();
});
obj.CreateFunction("Set Medium HP Avatar", Color.yellow, (Action)delegate
{
SetAvatarMedium();
});
obj.CreateFunction("Set Low HP Avatar", Color.red, (Action)delegate
{
SetAvatarLow();
});
obj.CreateFunction("Save Settings", Color.cyan, (Action)delegate
{
MelonPreferences.Save();
});
}
private void SetupMelonPreferences()
{
category = MelonPreferences.CreateCategory("VitalShift");
EnableModEntry = category.CreateEntry<bool>("Enable Mod", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SavedAvatarHigh = category.CreateEntry<string>("Avatar High", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SavedAvatarMedium = category.CreateEntry<string>("Avatar Medium", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SavedAvatarLow = category.CreateEntry<string>("Avatar Low", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences.Save();
category.SaveToFile(true);
}
public override void OnDeinitializeMelon()
{
Hooking.OnLevelLoaded -= OnLevelLoaded;
Hooking.OnPlayerDamageReceived -= OnPlayerDamageReceived;
Hooking.OnPlayerResurrected -= OnPlayerResurrected;
}
private void OnLevelLoaded(LevelInfo levelInfo)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
if (EnableModEntry.Value)
{
AvatarHigh = new Barcode(SavedAvatarHigh.Value);
AvatarMedium = new Barcode(SavedAvatarMedium.Value);
AvatarLow = new Barcode(SavedAvatarLow.Value);
Player.RigManager.SwapAvatarCrate(AvatarHigh, false, (Action<bool>)null);
CurrentAvatarSet = AvatarHigh;
}
}
private void OnPlayerDamageReceived(RigManager rigManager, float damage)
{
if (!EnableModEntry.Value || (Object)(object)Player.RigManager == (Object)null)
{
return;
}
HighHealthThreshold = Player.RigManager.health.max_Health * 0.7f;
MediumHealthThreshold = Player.RigManager.health.max_Health * 0.3f;
float curr_Health = Player.RigManager.health.curr_Health;
if (curr_Health > HighHealthThreshold)
{
if (CurrentAvatarSet != AvatarHigh)
{
Player.RigManager.SwapAvatarCrate(AvatarHigh, false, (Action<bool>)null);
CurrentAvatarSet = AvatarHigh;
}
}
else if (curr_Health > MediumHealthThreshold)
{
if (CurrentAvatarSet != AvatarMedium)
{
Player.RigManager.SwapAvatarCrate(AvatarMedium, false, (Action<bool>)null);
CurrentAvatarSet = AvatarMedium;
}
}
else if (CurrentAvatarSet != AvatarLow)
{
Player.RigManager.SwapAvatarCrate(AvatarLow, false, (Action<bool>)null);
CurrentAvatarSet = AvatarLow;
}
}
private void OnPlayerResurrected(RigManager rigManager)
{
if (EnableModEntry.Value && !((Object)(object)Player.RigManager == (Object)null) && !(CurrentAvatarSet == AvatarHigh))
{
Player.RigManager.SwapAvatarCrate(AvatarHigh, false, (Action<bool>)null);
CurrentAvatarSet = AvatarHigh;
}
}
private void SetAvatarHigh()
{
//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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
if (!((Object)(object)Player.RigManager == (Object)null))
{
AvatarHigh = ((ScannableReference)Player.RigManager.AvatarCrate).Barcode;
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("High avatar set to:"),
Message = NotificationText.op_Implicit(AvatarHigh.ID),
Type = (NotificationType)3,
PopupLength = 1.25f,
ShowTitleOnPopup = true
});
SavedAvatarHigh.Value = ((Object)AvatarHigh).ToString();
}
}
private void SetAvatarMedium()
{
//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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
if (!((Object)(object)Player.RigManager == (Object)null))
{
AvatarMedium = ((ScannableReference)Player.RigManager.AvatarCrate).Barcode;
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Medium avatar set to:"),
Message = NotificationText.op_Implicit(AvatarMedium.ID),
Type = (NotificationType)3,
PopupLength = 1.25f,
ShowTitleOnPopup = true
});
SavedAvatarMedium.Value = ((Object)AvatarMedium).ToString();
}
}
private void SetAvatarLow()
{
//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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
if (!((Object)(object)Player.RigManager == (Object)null))
{
AvatarLow = ((ScannableReference)Player.RigManager.AvatarCrate).Barcode;
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Low avatar set to:"),
Message = NotificationText.op_Implicit(AvatarLow.ID),
Type = (NotificationType)3,
PopupLength = 1.25f,
ShowTitleOnPopup = true
});
SavedAvatarLow.Value = ((Object)AvatarLow).ToString();
}
}
}
}