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", "3.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+74bb6d8f689b776e31665cee3ae58f877b5803ab")] [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] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 enum HealthTier { High, Medium, Low } public class Core : MelonMod { private const float HighHealthThreshold = 0.7f; private const float MediumHealthThreshold = 0.3f; private const string DefaultAvatarBarcode = "SLZ.BONELAB.Content.Avatar.FordBW"; private MelonPreferences_Category category; private MelonPreferences_Entry EnableModEntry; private MelonPreferences_Entry SavedAvatarHigh; private MelonPreferences_Entry SavedAvatarMedium; private MelonPreferences_Entry SavedAvatarLow; private Barcode AvatarHigh; private Barcode AvatarMedium; private Barcode AvatarLow; public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); SetupMelonPreferences(); SetupBoneMenu(); Hooking.OnLevelLoaded += OnLevelLoaded; Hooking.OnPlayerResurrected += OnPlayerResurrected; } public override void OnDeinitializeMelon() { ((MelonBase)this).OnDeinitializeMelon(); Hooking.OnLevelLoaded -= OnLevelLoaded; Hooking.OnPlayerResurrected -= OnPlayerResurrected; } public override void OnUpdate() { ((MelonBase)this).OnUpdate(); RefreshAvatarTier(); } 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)delegate(bool a) { EnableModEntry.Value = a; }); obj.CreateFunction("Set High HP Avatar", Color.green, (Action)delegate { SetAvatar(HealthTier.High); }); obj.CreateFunction("Set Medium HP Avatar", Color.yellow, (Action)delegate { SetAvatar(HealthTier.Medium); }); obj.CreateFunction("Set Low HP Avatar", Color.red, (Action)delegate { SetAvatar(HealthTier.Low); }); obj.CreateFunction("Save Settings", Color.cyan, (Action)delegate { MelonPreferences.Save(); }); } private void SetupMelonPreferences() { category = MelonPreferences.CreateCategory("VitalShift"); EnableModEntry = category.CreateEntry("Enable Mod", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SavedAvatarHigh = category.CreateEntry("Avatar High", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SavedAvatarMedium = category.CreateEntry("Avatar Medium", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SavedAvatarLow = category.CreateEntry("Avatar Low", "SLZ.BONELAB.Content.Avatar.FordBW", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences.Save(); category.SaveToFile(true); } private void OnLevelLoaded(LevelInfo levelInfo) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown AvatarHigh = new Barcode(SavedAvatarHigh.Value); AvatarMedium = new Barcode(SavedAvatarMedium.Value); AvatarLow = new Barcode(SavedAvatarLow.Value); if (EnableModEntry.Value && !((Object)(object)Player.RigManager == (Object)null) && IsManagedAvatar(((ScannableReference)Player.RigManager.AvatarCrate).Barcode)) { SwapAvatar(HealthTier.High); } } private void RefreshAvatarTier() { if (EnableModEntry.Value && !((Object)(object)Player.RigManager == (Object)null) && IsManagedAvatar(((ScannableReference)Player.RigManager.AvatarCrate).Barcode)) { Health health = Player.RigManager.health; float num = health.max_Health * 0.7f; float num2 = health.max_Health * 0.3f; float curr_Health = health.curr_Health; HealthTier tier = ((!(curr_Health > num)) ? ((curr_Health > num2) ? HealthTier.Medium : HealthTier.Low) : HealthTier.High); SwapAvatar(tier); } } private bool IsManagedAvatar(Barcode avatar) { if (!(avatar == AvatarHigh) && !(avatar == AvatarMedium)) { return avatar == AvatarLow; } return true; } private void OnPlayerResurrected(RigManager rigManager) { if (EnableModEntry.Value && !((Object)(object)Player.RigManager == (Object)null) && IsManagedAvatar(((ScannableReference)Player.RigManager.AvatarCrate).Barcode)) { SwapAvatar(HealthTier.High); } } private void SwapAvatar(HealthTier tier) { Barcode val = (Barcode)(tier switch { HealthTier.High => AvatarHigh, HealthTier.Medium => AvatarMedium, HealthTier.Low => AvatarLow, _ => AvatarHigh, }); if (!(((ScannableReference)Player.RigManager.AvatarCrate).Barcode == val)) { Player.RigManager.SwapAvatarCrate(val, false, (Action)null); } } private void SetAvatar(HealthTier tier) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (!((Object)(object)Player.RigManager == (Object)null)) { Barcode barcode = ((ScannableReference)Player.RigManager.AvatarCrate).Barcode; MelonPreferences_Entry val; string text; switch (tier) { case HealthTier.High: AvatarHigh = barcode; val = SavedAvatarHigh; text = "High"; break; case HealthTier.Medium: AvatarMedium = barcode; val = SavedAvatarMedium; text = "Medium"; break; default: AvatarLow = barcode; val = SavedAvatarLow; text = "Low"; break; } val.Value = ((Object)barcode).ToString(); Notifier.Send(new Notification { Title = NotificationText.op_Implicit(text + " avatar set to:"), Message = NotificationText.op_Implicit(barcode.ID), Type = (NotificationType)3, PopupLength = 1.25f, ShowTitleOnPopup = true }); } } } }