Decompiled source of CustomCampaignTools v1.0.0
Mods/CustomCampaignTools.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using BrowsingPlus; using BrowsingPlus.OverrideImplements; using BrowsingPlus.PanelUI; using CustomCampaignTools; using CustomCampaignTools.Bonemenu; using CustomCampaignTools.Debug; using CustomCampaignTools.Patching; using CustomCampaignTools.SDK; using HarmonyLib; using Il2CppCysharp.Threading.Tasks; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Bonelab; using Il2CppSLZ.Bonelab.SaveData; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Audio; using Il2CppSLZ.Marrow.Circuits; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.SaveData; using Il2CppSLZ.Marrow.SceneStreaming; using Il2CppSLZ.Marrow.Utilities; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSLZ.UI; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using Il2CppUltEvents; using MelonLoader; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using RedirectModsFolder; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Allows Modders to add their own Campaign functionality to Marrow Campaigns.")] [assembly: AssemblyDescription("Allows Modders to add their own Campaign functionality to Marrow Campaigns.")] [assembly: AssemblyCompany("LabWorks")] [assembly: AssemblyProduct("Custom Campain Tools")] [assembly: AssemblyCopyright("Developed by EvroDev")] [assembly: AssemblyTrademark("LabWorks")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: MelonInfo(typeof(Main), "Custom Campain Tools", "1.0.0", "EvroDev", "")] [assembly: MelonColor(ConsoleColor.White)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [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 CustomCampaignTools { public static class AmmoFunctions { public static void ClearAmmo(Campaign campaign) { if (CampaignUtilities.IsCampaignLevel(((Scannable)SceneStreamer.Session.Level).Barcode.ID, out var _, out var _)) { AmmoInventory.Instance.ClearAmmo(); } campaign.saveData.LoadedAmmoSaves.Clear(); campaign.saveData.SaveToDisk(); } public static void LoadAmmoFromLevel(string levelBarcode, bool isLoadCheckpoint) { if (CampaignUtilities.IsCampaignLevel(levelBarcode, out var campaign, out var levelType) && campaign.SaveLevelAmmo && levelType == CampaignLevelType.MainLevel) { int levelIndex = campaign.GetLevelIndex(levelBarcode); try { AmmoInventory.Instance.ClearAmmo(); } catch { } CampaignLevel[] mainLevels = campaign.mainLevels; for (int i = 0; i < levelIndex; i++) { CampaignLevel level = mainLevels[i]; AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.lightAmmoGroup, campaign.saveData.GetSavedAmmo(level).LightAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.mediumAmmoGroup, campaign.saveData.GetSavedAmmo(level).MediumAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.heavyAmmoGroup, campaign.saveData.GetSavedAmmo(level).HeavyAmmo); } } } } [HarmonyPatch(typeof(AmmoInventory), "Awake")] public static class AmmoInventoryAwake { public static void Postfix() { string iD = ((Scannable)SceneStreamer.Session.Level).Barcode.ID; if (CampaignUtilities.IsCampaignLevel(iD, out var campaign, out var levelType) && levelType == CampaignLevelType.MainLevel) { int levelIndex = campaign.GetLevelIndex(iD); AmmoInventory.Instance.ClearAmmo(); for (int i = 0; i < levelIndex; i++) { AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.lightAmmoGroup, campaign.saveData.GetSavedAmmo(campaign.GetLevelBarcodeByIndex(i)).LightAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.mediumAmmoGroup, campaign.saveData.GetSavedAmmo(campaign.GetLevelBarcodeByIndex(i)).MediumAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.heavyAmmoGroup, campaign.saveData.GetSavedAmmo(campaign.GetLevelBarcodeByIndex(i)).HeavyAmmo); } if (SavepointFunctions.CurrentLevelLoadedByContinue) { CampaignSaveData.SavePoint loadedSavePoint = Campaign.Session.saveData.LoadedSavePoint; AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.lightAmmoGroup, loadedSavePoint.MidLevelAmmoSave.LightAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.mediumAmmoGroup, loadedSavePoint.MidLevelAmmoSave.MediumAmmo); AmmoInventory.Instance.AddCartridge(AmmoInventory.Instance.heavyAmmoGroup, loadedSavePoint.MidLevelAmmoSave.HeavyAmmo); } } } } public enum CampaignLevelType { None, Menu, MainLevel, ExtraLevel } public class Campaign { public string Name; public string PalletBarcode; public CampaignLevel MenuLevel; public CampaignLevel[] mainLevels; public CampaignLevel[] extraLevels; public string LoadScene; private MonoDisc _loadMusicDatacard; private AudioClip _loadSceneMusic; public bool ShowInMenu; public bool RestrictDevTools; public AvatarRestrictionType AvatarRestrictionType = AvatarRestrictionType.DisableBodyLog | AvatarRestrictionType.RestrictAvatar; private string defaultCampaignAvatar; private string fallbackAvatar; private string _cachedAvatar; public string[] WhitelistedAvatars; public bool SaveLevelInventory; public List<string> InventorySaveLimit = new List<string>(); public bool SaveLevelAmmo; public List<AchievementData> Achievements = new List<AchievementData>(); public bool LockInCampaign; public bool LockLevelsUntilEntered; public List<string> CampaignUnlockCrates = new List<string>(); public CampaignSaveData saveData; public static Campaign Session; public static string lastLoadedCampaignLevel; private static bool _sessionLocked; public static List<string> RegisteredJsonPaths = new List<string>(); public AudioClip LoadSceneMusic => _loadSceneMusic; public string CampaignAvatar { get { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (_cachedAvatar == string.Empty || _cachedAvatar == null) { if (MarrowGame.assetWarehouse.HasCrate(new Barcode(defaultCampaignAvatar))) { _cachedAvatar = defaultCampaignAvatar; } else { _cachedAvatar = fallbackAvatar; } } return _cachedAvatar; } } public CampaignLevel[] AllLevels { get { CampaignLevel[] array = mainLevels; CampaignLevel[] array2 = extraLevels; int num = 0; CampaignLevel[] array3 = new CampaignLevel[1 + (array.Length + array2.Length)]; CampaignLevel[] array4 = array; foreach (CampaignLevel campaignLevel in array4) { array3[num] = campaignLevel; num++; } CampaignLevel[] array5 = array2; foreach (CampaignLevel campaignLevel in array5) { array3[num] = campaignLevel; num++; } array3[num] = MenuLevel; return array3; } } public static bool SessionActive => Session != null; public static bool SessionLocked => SessionActive && _sessionLocked; internal static Campaign RegisterCampaign(CampaignLoadingData data) { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown Campaign campaign = new Campaign(); try { campaign.Name = data.Name; if (data.InitialLevel.levelBarcode == "null.empty.barcode") { campaign.MenuLevel = new CampaignLevel(data.MainLevels[0], CampaignLevelType.MainLevel); } else { campaign.MenuLevel = new CampaignLevel(data.InitialLevel, CampaignLevelType.Menu); } campaign.mainLevels = data.MainLevels.Select((SerializedLevelSetup l) => new CampaignLevel(l, CampaignLevelType.MainLevel)).ToArray(); campaign.extraLevels = data.ExtraLevels.Select((SerializedLevelSetup l) => new CampaignLevel(l, CampaignLevelType.ExtraLevel)).ToArray(); if (data.LoadScene == "null.empty.barcode") { campaign.LoadScene = "SLZ.BONELAB.CORE.Level.LevelModLevelLoad"; } else { campaign.LoadScene = data.LoadScene; } campaign.saveData = new CampaignSaveData(campaign); if (data.LoadSceneMusic != null && data.LoadSceneMusic != "null.empty.barcode") { MarrowGame.assetWarehouse.TryGetDataCard<MonoDisc>(new Barcode(data.LoadSceneMusic), ref campaign._loadMusicDatacard); campaign._loadMusicDatacard.AudioClip.LoadAsset(Action<AudioClip>.op_Implicit((Action<AudioClip>)delegate(AudioClip a) { campaign._loadSceneMusic = a; ((Object)campaign._loadSceneMusic).hideFlags = (HideFlags)32; })); } campaign.ShowInMenu = data.ShowInMenu; campaign.LockLevelsUntilEntered = data.UnlockableLevels; campaign.AvatarRestrictionType = data.AvatarRestrictionType; campaign.WhitelistedAvatars = data.WhitelistedAvatars.ToArray(); campaign.RestrictDevTools = data.RestrictDevTools; campaign.defaultCampaignAvatar = data.CampaignAvatar; campaign.fallbackAvatar = data.BaseGameFallbackAvatar; campaign.SaveLevelInventory = data.SaveLevelWeapons; campaign.InventorySaveLimit = data.InventorySaveLimit; campaign.SaveLevelAmmo = data.SaveLevelAmmo; campaign.Achievements = data.Achievements; campaign.LockInCampaign = data.LockInCampaign; if (data.CampaignUnlockCrates != null) { campaign.CampaignUnlockCrates = data.CampaignUnlockCrates; } if (campaign.Achievements != null) { foreach (AchievementData achievement in campaign.Achievements) { achievement.Init(); } } CampaignUtilities.LoadedCampaigns.Add(campaign); CampaignBoneMenu.CreateCampaignPage(BoneMenuCreator.campaignCategory, campaign); } catch (Exception ex) { MelonLogger.Error("Failed to register campaign " + data.Name + ": " + ex.Message); } return campaign; } public static Campaign RegisterCampaignFromJson(string json) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown JsonSerializerSettings val = new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)2, PreserveReferencesHandling = (PreserveReferencesHandling)1 }; CampaignLoadingData data = JsonConvert.DeserializeObject<CampaignLoadingData>(json, val); return RegisterCampaign(data); } public void Enter() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (LockInCampaign) { _sessionLocked = true; } Session = this; FadeLoader.Load(MenuLevel.Barcode, new Barcode(LoadScene)); } public void Exit() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0020: Expected O, but got Unknown _sessionLocked = false; FadeLoader.Load(new Barcode("fa534c5a868247138f50c62e424c4144.Level.VoidG114"), new Barcode("fa534c5a83ee4ec6bd641fec424c4142.Level.DefaultLoad")); } public int GetLevelIndex(string levelBarcode, CampaignLevelType levelType = CampaignLevelType.MainLevel) { return Array.IndexOf(GetBarcodeArrayOfLevelType(levelType), levelBarcode); } public string GetLevelBarcodeByIndex(int index, CampaignLevelType levelType = CampaignLevelType.MainLevel) { return GetBarcodeArrayOfLevelType(levelType)[index]; } private string[] GetBarcodeArrayOfLevelType(CampaignLevelType type) { return type switch { CampaignLevelType.Menu => new string[1] { MenuLevel.Barcode.ID }, CampaignLevelType.MainLevel => mainLevels.ToBarcodeStrings().ToArray(), CampaignLevelType.ExtraLevel => extraLevels.ToBarcodeStrings().ToArray(), _ => AllLevels.ToBarcodeStrings().ToArray(), }; } public CampaignLevelType TypeOfLevel(string barcode) { if (MenuLevel.Barcode.ID == barcode) { return CampaignLevelType.Menu; } if (mainLevels.ToBarcodeStrings().Contains(barcode)) { return CampaignLevelType.MainLevel; } return CampaignLevelType.ExtraLevel; } public CampaignLevel[] GetUnlockedLevels() { List<CampaignLevel> list = new List<CampaignLevel>(); list.Add(MenuLevel); CampaignLevel[] array = mainLevels; foreach (CampaignLevel campaignLevel in array) { if (saveData.UnlockedLevels.Contains(campaignLevel.sBarcode) || !LockLevelsUntilEntered) { list.Add(campaignLevel); } } CampaignLevel[] array2 = extraLevels; foreach (CampaignLevel campaignLevel2 in array2) { if (saveData.UnlockedLevels.Contains(campaignLevel2.sBarcode) || !LockLevelsUntilEntered) { list.Add(campaignLevel2); } } return list.ToArray(); } public static void OnInitialize() { Hooking.OnLevelLoaded += OnLevelLoaded; AssetWarehouse._onReady += Action.op_Implicit((Action)delegate { try { LoadCampaignsFromMods(); } catch (Exception ex) { MelonLogger.Error("Coudnt load the campaigns from the mods folder: " + ex.Message); } AssetWarehouse instance = AssetWarehouse.Instance; instance.OnPalletAdded += Action<Barcode>.op_Implicit((Action<Barcode>)delegate { LoadCampaignsFromMods(); }); }); } public static void LoadCampaignsFromMods() { string text = Path.Combine(Application.persistentDataPath, "Mods"); foreach (MelonMod registeredMelon in MelonTypeBase<MelonMod>.RegisteredMelons) { if (((MelonBase)registeredMelon).Info.Name == "RedirectModsFolder") { text = GetRedirectModsFolder(text); break; } } string[] directories = Directory.GetDirectories(text); string[] array = directories; foreach (string path in array) { string[] files = Directory.GetFiles(path, "campaign.json.bundle"); if (files.Length != 0 && !RegisteredJsonPaths.Contains(files[0])) { RegisteredJsonPaths.Add(files[0]); string json = File.ReadAllText(files[0]); try { RegisterCampaignFromJson(json); } catch { } } } } public static string GetRedirectModsFolder(string normalModsFolder) { Type typeFromHandle = typeof(Core); MelonPreferences_Entry<string> val = (MelonPreferences_Entry<string>)(typeFromHandle.GetField("pathEntry", BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null)); if (val.Value != "default" && val.Value != string.Empty) { return val.Value; } return normalModsFolder; } public static void OnLevelLoaded(LevelInfo info) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (CampaignUtilities.IsCampaignLevel(info.barcode, out Session, out var _)) { lastLoadedCampaignLevel = info.barcode; } } public static void OnUIRigCreated() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown if (SessionActive) { PopUpMenuView popUpMenu = Player.UIRig.popUpMenu; if (Session.RestrictDevTools && !Session.saveData.DevToolsUnlocked) { popUpMenu.crate_SpawnGun = new GenericCrateReference(new Barcode("null.empty.barcode")); popUpMenu.crate_Nimbus = new GenericCrateReference(new Barcode("null.empty.barcode")); } } } } public static class CampaignUtilities { public static List<Campaign> LoadedCampaigns = new List<Campaign>(); private static List<Campaign> _menuCampaigns; public static List<Campaign> CampaignsToShowInMenu { get { if (_menuCampaigns == null) { _menuCampaigns = LoadedCampaigns.Where((Campaign c) => c.ShowInMenu).ToList(); } return _menuCampaigns; } } public static Campaign GetFromName(string name) { return LoadedCampaigns.FirstOrDefault((Campaign x) => x.Name == name); } public static Campaign GetFromLevel(string barcode) { return LoadedCampaigns.FirstOrDefault((Campaign x) => x.AllLevels.Select((CampaignLevel l) => l.Barcode.ID).Contains(barcode)); } public static Campaign GetFromLevel(Barcode barcode) { return GetFromLevel(barcode.ID); } public static Campaign GetFromLevel(LevelCrateReference level) { return GetFromLevel(((ScannableReference)level).Barcode.ID); } public static Campaign GetFromLevel() { return GetFromLevel(((Scannable)SceneStreamer.Session.Level).Barcode.ID); } public static bool IsCampaignLevel(string levelBarcode) { return GetFromLevel(levelBarcode) != null; } public static bool IsCampaignLevel(string levelBarcode, out Campaign campaign, out CampaignLevelType levelType) { campaign = GetFromLevel(levelBarcode); if (campaign != null) { levelType = campaign.TypeOfLevel(levelBarcode); } else { levelType = CampaignLevelType.None; } return campaign != null; } } public class CampaignLevel { public Campaign campaign; public Barcode Barcode; private string overrideName = ""; public CampaignLevelType type; private LevelCrate _crate; public string Title { get { if (overrideName == string.Empty) { return ((Scannable)crate).Title; } return overrideName; } } public string sBarcode => Barcode.ID; public LevelCrate crate { get { if ((Object)(object)_crate != (Object)null) { return _crate; } MarrowGame.assetWarehouse.TryGetCrate<LevelCrate>(Barcode, ref _crate); return _crate; } } public bool isUnlocked => !campaign.LockLevelsUntilEntered || campaign.saveData.UnlockedLevels.Contains(sBarcode); public CampaignLevel(string barcode, string name, CampaignLevelType type) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Barcode = new Barcode(barcode); overrideName = name; this.type = type; } public CampaignLevel(SerializedLevelSetup levelSetup, CampaignLevelType type) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Barcode = new Barcode(levelSetup.levelBarcode); overrideName = levelSetup.levelName; this.type = type; } public static implicit operator Barcode(CampaignLevel c) { return c.Barcode; } public static implicit operator LevelCrate(CampaignLevel c) { return c.crate; } } public static class CampaignLevelListManipulation { public static List<string> ToBarcodeStrings(this CampaignLevel[] list) { return list.Select((CampaignLevel c) => c.Barcode.ID).ToList(); } public static List<Barcode> ToBarcodes(this CampaignLevel[] list) { return list.Select((CampaignLevel c) => c.Barcode).ToList(); } public static List<string> ToNames(this List<CampaignLevel> list) { return list.Select((CampaignLevel c) => c.Title).ToList(); } public static List<LevelCrate> ToCrates(this CampaignLevel[] list) { return (from c in list select c.crate into c where (Object)(object)c != (Object)null select c).ToList(); } } public class CampaignSaveData { public class SaveData { public SavePoint SavePoint { get; set; } public List<AmmoSave> AmmoSaves { get; set; } public Dictionary<string, InventoryData> InventorySaves { get; set; } public List<FloatData> FloatData { get; set; } public bool DevToolsUnlocked { get; set; } public bool AvatarUnlocked { get; set; } public List<string> UnlockedAchievements { get; set; } public List<string> UnlockedLevels { get; set; } } public struct SavePoint { public string LevelBarcode; public float PositionX; public float PositionY; public float PositionZ; public InventoryData InventoryData; public AmmoSave MidLevelAmmoSave; public List<BarcodePosRot> BoxContainedBarcodes; public List<string> DespawnedSpawners; public Dictionary<string, bool> ObjectEnabledSaves; public SavePoint() { LevelBarcode = null; PositionX = 0f; PositionY = 0f; PositionZ = 0f; InventoryData = null; MidLevelAmmoSave = default(AmmoSave); BoxContainedBarcodes = null; DespawnedSpawners = null; ObjectEnabledSaves = null; } public SavePoint(string levelBarcode, Vector3 position, InventoryData inventoryData, AmmoSave ammoSave, List<BarcodePosRot> boxContainedBarcodes, List<string> savedDespawns, Dictionary<string, bool> savedEnableds) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) LevelBarcode = levelBarcode; PositionX = position.x; PositionY = position.y; PositionZ = position.z; InventoryData = inventoryData; MidLevelAmmoSave = ammoSave; BoxContainedBarcodes = boxContainedBarcodes; DespawnedSpawners = savedDespawns; ObjectEnabledSaves = savedEnableds; } public bool IsValid(out bool hasSpawnPoint) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (GetPosition() == Vector3.zero) { hasSpawnPoint = false; } else { hasSpawnPoint = true; } if (LevelBarcode == null || LevelBarcode == string.Empty) { return false; } return true; } public void LoadContinue(Campaign campaign) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown LoadContinue(new Barcode(campaign.LoadScene)); } public void LoadContinue(Barcode loadScene) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (IsValid(out var _)) { SavepointFunctions.WasLastLoadByContinue = true; FadeLoader.Load(new Barcode(LevelBarcode), loadScene); } } public bool GetEnabledStateFromName(string name, bool defaultEnabled) { if (ObjectEnabledSaves.Keys.Contains(name)) { return ObjectEnabledSaves[name]; } return defaultEnabled; } public Vector3 GetPosition() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) return new Vector3(PositionX, PositionY, PositionZ); } } public struct BarcodePosRot { public string barcode; public float x; public float y; public float z; public float qX; public float qY; public float qZ; public float qW; public float sX; public float sY; public float sZ; public BarcodePosRot(Barcode barcode, Vector3 position, Quaternion rotation, Vector3 scale) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) this.barcode = barcode.ID; x = position.x; y = position.y; z = position.z; qX = rotation.x; qY = rotation.y; qZ = rotation.z; qW = rotation.w; sX = scale.x; sY = scale.y; sZ = scale.z; } public Vector3 GetPosition() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) return new Vector3(x, y, z); } public Quaternion GetRotation() { //IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(qX, qY, qZ, qW); } public Vector3 GetScale() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) return new Vector3(sX, sY, sZ); } } public struct AmmoSave { public string LevelBarcode { get; set; } public int LightAmmo { get; set; } public int MediumAmmo { get; set; } public int HeavyAmmo { get; set; } public int GetCombinedTotal() { return LightAmmo + MediumAmmo + HeavyAmmo; } } public class FloatData { public string Key; public float Value; public FloatData(string key) { Key = key; Value = 0f; base..ctor(); } } public Campaign campaign; internal SavePoint LoadedSavePoint; internal List<AmmoSave> LoadedAmmoSaves = new List<AmmoSave>(); internal Dictionary<string, InventoryData> LoadedInventorySaves = new Dictionary<string, InventoryData>(); internal List<FloatData> LoadedFloatDatas = new List<FloatData>(); internal bool DevToolsUnlocked = false; internal bool AvatarUnlocked = false; internal List<string> UnlockedAchievements = new List<string>(); internal List<string> UnlockedLevels = new List<string>(); public string SaveFolder => MelonUtils.UserDataDirectory + "/Campaigns/" + campaign.Name; public string SavePath => SaveFolder + "/save.json"; public CampaignSaveData(Campaign c) { campaign = c; LoadFromDisk(); } public void ResetSave() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown SaveToDisk(SaveFolder + "/save_backup.json"); ClearAmmoSave(); ClearSavePoint(); LoadedInventorySaves = new Dictionary<string, InventoryData>(); LoadedFloatDatas = new List<FloatData>(); DevToolsUnlocked = false; AvatarUnlocked = false; UnlockedAchievements = new List<string>(); UnlockedLevels = new List<string>(); foreach (string campaignUnlockCrate in campaign.CampaignUnlockCrates) { DataManager.ActiveSave.Unlocks.ClearUnlockForBarcode(new Barcode(campaignUnlockCrate)); } DataManager.TrySaveActiveSave((SaveFlags)0); SaveToDisk(); } public void SaveAmmoForLevel(string levelBarcode) { AmmoSave previousLevelsAmmoSave = GetPreviousLevelsAmmoSave(levelBarcode); if (!campaign.SaveLevelAmmo) { return; } if (!DoesSavedAmmoExist(levelBarcode)) { LoadedAmmoSaves.Add(new AmmoSave { LevelBarcode = levelBarcode, LightAmmo = AmmoInventory.Instance.GetCartridgeCount("light") - previousLevelsAmmoSave.LightAmmo, MediumAmmo = AmmoInventory.Instance.GetCartridgeCount("medium") - previousLevelsAmmoSave.MediumAmmo, HeavyAmmo = AmmoInventory.Instance.GetCartridgeCount("heavy") - previousLevelsAmmoSave.HeavyAmmo }); } else { AmmoSave savedAmmo = GetSavedAmmo(levelBarcode); for (int i = 0; i < LoadedAmmoSaves.Count; i++) { if (LoadedAmmoSaves[i].LevelBarcode == levelBarcode) { LoadedAmmoSaves[i] = new AmmoSave { LevelBarcode = levelBarcode, LightAmmo = Mathf.Max(AmmoInventory.Instance.GetCartridgeCount("light") - previousLevelsAmmoSave.LightAmmo, savedAmmo.LightAmmo), MediumAmmo = Mathf.Max(AmmoInventory.Instance.GetCartridgeCount("medium") - previousLevelsAmmoSave.MediumAmmo, savedAmmo.MediumAmmo), HeavyAmmo = Mathf.Max(AmmoInventory.Instance.GetCartridgeCount("heavy") - previousLevelsAmmoSave.HeavyAmmo, savedAmmo.HeavyAmmo) }; } } } campaign.saveData.SaveToDisk(); } public AmmoSave GetPreviousLevelsAmmoSave(string levelBarcode) { int levelIndex = campaign.GetLevelIndex(levelBarcode); AmmoSave result = default(AmmoSave); for (int i = 0; i < levelIndex; i++) { result.LightAmmo += GetSavedAmmo(campaign.mainLevels[i]).LightAmmo; result.MediumAmmo += GetSavedAmmo(campaign.mainLevels[i]).MediumAmmo; result.HeavyAmmo += GetSavedAmmo(campaign.mainLevels[i]).HeavyAmmo; } return result; } public AmmoSave GetSavedAmmo(CampaignLevel level) { return GetSavedAmmo(level.sBarcode); } public AmmoSave GetSavedAmmo(string levelBarcode) { return LoadedAmmoSaves.FirstOrDefault((AmmoSave x) => x.LevelBarcode == levelBarcode); } public bool DoesSavedAmmoExist(string levelBarcode) { if (LoadedAmmoSaves == null) { return false; } if (LoadedAmmoSaves.Count == 0) { return false; } if (LoadedAmmoSaves.Any((AmmoSave x) => x.LevelBarcode == levelBarcode)) { return true; } return false; } public void ClearAmmoSave() { LoadedAmmoSaves.Clear(); CampaignLevel[] mainLevels = campaign.mainLevels; foreach (CampaignLevel campaignLevel in mainLevels) { LoadedAmmoSaves.Add(new AmmoSave { LevelBarcode = campaignLevel.sBarcode, LightAmmo = 0, MediumAmmo = 0, HeavyAmmo = 0 }); } } public void SaveInventoryForLevel(string nextLevelBarcode) { LogNull(campaign, "Campaign"); if (campaign.SaveLevelInventory) { LogNull(Player.RigManager, "Player RigManager"); LogNull(campaign.InventorySaveLimit, "Inventory Save Limit"); InventoryData fromRigmanager = InventoryData.GetFromRigmanager(Player.RigManager, campaign.InventorySaveLimit); LogNull(LoadedInventorySaves, "LoadedInventorySaves"); LoadedInventorySaves[nextLevelBarcode] = fromRigmanager; } static void LogNull(object obj, string name) { if (obj == null) { MelonLogger.Error("HELLO EVRO, " + name.ToUpper() + " IS NULL"); } } } public InventoryData GetInventory(string levelBarcode) { foreach (string key in LoadedInventorySaves.Keys) { if (levelBarcode != key) { continue; } return LoadedInventorySaves[key]; } return null; } public void ClearSavePoint() { LoadedSavePoint = new SavePoint(); SaveToDisk(); } public void SavePlayer(string levelBarcode, Vector3 position, List<BarcodePosRot> boxBarcodes = null) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) InventoryData fromRigmanager = InventoryData.GetFromRigmanager(Player.RigManager); if (boxBarcodes == null) { boxBarcodes = new List<BarcodePosRot>(); } AmmoSave ammoSave = default(AmmoSave); if (campaign.SaveLevelAmmo && position != Vector3.zero) { AmmoSave previousLevelsAmmoSave = GetPreviousLevelsAmmoSave(levelBarcode); AmmoSave ammoSave2 = default(AmmoSave); ammoSave2.LevelBarcode = levelBarcode; ammoSave2.LightAmmo = AmmoInventory.Instance.GetCartridgeCount("light") - previousLevelsAmmoSave.LightAmmo; ammoSave2.MediumAmmo = AmmoInventory.Instance.GetCartridgeCount("medium") - previousLevelsAmmoSave.MediumAmmo; ammoSave2.HeavyAmmo = AmmoInventory.Instance.GetCartridgeCount("heavy") - previousLevelsAmmoSave.HeavyAmmo; ammoSave = ammoSave2; } List<string> list = new List<string>(); foreach (SpawnerDespawnSaver item in Object.FindObjectsOfType<SpawnerDespawnSaver>()) { if (item.DontSpawnAgain(out var id)) { list.Add(id); } } Dictionary<string, bool> dictionary = new Dictionary<string, bool>(); foreach (ObjectEnabledSaver item2 in Object.FindObjectsOfType<ObjectEnabledSaver>()) { dictionary.Add(((Object)((Component)item2).gameObject).name, ((Component)item2).gameObject.activeSelf); } LoadedSavePoint = new SavePoint(levelBarcode, position, fromRigmanager, ammoSave, boxBarcodes, list, dictionary); SaveToDisk(); } public void SetValue(string key, float value) { GetFloatDataEntry(key).Value = value; SaveToDisk(); } public float GetValue(string key) { return GetFloatDataEntry(key).Value; } private FloatData GetFloatDataEntry(string key) { FloatData floatData = null; try { floatData = LoadedFloatDatas.First((FloatData f) => f.Key == key); } catch { floatData = new FloatData(key); LoadedFloatDatas.Add(floatData); } return floatData; } public void UnlockDevTools() { DevToolsUnlocked = true; SaveToDisk(); } public void UnlockAvatar() { AvatarUnlocked = true; SaveToDisk(); } public bool UnlockAchievement(string key) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0131: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown if (UnlockedAchievements == null) { UnlockedAchievements = new List<string>(); } if (UnlockedAchievements.Contains(key)) { return false; } foreach (AchievementData achievement in campaign.Achievements) { if (achievement.Key != key) { continue; } if ((Object)(object)achievement.cachedTexture != (Object)null) { Notifier.Send(new Notification { CustomIcon = achievement.cachedTexture, Title = NotificationText.op_Implicit("Achievement Get: " + achievement.Name), Message = NotificationText.op_Implicit(achievement.Description), Type = (NotificationType)4, PopupLength = 5f, ShowTitleOnPopup = true }); } else { Notifier.Send(new Notification { Title = NotificationText.op_Implicit("Achievement Get: " + achievement.Name), Message = NotificationText.op_Implicit(achievement.Description), Type = (NotificationType)0, PopupLength = 5f, ShowTitleOnPopup = true }); } UnlockedAchievements.Add(key); SaveToDisk(); return true; } return false; } public void LockAchievement(string key) { if (UnlockedAchievements.Contains(key)) { UnlockedAchievements.Remove(key); } } public void UnlockLevel(string barcode) { if (!UnlockedLevels.Contains(barcode)) { UnlockedLevels.Add(barcode); } } internal void SaveToDisk(string overwritePath = "") { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a3: Expected O, but got Unknown if (!Directory.Exists(SaveFolder)) { Directory.CreateDirectory(SaveFolder); } SaveData saveData = new SaveData { SavePoint = LoadedSavePoint, AmmoSaves = LoadedAmmoSaves, InventorySaves = LoadedInventorySaves, FloatData = LoadedFloatDatas, DevToolsUnlocked = DevToolsUnlocked, AvatarUnlocked = AvatarUnlocked, UnlockedAchievements = UnlockedAchievements, UnlockedLevels = UnlockedLevels }; JsonSerializerSettings val = new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)2, PreserveReferencesHandling = (PreserveReferencesHandling)1 }; string contents = JsonConvert.SerializeObject((object)saveData, val); File.WriteAllText((overwritePath != string.Empty) ? overwritePath : SavePath, contents); } internal void LoadFromDisk() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0092: Expected O, but got Unknown if (!Directory.Exists(SaveFolder)) { Directory.CreateDirectory(SaveFolder); } if (!File.Exists(SavePath)) { ClearAmmoSave(); LoadedSavePoint = new SavePoint(); LoadedFloatDatas = new List<FloatData>(); DevToolsUnlocked = false; AvatarUnlocked = false; SaveToDisk(); return; } string text = File.ReadAllText(SavePath); JsonSerializerSettings val = new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)2, PreserveReferencesHandling = (PreserveReferencesHandling)1 }; SaveData saveData = JsonConvert.DeserializeObject<SaveData>(text, val); LoadedSavePoint = saveData.SavePoint; LoadedAmmoSaves = saveData.AmmoSaves; LoadedInventorySaves = saveData.InventorySaves ?? new Dictionary<string, InventoryData>(); LoadedFloatDatas = saveData.FloatData; DevToolsUnlocked = saveData.DevToolsUnlocked; AvatarUnlocked = saveData.AvatarUnlocked; UnlockedAchievements = saveData.UnlockedAchievements ?? new List<string>(); UnlockedLevels = saveData.UnlockedLevels ?? new List<string>(); } } public class InventoryData { public List<InventoryItem> InventoryItems = new List<InventoryItem>(); public void ApplyToRigmanager(RigManager rm) { for (int i = 0; i < InventoryItems.Count; i++) { InventoryItem item = InventoryItems[i]; try { InventorySlotReceiver inventorySlotReceiver = ((IEnumerable<SlotContainer>)rm.inventory.bodySlots).Where((SlotContainer s) => ((Object)((Component)s).gameObject).name == item.SlotName).First().inventorySlotReceiver; if ((Object)(object)inventorySlotReceiver != (Object)null) { item.SpawnInSlot(inventorySlotReceiver); } } catch { } } } public static InventoryData GetFromRigmanager(RigManager rm) { return GetFromRigmanager(rm, new List<string>()); } public static InventoryData GetFromRigmanager(RigManager rm, List<string> itemFilter) { InventoryData inventoryData = new InventoryData(); foreach (SlotContainer item in (Il2CppArrayBase<SlotContainer>)(object)rm.inventory.bodySlots) { if (!((Object)(object)item.inventorySlotReceiver == (Object)null)) { InventoryItem fromBodyslot = InventoryItem.GetFromBodyslot(item); if (!(fromBodyslot.Barcode == string.Empty) && (itemFilter.Count == 0 || itemFilter.Contains(fromBodyslot.Barcode))) { inventoryData.InventoryItems.Add(fromBodyslot); } } } return inventoryData; } } public struct InventoryItem { public string SlotName { get; set; } public string Barcode { get; set; } public InventoryItem(string SlotName, string Barcode) { this.SlotName = SlotName; this.Barcode = Barcode; } public InventoryItem() { SlotName = string.Empty; Barcode = string.Empty; } public void SpawnInSlot(InventorySlotReceiver slot) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Barcode != null && Barcode != string.Empty && (Object)(object)slot != (Object)null) { UniTask<bool> val = slot.SpawnInSlotAsync(new Barcode(Barcode)); } } public static InventoryItem GetFromBodyslot(SlotContainer slot) { if (slot.inventorySlotReceiver._weaponHost == null) { return new InventoryItem(); } Poolee poolee = ((MarrowBehaviour)slot.inventorySlotReceiver._slottedWeapon.interactableHost).marrowEntity._poolee; if ((Object)(object)poolee == (Object)null) { return new InventoryItem(); } if ((Object)(object)poolee.SpawnableCrate == (Object)null) { return new InventoryItem(); } return new InventoryItem(((Object)((Component)slot).gameObject).name, ((Scannable)poolee.SpawnableCrate).Barcode.ID); } } public struct GunInfo { public bool MagInserted; public bool MagAmmoCount; public bool RoundChambered; } [RegisterTypeInIl2Cpp] public class CrateDespawnerHook : MonoBehaviour { public Action<GameObject> OnDespawnDelegate { get; set; } public CrateDespawnerHook(IntPtr ptr) : base(ptr) { } private void OnDisable() { MarrowEntity componentInChildren = ((Component)this).gameObject.GetComponentInChildren<MarrowEntity>(); if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.IsDespawned) { OnDespawnDelegate(((Component)this).gameObject); Object.Destroy((Object)(object)this); } } } public static class PlayerMenuMangler { private static PreferencesPanelView panelView; public static GameObject optionsPanel; private static Transform _optionsGrid; private static GameObject _optionButton; private static Button _optionButtonComponent; public static Transform OptionsGrid { get { if (_optionsGrid == null || ((Il2CppObjectBase)_optionsGrid).WasCollected) { return null; } return _optionsGrid; } } public static void Initialize() { if (Campaign.SessionActive) { panelView = Player.UIRig.popUpMenu.preferencesPanelView; optionsPanel = ((Il2CppArrayBase<GameObject>)(object)panelView.pages)[panelView.defaultPage]; _optionsGrid = optionsPanel.transform.Find("grid_Options"); _optionButton = Object.Instantiate<GameObject>(((Component)_optionsGrid.GetChild(4)).gameObject, _optionsGrid); _optionButton.SetActive(true); TMP_Text componentInChildren = _optionButton.GetComponentInChildren<TMP_Text>(true); componentInChildren.text = "Exit Campaign"; _optionButton.transform.SetSiblingIndex(_optionsGrid.childCount - 1); _optionButtonComponent = _optionButton.GetComponent<Button>(); ((UnityEventBase)_optionButtonComponent.onClick).m_PersistentCalls.Clear(); ((UnityEventBase)_optionButtonComponent.onClick).m_Calls.ClearPersistent(); ((UnityEventBase)_optionButtonComponent.onClick).m_Calls.Clear(); ((UnityEvent)_optionButtonComponent.onClick).AddListener(UnityAction.op_Implicit((Action)Campaign.Session.Exit)); Transform val = _optionsGrid.Find("button_MainMenu"); Button componentInChildren2 = ((Component)val.Find("panel_MAINMENU")).GetComponentInChildren<Button>(true); ((UnityEventBase)componentInChildren2.onClick).m_PersistentCalls.Clear(); ((UnityEventBase)componentInChildren2.onClick).m_Calls.ClearPersistent(); ((UnityEventBase)componentInChildren2.onClick).m_Calls.Clear(); ((UnityEvent)componentInChildren2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown FadeLoader.Load(Campaign.Session.MenuLevel, new Barcode(Campaign.Session.LoadScene)); })); } } } public class FadeLoader { [CompilerGenerated] private sealed class <FadeCoroutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Barcode level; public Barcode loadScene; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0055: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; HelperMethods.SpawnCrate(LoadFadeBarcode, Vector3.zero, default(Quaternion), default(Vector3), false, (Action<GameObject>)null, (Action<GameObject>)null); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; if (loadScene == null) { loadScene = new Barcode("fa534c5a83ee4ec6bd641fec424c4142.Level.DefaultLoad"); } SceneStreamer.Load(level, loadScene); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly string LoadFadeBarcode = "c1534c5a-dac0-44a1-b656-6c235646584c"; public static void Load(Barcode level, Barcode loadScene) { MelonCoroutines.Start(FadeCoroutine(level, loadScene)); } [IteratorStateMachine(typeof(<FadeCoroutine>d__2))] public static IEnumerator FadeCoroutine(Barcode level, Barcode loadScene) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeCoroutine>d__2(0) { level = level, loadScene = loadScene }; } } public class MainMenuMangler { public static Sprite CampaignSprite; public static void OnLevelLoaded(LevelInfo info) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (info.barcode == "fa534c5a868247138f50c62e424c4144.Level.VoidG114") { MangleMainMenu(); } } public static void MangleMainMenu() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)GameObject.Find("CANVAS_UX").transform.Find("MENU").GetChild(8)).gameObject; GameObject CampaignGrid = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent); ((Object)CampaignGrid).name = "group_CAMPAIGNS"; CampaignGrid.transform.localPosition = Vector3.zero; CampaignGrid.transform.localRotation = gameObject.transform.localRotation; ((Component)CampaignGrid.transform.GetChild(0).GetChild(1)).GetComponent<TMP_Text>().text = "CAMPAIGNS"; BonelabLevelsPanelView componentInChildren = CampaignGrid.GetComponentInChildren<BonelabLevelsPanelView>(true); CampaignPanelView cPanel = ((Component)componentInChildren).gameObject.AddComponent<CampaignPanelView>(); cPanel.Buttons = Il2CppArrayBase<GameObject>.op_Implicit((Il2CppArrayBase<GameObject>)(object)componentInChildren.items); cPanel.nextButton = componentInChildren.forwardButton; cPanel.backButton = componentInChildren.backButton; cPanel.pageText = (TMP_Text)(object)componentInChildren.pageText; cPanel.SetupButtons(); Object.Destroy((Object)(object)componentInChildren); GameObject MainGrid = ((Component)GameObject.Find("CANVAS_UX").transform.Find("MENU").GetChild(3)).gameObject; GameObject gameObject2 = ((Component)MainGrid.transform.GetChild(4)).gameObject; GameObject val = Object.Instantiate<GameObject>(gameObject2, gameObject2.transform.parent); val.GetComponentInChildren<TMP_Text>(true).text = "CAMPAIGNS"; ButtonClickedEvent onClick = val.GetComponentInChildren<Button>(true).onClick; ((UnityEventBase)onClick).m_PersistentCalls.Clear(); ((UnityEventBase)onClick).m_Calls.ClearPersistent(); ((UnityEventBase)onClick).m_Calls.Clear(); ((UnityEvent)onClick).AddListener(UnityAction.op_Implicit((Action)delegate { MainGrid.SetActive(false); CampaignGrid.SetActive(true); cPanel.Activate(); })); Image component = ((Component)((Selectable)val.GetComponentInChildren<Button>(true)).targetGraphic).GetComponent<Image>(); if ((Object)(object)CampaignSprite != (Object)null && (Object)(object)component != (Object)null) { component.sprite = CampaignSprite; } CampaignGrid.SetActive(false); } public static void LoadSpriteFromEmbeddedResource(string resourceName, Assembly assembly, Vector2 pivot, float pixelsPerUnit = 100f) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) byte[] array = Array.Empty<byte>(); string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.Contains(resourceName)) { continue; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream == null) { return; } byte[] array2 = new byte[stream.Length]; stream.Read(array2, 0, array2.Length); array = array2; } Texture2D val = new Texture2D(2, 2); if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array))) { MelonLogger.Error("Failed to load texture from embedded resource."); return; } ((Object)val).hideFlags = (HideFlags)32; CampaignSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), pivot, pixelsPerUnit); ((Object)CampaignSprite).hideFlags = (HideFlags)32; } } [RegisterTypeInIl2Cpp] public class CampaignPanelView : MonoBehaviour { private int _currentPage; public GameObject[] Buttons; public GameObject backButton; public GameObject nextButton; public TMP_Text pageText; private bool _hasSelected = false; private int _lastPage => Mathf.FloorToInt((float)(CampaignUtilities.CampaignsToShowInMenu.Count / Buttons.Length)); public CampaignPanelView(IntPtr ptr) : base(ptr) { } public void SetupButtons() { for (int i = 0; i < Buttons.Length; i++) { Button component = Buttons[i].GetComponent<Button>(); ((UnityEventBase)component.onClick).m_PersistentCalls.Clear(); ((UnityEventBase)component.onClick).m_Calls.ClearPersistent(); ((UnityEventBase)component.onClick).m_Calls.Clear(); int selection = i; ((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { Select(selection); })); } } public void NextPage() { _currentPage = Mathf.Min(_lastPage, _currentPage + 1); UpdateVisualization(); } public void BackPage() { _currentPage = Mathf.Max(0, _currentPage - 1); UpdateVisualization(); } public void Select(int index) { if (!_hasSelected) { CampaignLogger.Msg(index); int index2 = Buttons.Length * _currentPage + index; Campaign campaign = CampaignUtilities.CampaignsToShowInMenu[index2]; _hasSelected = true; campaign.Enter(); } } public void Activate() { UpdateVisualization(); } private void UpdateVisualization() { if (_currentPage <= 0) { backButton.SetActive(false); } else { backButton.SetActive(true); } if (_currentPage >= _lastPage) { nextButton.SetActive(false); } else { nextButton.SetActive(true); } pageText.text = $"{_currentPage + 1}/{_lastPage + 1}"; for (int i = 0; i < Buttons.Length; i++) { GameObject val = Buttons[i]; int num = Buttons.Length * _currentPage + i; if (num < CampaignUtilities.CampaignsToShowInMenu.Count) { val.SetActive(true); val.GetComponentInChildren<TMP_Text>(true).text = CampaignUtilities.CampaignsToShowInMenu[num].Name; } else { val.SetActive(false); } } } } public class CampaignSelectionView : MonoBehaviour { public TMP_Text campaignTitle; public TMP_Text avatar; public Button menuButton; public Button continueButton; public Button backButton; public Campaign targetCampaign; public void SetupButtons() { ((UnityEventBase)menuButton.onClick).m_PersistentCalls.Clear(); ((UnityEventBase)menuButton.onClick).m_Calls.ClearPersistent(); ((UnityEventBase)menuButton.onClick).m_Calls.Clear(); ((UnityEvent)menuButton.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { Enter(); })); ((UnityEventBase)continueButton.onClick).m_PersistentCalls.Clear(); ((UnityEventBase)continueButton.onClick).m_Calls.ClearPersistent(); ((UnityEventBase)continueButton.onClick).m_Calls.Clear(); ((UnityEvent)continueButton.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { Continue(); })); } public void Activate(Campaign campaign) { targetCampaign = campaign; campaignTitle.text = campaign.Name; ((Component)continueButton).gameObject.SetActive(campaign.saveData.LoadedSavePoint.IsValid(out var _)); } public void Enter() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown FadeLoader.Load(targetCampaign.MenuLevel.Barcode, new Barcode(targetCampaign.LoadScene)); } public void Continue() { targetCampaign.saveData.LoadedSavePoint.LoadContinue(targetCampaign); } } public class AchievementData { public Texture2D cachedTexture; public string Key { get; set; } public bool Hidden { get; set; } public string IconGUID { get; set; } public byte[] IconBytes { get; set; } public string Name { get; set; } public string Description { get; set; } public void Init() { LoadIcon(); } public void LoadIcon() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (IconBytes.Length != 0) { cachedTexture = new Texture2D(2, 2); if (!ImageConversion.LoadImage(cachedTexture, Il2CppStructArray<byte>.op_Implicit(IconBytes), false)) { MelonLogger.Error("Failed to load texture from embedded resource."); return; } cachedTexture = cachedTexture.ProperResize(336, 336); ((Object)cachedTexture).hideFlags = (HideFlags)32; } } } internal class CampaignLoadingData { public string Name { get; set; } public SerializedLevelSetup InitialLevel { get; set; } public List<SerializedLevelSetup> MainLevels { get; set; } public List<SerializedLevelSetup> ExtraLevels { get; set; } public string LoadScene { get; set; } public string LoadSceneMusic { get; set; } public bool UnlockableLevels { get; set; } public bool ShowInMenu { get; set; } public bool RestrictDevTools { get; set; } public AvatarRestrictionType AvatarRestrictionType { get; set; } public string CampaignAvatar { get; set; } public string BaseGameFallbackAvatar { get; set; } public List<string> WhitelistedAvatars { get; set; } public bool SaveLevelWeapons { get; set; } public List<string> InventorySaveLimit { get; set; } public bool SaveLevelAmmo { get; set; } public List<AchievementData> Achievements { get; set; } public bool LockInCampaign { get; set; } public List<string> CampaignUnlockCrates { get; set; } } public class SerializedLevelSetup { public string levelBarcode; public string levelName; } [Flags] public enum AvatarRestrictionType { None = 0, DisableBodyLog = 1, RestrictAvatar = 2, EnforceWhitelist = 4 } internal class BuildInfo { internal const string Name = "Custom Campain Tools"; internal const string Description = "Allows Modders to add their own Campaign functionality to Marrow Campaigns."; internal const string Author = "EvroDev"; internal const string Company = "LabWorks"; internal const string Version = "1.0.0"; internal const string DownloadLink = ""; } internal class Main : MelonMod { public override void OnLateInitializeMelon() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) BoneMenuCreator.CreateBoneMenu(); Campaign.OnInitialize(); Hooking.OnLevelLoaded += LevelInitialized; Hooking.OnLevelUnloaded += LevelUnloaded; Hooking.OnUIRigCreated += OnUIRigCreated; string resourceName = "CampaignIcon.png"; Assembly assembly = ((MelonBase)this).MelonAssembly.Assembly; MainMenuMangler.LoadSpriteFromEmbeddedResource(resourceName, assembly, new Vector2(0.5f, 0.5f)); foreach (MelonMod registeredMelon in MelonTypeBase<MelonMod>.RegisteredMelons) { if (HelperMethods.CheckIfAssemblyLoaded("BrowsingPlus")) { PatchSwipezBecauseLemonloaderKeepsFuckingFailingIfIPutThisMethodInOnLateInitializeMelonForSomeReason(); } } } private void PatchSwipezBecauseLemonloaderKeepsFuckingFailingIfIPutThisMethodInOnLateInitializeMelonForSomeReason() { SwipezPanelPatches.ManualPatch(); } internal static void LevelInitialized(LevelInfo info) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) string barcode = info.barcode; MainMenuMangler.OnLevelLoaded(info); if (!CampaignUtilities.IsCampaignLevel(barcode, out var campaign, out var levelType) || levelType != CampaignLevelType.MainLevel) { return; } if (SavepointFunctions.CurrentLevelLoadedByContinue) { SavepointFunctions.LoadPlayerFromSave(); return; } campaign.saveData.SavePlayer(barcode, Vector3.zero); if (campaign.SaveLevelInventory && campaign.saveData.LoadedInventorySaves.ContainsKey(barcode)) { MelonCoroutines.Start(SavepointFunctions.ApplyInventoryDataAfterTime(campaign.saveData.LoadedInventorySaves[barcode])); } } private static void LevelUnloaded() { if (Campaign.SessionActive) { Campaign.Session.saveData.SaveAmmoForLevel(Campaign.lastLoadedCampaignLevel); } } private static void OnUIRigCreated() { PlayerMenuMangler.Initialize(); Campaign.OnUIRigCreated(); } } public static class SavepointFunctions { [CompilerGenerated] private sealed class <ApplyInventoryDataAfterTime>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public InventoryData invData; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyInventoryDataAfterTime>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; invData.ApplyToRigmanager(Player.RigManager); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool WasLastLoadByContinue; public static bool CurrentLevelLoadedByContinue; public static void LoadPlayerFromSave() { //IL_0049: 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_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) WasLastLoadByContinue = false; Campaign fromLevel = CampaignUtilities.GetFromLevel(); CampaignSaveData.SavePoint loadedSavePoint = fromLevel.saveData.LoadedSavePoint; if (!fromLevel.saveData.LoadedSavePoint.IsValid(out var hasSpawnPoint)) { return; } if (hasSpawnPoint) { Player.RigManager.Teleport(loadedSavePoint.GetPosition(), true); foreach (CampaignSaveData.BarcodePosRot barcode in loadedSavePoint.BoxContainedBarcodes) { HelperMethods.SpawnCrate(barcode.barcode, barcode.GetPosition(), barcode.GetRotation(), Vector3.one, false, (Action<GameObject>)delegate { CampaignLogger.Msg($"Successfully Spawned {barcode} in Box"); }, (Action<GameObject>)null); } } MelonCoroutines.Start(ApplyInventoryDataAfterTime(loadedSavePoint.InventoryData)); } [IteratorStateMachine(typeof(<ApplyInventoryDataAfterTime>d__3))] public static IEnumerator ApplyInventoryDataAfterTime(InventoryData invData) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyInventoryDataAfterTime>d__3(0) { invData = invData }; } } public static class Texture2DResizeExtension { public static Texture2D ProperResize(this Texture2D texture2D, int width, int height) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) RenderTexture val2 = (RenderTexture.active = new RenderTexture(width, height, 24)); Graphics.Blit((Texture)(object)texture2D, val2); Texture2D val3 = new Texture2D(width, height); val3.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0); val3.Apply(); Object.Destroy((Object)(object)val2); return val3; } } } namespace CustomCampaignTools.LabWorks { [RegisterTypeInIl2Cpp] public class Control_MonoMat : MonoBehaviour { private CrateSpawner[] _loots; private List<Rigidbody> _lootBodies; private HingeController _doorLeverCircuit; private ValueCircuit _doorMotorCircuit; private int _multiplier; private int _itemPrice; private int _lightBullets; private int _mediumBullets; private int _heavyBullets; private bool _opened; private bool _unlocked; private TMP_Text _bulletBalanceTextmesh; private TMP_Text _refundTextmesh; private AmmoReciever reciever; private string lightRefundSpawnable; private string mediumRefundSpawnable; private string heavyRefundSpawnable; private AudioClip _openedClip; private AudioClip _unlockedClip; private AudioClip _lockedClip; private Transform giveChangeTransform; private bool _hasFields = false; private int _trueItemPrice => _itemPrice * _multiplier; private int _totalBullets => _lightBullets + _mediumBullets + _heavyBullets; public Control_MonoMat(IntPtr ptr) : base(ptr) { } public void SetLootsFromParent(GameObject parent) { _loots = Il2CppArrayBase<CrateSpawner>.op_Implicit(parent.GetComponentsInChildren<CrateSpawner>()); } public void StartFields(GameObject lootParent, int itemPrice, int multiplier, TMP_Text _bulletBalanceTextmesh, TMP_Text _refundTextmesh, AmmoReciever reciever, string lightRefundSpawnable, string mediumRefundSpawnable, string heavyRefundSpawnable, AudioClip openedClip, AudioClip unlockedClip, AudioClip lockedClip, Transform giveChangeTransform) { SetLootsFromParent(lootParent); _itemPrice = itemPrice; _multiplier = multiplier; this._bulletBalanceTextmesh = _bulletBalanceTextmesh; this._refundTextmesh = _refundTextmesh; this.reciever = reciever; this.lightRefundSpawnable = lightRefundSpawnable; this.mediumRefundSpawnable = mediumRefundSpawnable; this.heavyRefundSpawnable = heavyRefundSpawnable; _openedClip = openedClip; _unlockedClip = unlockedClip; _lockedClip = lockedClip; this.giveChangeTransform = giveChangeTransform; _hasFields = true; SafeStart(); } private void SafeStart() { AmmoReciever obj = reciever; obj.OnInserted += Action<Magazine>.op_Implicit((Action<Magazine>)delegate(Magazine g) { InsertMagazine(g); }); _bulletBalanceTextmesh.text = _trueItemPrice.ToString(); _doorMotorCircuit.Value = 1f; CrateSpawner[] loots = _loots; foreach (CrateSpawner val in loots) { ((UltEvent<CrateSpawner, GameObject>)(object)val.onSpawnEvent).PersistentCalls += Action<CrateSpawner, GameObject>.op_Implicit((Action<CrateSpawner, GameObject>)delegate(CrateSpawner c, GameObject g) { OnLootSpawned(c, g); }); } } public void OnLootSpawned(CrateSpawner spawner, GameObject entity) { foreach (Rigidbody componentsInChild in entity.GetComponentsInChildren<Rigidbody>()) { componentsInChild.isKinematic = true; _lootBodies.Add(componentsInChild); } } public void GiveChange() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (_lightBullets > 0) { HelperMethods.SpawnCrate(lightRefundSpawnable, giveChangeTransform.position, giveChangeTransform.rotation, Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null); } if (_mediumBullets > 0) { HelperMethods.SpawnCrate(mediumRefundSpawnable, giveChangeTransform.position, giveChangeTransform.rotation, Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null); } if (_heavyBullets > 0) { HelperMethods.SpawnCrate(heavyRefundSpawnable, giveChangeTransform.position, giveChangeTransform.rotation, Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null); } _lightBullets = 0; _mediumBullets = 0; _heavyBullets = 0; _refundTextmesh.text = "0"; } public void PurchaseItem() { if (_totalBullets < _trueItemPrice) { _doorMotorCircuit.Value = 1f; return; } int trueItemPrice = _trueItemPrice; trueItemPrice = CleanupLight(trueItemPrice); trueItemPrice = CleanupMedium(trueItemPrice); CleanupHeavy(trueItemPrice); foreach (Rigidbody lootBody in _lootBodies) { lootBody.isKinematic = false; } _refundTextmesh.text = _totalBullets.ToString(); } private int CleanupLight(int ammoToRemove) { if (ammoToRemove > _lightBullets) { ammoToRemove -= _lightBullets; _lightBullets = 0; } else { _lightBullets -= ammoToRemove; ammoToRemove = 0; } return ammoToRemove; } private int CleanupMedium(int ammoToRemove) { if (ammoToRemove > _lightBullets) { ammoToRemove -= _mediumBullets; _mediumBullets = 0; } else { _mediumBullets -= ammoToRemove; ammoToRemove = 0; } return ammoToRemove; } private int CleanupHeavy(int ammoToRemove) { if (ammoToRemove > _heavyBullets) { ammoToRemove -= _heavyBullets; _heavyBullets = 0; } else { _heavyBullets -= ammoToRemove; ammoToRemove = 0; } return ammoToRemove; } public void InsertMagazine(Magazine magazine) { AddBullets(magazine.magazineState.AmmoCount, 0); if (_totalBullets >= _trueItemPrice && !_unlocked && !_opened) { _unlocked = true; _doorMotorCircuit.Value = 0f; } } public void AddBullets(int addedBullets, int type) { switch (type) { case 0: _lightBullets += addedBullets; break; case 1: _mediumBullets += addedBullets; break; default: if (type == 1) { _heavyBullets += addedBullets; } break; } _bulletBalanceTextmesh.text = Mathf.Max((float)(_trueItemPrice - _totalBullets), 0f).ToString(); _refundTextmesh.text = _totalBullets.ToString(); } public Rigidbody[] GetLoots() { return _lootBodies.ToArray(); } public void SetPrice(int price, int mult) { _itemPrice = price; _multiplier = mult; } public void SetLoots(Rigidbody[] loots) { } } } namespace CustomCampaignTools.Patching { [HarmonyPatch(typeof(SceneStreamer))] public static class LevelLoadingPatches { [HarmonyPatch("LoadAsync", new Type[] { typeof(LevelCrateReference), typeof(LevelCrateReference) })] [HarmonyPrefix] public static bool LoadPrefixPatch(LevelCrateReference level, ref LevelCrateReference loadLevel, ref UniTask __result) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown Campaign fromLevel = CampaignUtilities.GetFromLevel(level); SavepointFunctions.CurrentLevelLoadedByContinue = SavepointFunctions.WasLastLoadByContinue; SavepointFunctions.WasLastLoadByContinue = false; if (Campaign.SessionActive && fromLevel == Campaign.Session && Campaign.Session.TypeOfLevel(((ScannableReference)level).Barcode.ID) == CampaignLevelType.MainLevel && Campaign.Session.TypeOfLevel(((Scannable)SceneStreamer.Session.Level).Barcode.ID) == CampaignLevelType.MainLevel && Campaign.Session.GetLevelIndex(((ScannableReference)level).Barcode.ID) == Campaign.Session.GetLevelIndex(((Scannable)SceneStreamer.Session.Level).Barcode.ID) + 1) { Campaign.Session.saveData.SaveInventoryForLevel(((ScannableReference)level).Barcode.ID); } if (fromLevel != null) { fromLevel.saveData.UnlockLevel(((ScannableReference)level).Barcode.ID); if (((ScannableReference)loadLevel).Barcode.ID != fromLevel.LoadScene) { loadLevel = new LevelCrateReference(new Barcode(fromLevel.LoadScene)); } Campaign.Session = fromLevel; } return true; } } [HarmonyPatch(typeof(Audio2dManager))] public static class LoadMusicPatches { [HarmonyPatch("CueMusicInternal")] [HarmonyPrefix] public static void CueMusicPatch(Audio2dManager __instance, ref AudioClip musicClip) { if (((Object)musicClip).name == "music_LoadingSplash" && Campaign.SessionActive && (Object)(object)Campaign.Session.LoadSceneMusic != (Object)null) { musicClip = Campaign.Session.LoadSceneMusic; } } [HarmonyPatch("StopSpecificMusic")] [HarmonyPrefix] public static void StopMusicPatch(Audio2dManager __instance, ref AudioClip specificClip) { if (((Object)specificClip).name == "music_LoadingSplash" && Campaign.SessionActive && (Object)(object)Campaign.Session.LoadSceneMusic != (Object)null) { specificClip = Campaign.Session.LoadSceneMusic; } } } [HarmonyPatch(typeof(LevelsPanelView))] public static class LevelsPanelPatches { public static bool SwipezActive; [HarmonyPatch("CalculateSceneList")] [HarmonyPostfix] public static void PopulatePostfix(LevelsPanelView __instance) { ForceLevelList(__instance); } public static void ForceLevelList(LevelsPanelView __instance) { if (SwipezActive) { return; } if (Campaign.SessionLocked) { __instance._levelCrates.Clear(); CampaignLevel[] unlockedLevels = Campaign.Session.GetUnlockedLevels(); CampaignLevel[] array = unlockedLevels; foreach (CampaignLevel campaignLevel in array) { if (!((Scannable)campaignLevel.crate).Redacted) { __instance._levelCrates.Add(campaignLevel.crate); } } __instance._totalScenes = __instance._levelCrates.Count; __instance._numberOfPages = __instance._levelCrates.Count / ((Il2CppArrayBase<GameObject>)(object)__instance.items).Length + 1; return; } Campaign campaign = null; if (Campaign.SessionActive) { campaign = Campaign.Session; } List<LevelCrate> levelCrates = __instance._levelCrates; List<LevelCrate> list = new List<LevelCrate>(levelCrates.Count); Enumerator<LevelCrate> enumerator = levelCrates.GetEnumerator(); while (enumerator.MoveNext()) { LevelCrate current = enumerator.Current; list.Add(current); } List<LevelCrate> source = list; List<LevelCrate> list2 = source.Where((LevelCrate crate) => ((Scannable)((Crate)crate).Pallet).Barcode.ID.StartsWith("SLZ")).ToList(); List<LevelCrate> list3 = source.Where((LevelCrate crate) => !((Scannable)((Crate)crate).Pallet).Barcode.ID.StartsWith("SLZ") && !CampaignUtilities.IsCampaignLevel(((Scannable)crate).Barcode.ID)).ToList(); List<LevelCrate> list4 = new List<LevelCrate>(); foreach (Campaign loadedCampaign in CampaignUtilities.LoadedCampaigns) { if (campaign == null || campaign != loadedCampaign) { list4.AddRange(loadedCampaign.GetUnlockedLevels().ToCrates()); } } List<LevelCrate> list5 = list2; List<LevelCrate> list6 = list4; List<LevelCrate> list7 = list3; List<LevelCrate> list8 = new List<LevelCrate>(list5.Count + list6.Count + list7.Count); list8.AddRange(list5); list8.AddRange(list6); list8.AddRange(list7); List<LevelCrate> list9 = list8; if (campaign != null) { list9.InsertRange(0, campaign.GetUnlockedLevels().ToCrates()); } __instance._levelCrates.Clear(); foreach (LevelCrate item in list9) { __instance._levelCrates.Add(item); } __instance._totalScenes = list9.Count; __instance._numberOfPages = list9.Count / ((Il2CppArrayBase<GameObject>)(object)__instance.items).Length + 1; } } public static class SwipezPanelPatches { private static Dictionary<Campaign, PanelContainer> campaignToContainerOpen = new Dictionary<Campaign, PanelContainer>(); private static Dictionary<LevelPanelOverride, PanelContainer> mainToCampaignContainer = new Dictionary<LevelPanelOverride, PanelContainer>(); public static void ManualPatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown Harmony val = new Harmony("swipez.panel.populate"); val.Patch((MethodBase)typeof(LevelPanelOverride).GetMethod("PopulateMenus"), (HarmonyMethod)null, new HarmonyMethod(typeof(SwipezPanelPatches), "MenuPopulationOverride", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)typeof(LevelPanelOverride).GetMethod("OnInitialized"), (HarmonyMethod)null, new HarmonyMethod(typeof(SwipezPanelPatches), "MenuInitContainerOverride", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LevelsPanelPatches.SwipezActive = true; } public static void MenuPopulationOverride(LevelPanelOverride __instance) { PanelContainer orMakeCampaignContainer = __instance.GetOrMakeCampaignContainer("Campaigns"); orMakeCampaignContainer.Clear(); campaignToContainerOpen.Clear(); foreach (Campaign c in CampaignUtilities.CampaignsToShowInMenu) { PanelContainer val = orMakeCampaignContainer.MakeContainer(c.Name); campaignToContainerOpen.Add(c, val); CampaignLevel[] unlockedLevels = c.GetUnlockedLevels(); foreach (CampaignLevel level in unlockedLevels) { if (Object.op_Implicit((Object)(object)level.crate) && !((Scannable)level.crate).Redacted) { val.AddEntry(level.Title, (Action)delegate { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown FadeLoader.Load(level.Barcode, new Barcode(c.LoadScene)); }); } } } } public static PanelContainer GetOrMakeCampaignContainer(this LevelPanelOverride container, string name) { if (!mainToCampaignContainer.ContainsKey(container)) { mainToCampaignContainer.Add(container, container.mainContainer.MakeContainer(name)); } return mainToCampaignContainer[container]; } public static void MenuInitContainerOverride(LevelPanelOverride __instance) { if (Campaign.SessionActive) { if (campaignToContainerOpen.Keys.Contains(Campaign.Session)) { ((PanelOverrider)__instance).OpenContainer(campaignToContainerOpen[Campaign.Session], 0); } if (Campaign.SessionLocked) { campaignToContainerOpen[Campaign.Session].parent = null; } else { campaignToContainerOpen[Campaign.Session].parent = __instance.mainContainer; } } } } [HarmonyPatch(typeof(HideOnAwake))] public static class HideOnAwakePatches { [HarmonyPatch("Awake")] [HarmonyPostfix] public static void UnhideInCampaign(HideOnAwake __instance) { UnhideInCampaign unhideInCampaign = default(UnhideInCampaign); if (((Component)__instance).TryGetComponent<UnhideInCampaign>(ref unhideInCampaign)) { ((Component)__instance).gameObject.SetActive(true); Object.Destroy((Object)(object)__instance); } } } [HarmonyPatch(typeof(PullCordDevice))] public static class BodylogEnablePatches { [HarmonyPatch("OnEnable")] [HarmonyPostfix] public static void OnBodyLogEnabled(PullCordDevice __instance) { if (Campaign.SessionActive && !Campaign.Session.saveData.AvatarUnlocked && Campaign.Session.AvatarRestrictionType.HasFlag(AvatarRestrictionType.DisableBodyLog)) { ((Component)__instance).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(AvatarsPanelView))] public static class AvatarPanelEnable { [HarmonyPatch("Activate")] [HarmonyPostfix] public static void OnPanelEnabled(AvatarsPanelView __instance) { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if (Campaign.SessionActive && !Campaign.Session.saveData.AvatarUnlocked && Campaign.Session.AvatarRestrictionType.HasFlag(AvatarRestrictionType.RestrictAvatar)) { ((PanelView)__instance).Deactivate(); ((PanelView)__instance).popUpMenu.Deactivate(); Notifier.Send(new Notification { Title = NotificationText.op_Implicit(Campaign.Session.Name), Message = NotificationText.op_Implicit("Avatar switching is currently locked"), Type = (NotificationType)2, ShowTitleOnPopup = true }); } } } [HarmonyPatch(typeof(RigManager))] public static class ForceAvatarSwitch { [HarmonyPatch("SwapAvatarCrate")] [HarmonyPrefix] public static void OnAvatarSwapped(RigManager __instance, ref Barcode barcode, ref UniTask<bool> __result) { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown if (!Campaign.SessionActive || Campaign.Session.saveData.AvatarUnlocked) { return; } if (Campaign.Session.AvatarRestrictionType.HasFlag(AvatarRestrictionType.EnforceWhitelist)) { if (!Campaign.Session.WhitelistedAvatars.Contains(barcode.ID)) { Notifier.Send(new Notification { Title = NotificationText.op_Implicit(Campaign.Session.Name), Message = NotificationText.op_Implicit("This avatar is not allowed at this time"), Type = (NotificationType)2, ShowTitleOnPopup = true }); if (Campaign.Session.WhitelistedAvatars.Contains(((ScannableReference)__instance.AvatarCrate).Barcode.ID)) { barcode = ((ScannableReference)__instance.AvatarCrate).Barcode; } else { barcode = new Barcode(Campaign.Session.WhitelistedAvatars[0]); } } } else if ((Campaign.Session.AvatarRestrictionType & AvatarRestrictionType.RestrictAvatar) != 0) { barcode = new Barcode(Campaign.Session.CampaignAvatar); } } } } namespace CustomCampaignTools.SDK { [RegisterTypeInIl2Cpp] public class ObjectEnabledSaver : MonoBehaviour { public ObjectEnabledSaver(IntPtr ptr) : base(ptr) { } public void Awake() { if (SavepointFunctions.CurrentLevelLoadedByContinue) { RestoreActiveState(Campaign.Session.saveData.LoadedSavePoint); } } public void RestoreActiveState(CampaignSaveData.SavePoint savePoint) { ((Component)this).gameObject.SetActive(savePoint.GetEnabledStateFromName(((Object)((Component)this).gameObject).name, ((Component)this).gameObject.activeSelf)); } } [RegisterTypeInIl2Cpp] public class SpawnerDespawnSaver : MonoBehaviour { public bool LoadedFromSave = false; private GameObject _objectToSave; private bool saveDontSpawn; public SpawnerDespawnSaver(IntPtr ptr) : base(ptr) { } public void Awake() { if (SavepointFunctions.CurrentLevelLoadedByContinue) { LoadedFromSave = true; } } public void Setup(CrateSpawner c, GameObject g) { _objectToSave = g; Poolee val = default(Poolee); if (g.TryGetComponent<Poolee>(ref val)) { CrateDespawnerHook crateDespawnerHook = g.AddComponent<CrateDespawnerHook>(); crateDespawnerHook.OnDespawnDelegate = (Action<GameObject>)Delegate.Combine(crateDespawnerHook.OnDespawnDelegate, (Action<GameObject>)delegate { saveDontSpawn = true; }); } AIBrain componentInChildren = g.GetComponentInChildren<AIBrain>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.onDeathDelegate += Action<AIBrain>.op_Implicit((Action<AIBrain>)delegate { saveDontSpawn = true; }); } Poolee val2 = default(Poolee); if (LoadedFromSave && Campaign.Session.saveData.LoadedSavePoint.DespawnedSpawners.Contains(GetCrateID()) && g.TryGetComponent<Poolee>(ref val2)) { val2.Despawn(); } } public bool DontSpawnAgain(out string id) { id = GetCrateID(); return saveDontSpawn; } public string GetCrateID() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; return ((Vector3)(ref position)).ToString("F2"); } } [RegisterTypeInIl2Cpp] public class HideInCampaign : MonoBehaviour { public HideInCampaign(IntPtr ptr) : base(ptr) { } private void Awake() { ((Component)this).gameObject.SetActive(false); } } [RegisterTypeInIl2Cpp] public class TriggerableNotification : MonoBehaviour { public TriggerableNotification(IntPtr ptr) : base(ptr) { } public void SendNotification(string Title, string Message, Texture2D CustomIcon, NotifType Type, float Length) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_005c: Expected O, but got Unknown Texture2D customIcon = CustomIcon.ProperResize(336, 336); Notifier.Send(new Notification { Title = NotificationText.op_Implicit(Title), Message = NotificationText.op_Implicit(Message), CustomIcon = customIcon, Type = (NotificationType)Type, PopupLength = Length, ShowTitleOnPopup = (Title != string.Empty) }); } } public enum NotifType { Information, Warning, Error, Success, CustomIcon } [RegisterTypeInIl2Cpp] public class AchievementDisplay : MonoBehaviour { public AchievementReferenceHolder[] achievementViews; private int _currentPage; public Button nextButton; public Button backButton; public TMP_Text pageText; public TMP_Text unlockCount; private int _lastPage => Mathf.FloorToInt((float)(Campaign.Session.Achievements.Count / achievementViews.Length)); public AchievementDisplay(IntPtr ptr) : base(ptr) { } public void Awake() { achievementViews = Il2CppArrayBase<AchievementReferenceHolder>.op_Implicit(((Component)this).GetComponentsInChildren<AchievementReferenceHolder>(true)); ((UnityEvent)nextButton.onClick).AddListener(UnityAction.op_Implicit((Action)NextPage)); ((UnityEvent)backButton.onClick).AddListener(UnityAction.op_Implicit((Action)PrevPage)); } public void Activate() { UpdateVisualization(); } public void NextPage() { _currentPage = Mathf.Min(_lastPage, _currentPage + 1); UpdateVisualization(); } public void PrevPage() { _currentPage = Mathf.Max(0, _currentPage - 1); UpdateVisualization(); } private void UpdateVisualization() { if (_currentPage <= 0) { ((Component)backButton).gameObject.SetActive(false); } else { ((Component)backButton).gameObject.SetActive(true); } if (_currentPage >= _lastPage) { ((Component)nextButton).gameObject.SetActive(false); } else { ((Component)nextButton).gameObject.SetActive(true); } if ((Object)(object)pageText != (Object)null) { pageText.text = $"{_currentPage + 1}/{_lastPage + 1}"; } for (int i = 0; i < achievementViews.Length; i++) { AchievementReferenceHolder achievementReferenceHolder = achievementViews[i]; int num = achievementViews.Length * _currentPage + i; if (num < Campaign.Session.Achievements.Count) { ((Component)achievementReferenceHolder).gameObject.SetActive(true); achievementReferenceHolder.ShowAchievement(Campaign.Session.Achievements[num]); } else { ((Component)achievementReferenceHolder).gameObject.SetActive(false); } } if ((Object)(object)unlockCount != (Object)null) { unlockCount.text = $"{Campaign.Session.saveData.UnlockedAchievements.Count}/{Campaign.Session.Achievements.Count} Achievements Unlocked"; } } } [RegisterTypeInIl2Cpp] public class AchievementReferenceHolder : MonoBehaviour { public Image achievementIcon; public TMP_Text titleTMP; public TMP_Text descriptionTMP; public AchievementReferenceHolder(IntPtr ptr) : base(ptr) { } public void ShowAchievement(AchievementData achievement) { //IL_007e: 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) bool flag = Campaign.Session.saveData.UnlockedAchievements.Contains(achievement.Key); titleTMP.text = achievement.Name; descriptionTMP.text = (flag ? achievement.Description : ((!achievement.Hidden) ? achievement.Description : "???")); ((Graphic)achievementIcon).color = (Color)(flag ? Color.white : new Color(0.5f, 0.5f, 0.5f, 1f)); } } [RegisterTypeInIl2Cpp] public class AmmoScoreDisplay : MonoBehaviour { public AmmoScoreDisplay(IntPtr ptr) : base(ptr) { } public void SetTargetBarcode(string barcode) { Campaign fromLevel = CampaignUtilities.GetFromLevel(barcode); CampaignSaveData.AmmoSave savedAmmo = fromLevel.saveData.GetSavedAmmo(barcode); ((Component)this).GetComponent<TMP_Text>().text = savedAmmo.GetCombinedTotal().ToString(); } } [RegisterTypeInIl2Cpp] public class CampaignAchievementManager : MonoBehaviour { public CampaignAchievementManager(IntPtr ptr) : base(ptr) { } public bool UnlockAchievement(string Key) { if (Campaign.SessionActive) { return Campaign.Session.saveData.UnlockAchievement(Key); } return false; } public void RelockAchievement(string Key) { if (Campaign.SessionActive) { Campaign.Session.saveData.LockAchievement(Key); } } } [RegisterTypeInIl2Cpp] public class CampaignUnlocking : MonoBehaviour { public CampaignUnlocking(IntPtr ptr) : base(ptr) { } public void UnlockDevTools(bool enableInstantly) { Campaign.Session.saveData.UnlockDevTools(); if (enableInstantly) { UIRig.Instance.popUpMenu.AddDevMenu((Action)null); } } public void UnlockAvatars(bool enableInstantly) { Campaign.Session.saveData.UnlockAvatar(); if (enableInstantly) { PullCordDevice componentInChildren = ((Component)Player.PhysicsRig).GetComponentInChildren<PullCordDevice>(true); if (componentInChildren != null) { ((Component)componentInChildren).gameObject.SetActive(true); } UIRig.Instance.popUpMenu.AddAvatarsMenu(); } } public void UnlockLevel(string barcode) { Campaign.Session.saveData.UnlockLevel(barcode); } public void ResetSave() { Campaign.Session.saveData.ResetSave(); } public void UNLOCKALL() { UnlockDevTools(enableInstantly: true); UnlockAvatars(enableInstantly: true); CampaignLevel[] allLevels = Campaign.Session.AllLevels; foreach (CampaignLevel campaignLevel in allLevels) { UnlockLevel(campaignLevel.sBarcode); } } } [RegisterTypeInIl2Cpp] public class ContinueCampaign : MonoBehaviour { public ContinueCampaign(IntPtr ptr) : base(ptr) { } public void Continue() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown Campaign fromLevel = CampaignUtilities.GetFromLevel(); if (fromLevel.saveData.LoadedSavePoint.IsValid(out var _)) { fromLevel.saveData.LoadedSavePoint.LoadContinue(new Barcode(fromLevel.LoadScene)); } } public void EnableIfValidSave(GameObject obj) { Campaign fromLevel = CampaignUtilities.GetFromLevel(); if (fromLevel.saveData.LoadedSavePoint.IsValid(out var _)) { obj.SetActive(true); } } } [RegisterTypeInIl2Cpp] public class InvokeInCampaign : MonoBehaviour { public InvokeInCampaign(IntPtr ptr) : base(ptr) { } private void Awake() { UltEventHolder val = default(UltEventHolder); if (((Component)this).TryGetComponent<UltEventHolder>(ref val)) { val.Invoke(); } } } [RegisterTypeInIl2Cpp] public class SavePoint : MonoBehaviour { public SavePoint(IntPtr ptr) : base(ptr) { } public void Save() { //IL_01ce: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) string iD = ((Scannable)SceneStreamer.Session.Level).Barcode.ID; BoxCollider val = default(BoxCollider); if (((Component)this).TryGetComponent<BoxCollider>(ref val)) { HashSet<MarrowEntity> hashSet = new HashSet<MarrowEntity>(); Bounds bounds = ((Collider)val).bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = ((Collider)val).bounds; Collider[] array = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, Quaternion.identity, 67108864, (QueryTriggerInteraction)2)); Collider[] array2 = array; Tracker val3 = default(Tracker); foreach (Collider val2 in array2) { if (!((Component)val2).TryGetComponent<Tracker>(ref val3) || (Object)(object)val3.Entity == (Object)null) { continue; } try { if (((Scannable)val3.Entity._poolee.SpawnableCrate).Barcode.ID == "SLZ.BONELAB.Core.Spawnable.RigManagerBlank") { continue; } } catch { } hashSet.Add(val3.Entity); } List<CampaignSaveData.BarcodePosRot> list = new List<CampaignSaveData.BarcodePosRot>(); foreach (MarrowEntity item in hashSet) { if (!((Object)(object)item._poolee == (Object)null) && !((Object)(object)item._poolee.SpawnableCrate == (Object)null)) { list.Add(new CampaignSaveData.BarcodePosRot(((Scannable)item._poolee.SpawnableCrate).Barcode, ((Component)item).transform.position, ((Component)item).transform.rotation, ((Component)item).transform.lossyScale)); } } Campaign.Session.saveData.SavePlayer(iD, ((Component)this).transform.position, list); } else { Campaign.Session.saveData.SavePlayer(iD, ((Component)this).transform.position); } } public void ClearSave() { Campaign.Session.saveData.ClearSavePoint(); } } [RegisterTypeInIl2Cpp] public class UnhideInCampaign : MonoBehaviour { public UnhideInCampaign(IntPtr ptr) : base(ptr) { } } [RegisterTypeInIl2Cpp] public class VariableManager : MonoBehaviour { private CampaignSaveData _campaignSaveData; public VariableManager(IntPtr ptr) : base(ptr) { } private void Update() { if (_campaignSaveData == null && Campaign.Session != null) { _campaignSaveData = Campaign.Session.saveData; } } public void SetValue(string key, float value) { Campaign.Session.saveData.SetValue(key, value); } public void IncrementValue(string key, float value) { Campaign.Session.saveData.SetValue(key, Campaign.Session.saveData.GetValue(key) + value); } public float GetValue(string key) { return Campaign.Session.saveData.GetValue(key); } public void InvokeIf(string key, ComparisonType comparison, float compareValue, UltEventHolder ultEvent) { float value = Campaign.Session.saveData.GetValue(key); bool flag = false; switch (comparison) { case ComparisonType.Equal: flag = value == compareValue; break; case ComparisonType.NotEqual: flag = value != compareValue; break; case ComparisonType.GreaterThan: flag = value > compareValue; break; case ComparisonType.GreaterThanOrEqual: flag = value >= compareValue; break; case ComparisonType.LessThan: flag = value < compareValue; break; case ComparisonType.LessThanOrEqual: flag = value <= compareValue; break; } if (flag) { ultEvent.Invoke(); } } } public enum ComparisonType { Equal, NotEqual, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual } } namespace CustomCampaignTools.Debug { public class CampaignLogger { private const bool EnableDebug = false; public static void Msg(object message) { bool flag = true; } } } namespace CustomCampaignTools.Bonemenu { internal class CampaignBoneMenu { public static void CreateCampaignPage(Page category, Campaign c) { //IL_001a: 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 refer