using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using BoneLib.Notifications;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LabFusion.Network;
using MarrowUtils;
using MarrowUtils.Melon;
using MarrowUtils.Menu;
using MarrowUtils.Utilities;
using MarrowUtils.Utilities.WarehouseScanner.Monobehaviours;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ.Marrow.Pool;
using SLZ.Marrow.SceneStreaming;
using SLZ.Marrow.Warehouse;
using SLZ.Rig;
using SLZ.SFX;
using TMPro;
using UnhollowerBaseLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("A collection of utilities for BONELAB.")]
[assembly: AssemblyDescription("A collection of utilities for BONELAB.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("MarrowUtils")]
[assembly: AssemblyCopyright("Developed by SoulWithMae")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: MelonInfo(typeof(Main), "MarrowUtils", "1.0.0", "SoulWithMae", "https://bonelab.thunderstore.io/package/SoulWithMae/MarrowUtils/")]
[assembly: MelonColor(ConsoleColor.White)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonOptionalDependencies(new string[] { "LabFusion" })]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MarrowUtils
{
public class Main : MelonMod
{
internal const string Name = "MarrowUtils";
internal const string Description = "A collection of utilities for BONELAB.";
internal const string Author = "SoulWithMae";
internal const string Company = "Weather Electric";
internal const string Version = "1.0.0";
internal const string DownloadLink = "https://bonelab.thunderstore.io/package/SoulWithMae/MarrowUtils/";
internal static MenuCategory MenuCat { get; private set; }
internal static Assembly CurrAsm { get; } = Assembly.GetExecutingAssembly();
public override void OnInitializeMelon()
{
ModConsole.Setup(((MelonBase)this).LoggerInstance);
Preferences.Setup();
MenuCat = MenuManager.CreateCategory("Weather Electric", "#6FBDFF").CreateCategory("Marrow Utils", "#009dff");
Utility.Initialize();
Hooking.OnLevelInitialized += OnLevelLoad;
Hooking.OnLevelUnloaded += OnLevelUnload;
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
if (sceneName.ToUpper().Contains("BOOTSTRAP"))
{
AssetWarehouse.OnReady(Action.op_Implicit((Action)WarehouseLoaded));
}
}
private static void WarehouseLoaded()
{
Utility.WarehouseLoaded(AssetWarehouse.Instance.GetPallets());
}
public override void OnUpdate()
{
Utility.OnUpdate();
}
public override void OnLateUpdate()
{
Utility.OnLateUpdate();
}
public override void OnFixedUpdate()
{
Utility.OnFixedUpdate();
}
private static void OnLevelLoad(LevelInfo levelInfo)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
Utility.LevelLoad(levelInfo);
}
private static void OnLevelUnload()
{
Utility.LevelUnload();
}
}
}
namespace MarrowUtils.Utilities
{
internal abstract class Utility
{
private static readonly List<Utility> Instances = new List<Utility>();
protected internal Utility()
{
Instances.Add(this);
}
~Utility()
{
Instances.Remove(this);
}
protected virtual void OnLevelLoad(LevelInfo levelInfo)
{
}
protected virtual void OnLevelUnload()
{
}
protected virtual void Update()
{
}
protected virtual void CreateMenu()
{
}
protected virtual void Start()
{
}
protected virtual void OnWarehouseInit(List<Pallet> loadedPalletList)
{
}
protected virtual void LateUpdate()
{
}
protected virtual void FixedUpdate()
{
}
public static void Initialize()
{
Type[] types = Main.CurrAsm.GetTypes();
foreach (Type type in types)
{
if (!type.IsAbstract && type.IsSubclassOf(typeof(Utility)))
{
Activator.CreateInstance(type);
}
}
foreach (Utility instance in Instances)
{
instance.Start();
instance.CreateMenu();
}
}
public static void LevelLoad(LevelInfo levelInfo)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
foreach (Utility instance in Instances)
{
instance.OnLevelLoad(levelInfo);
}
}
public static void LevelUnload()
{
foreach (Utility instance in Instances)
{
instance.OnLevelUnload();
}
}
public static void OnUpdate()
{
foreach (Utility instance in Instances)
{
instance.Update();
}
}
public static void OnLateUpdate()
{
foreach (Utility instance in Instances)
{
instance.LateUpdate();
}
}
public static void OnFixedUpdate()
{
foreach (Utility instance in Instances)
{
instance.FixedUpdate();
}
}
public static void WarehouseLoaded(List<Pallet> loadedPalletList)
{
foreach (Utility instance in Instances)
{
instance.OnWarehouseInit(loadedPalletList);
}
}
}
}
namespace MarrowUtils.Utilities.WarehouseScanner
{
internal class WarehouseScanner : Utility
{
private static bool _isSpawned;
protected override void Start()
{
ModConsole.Msg("Loading Warehouse Scanner...", 1);
Assets.Load();
}
protected override void CreateMenu()
{
//IL_000a: 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_0036: Unknown result type (might be due to invalid IL or missing references)
SubPanelElement obj = Main.MenuCat.CreateSubPanel("Warehouse Scanner", Color.magenta);
obj.CreateFunctionElement("Spawn", Color.green, (Action)Spawn);
obj.CreateFunctionElement("Despawn", Color.red, (Action)Despawn);
}
private static void Spawn()
{
//IL_000d: 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_0021: 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_0031: 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)
if (!_isSpawned)
{
Vector3 val = Player.playerHead.position + Player.playerHead.forward * 2f;
Object.Instantiate<GameObject>(Assets.Scanner, val, Quaternion.identity);
_isSpawned = true;
}
}
private static void Despawn()
{
if (_isSpawned)
{
Object.Destroy((Object)(object)Scanner.Object);
_isSpawned = false;
}
}
protected override void OnLevelUnload()
{
_isSpawned = false;
}
}
internal static class Assets
{
private static AssetBundle _bundle;
public static GameObject Scanner { get; private set; }
public static void Load()
{
_bundle = HelperMethods.LoadEmbeddedAssetBundle(Main.CurrAsm, HelperMethods.IsAndroid() ? "MarrowUtils.Utilities.WarehouseScanner.Resources.Android.bundle" : "MarrowUtils.Utilities.WarehouseScanner.Resources.Windows.bundle");
Scanner = HelperMethods.LoadPersistentAsset<GameObject>(_bundle, "Assets/Dickweed.prefab");
}
}
}
namespace MarrowUtils.Utilities.WarehouseScanner.Monobehaviours
{
[RegisterTypeInIl2Cpp]
public class Scanner : MonoBehaviour
{
private Transform _firePoint;
private AudioSource _successSound;
private ImpactSFX _impactSfx;
private TextMeshPro _titleText;
private TextMeshPro _barcodeText;
public static GameObject Object { get; private set; }
private void Awake()
{
Object = ((Component)this).gameObject;
}
private void Start()
{
_firePoint = ((Component)this).transform.Find("FirePoint");
_titleText = ((Component)((Component)this).transform.Find("Text/Title")).GetComponent<TextMeshPro>();
_barcodeText = ((Component)((Component)this).transform.Find("Text/Barcode")).GetComponent<TextMeshPro>();
_successSound = ((Component)this).gameObject.GetComponent<AudioSource>();
_successSound.outputAudioMixerGroup = Audio.SFXMixer;
_impactSfx = ((Component)this).gameObject.GetComponent<ImpactSFX>();
_impactSfx.outputMixer = Audio.SFXMixer;
}
public void Scan()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
RaycastHit hit = default(RaycastHit);
Physics.Raycast(_firePoint.position, _firePoint.forward, ref hit, 100f);
if (!((Object)(object)((RaycastHit)(ref hit)).rigidbody == (Object)null))
{
AssetPoolee component = ((Component)((RaycastHit)(ref hit)).rigidbody).gameObject.GetComponent<AssetPoolee>();
if ((Object)(object)component == (Object)null)
{
ScanNPC(hit);
return;
}
_successSound.Play();
Barcode barcode = ((Scannable)component.spawnableCrate).Barcode;
string title = ((Scannable)component.spawnableCrate).Title;
((TMP_Text)_titleText).text = title;
((TMP_Text)_barcodeText).text = Barcode.op_Implicit(barcode);
((MonoBehaviour)this).CancelInvoke("HideText");
((MonoBehaviour)this).Invoke("HideText", 2f);
ModConsole.Msg($"[WarehouseScanner] {((Object)((Component)component).gameObject).name}'s barcode: {barcode}, title: {title}");
}
}
public void ScanMap()
{
LevelCrate level = SceneStreamer.Session.Level;
if (!((Object)(object)level == (Object)null))
{
_successSound.Play();
Barcode barcode = ((Scannable)level).Barcode;
string title = ((Scannable)level).Title;
((TMP_Text)_titleText).text = title;
((TMP_Text)_barcodeText).text = Barcode.op_Implicit(barcode);
((MonoBehaviour)this).CancelInvoke("HideText");
((MonoBehaviour)this).Invoke("HideText", 2f);
ModConsole.Msg($"[WarehouseScanner] Map barcode: {barcode}, title: {title}");
}
}
private void ScanNPC(RaycastHit hit)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
AssetPoolee componentInParent = ((Component)((RaycastHit)(ref hit)).rigidbody).gameObject.GetComponentInParent<AssetPoolee>();
if ((Object)(object)componentInParent == (Object)null)
{
ScanAvatar(hit);
return;
}
Barcode barcode = ((Scannable)componentInParent.spawnableCrate).Barcode;
string title = ((Scannable)componentInParent.spawnableCrate).Title;
((TMP_Text)_titleText).text = title;
((TMP_Text)_barcodeText).text = Barcode.op_Implicit(barcode);
((MonoBehaviour)this).CancelInvoke("HideText");
((MonoBehaviour)this).Invoke("HideText", 2f);
ModConsole.Msg($"{((Object)((Component)componentInParent).gameObject).name}'s barcode: {barcode}, title: {title}");
}
private void ScanAvatar(RaycastHit hit)
{
RigManager componentInParent = ((Component)((RaycastHit)(ref hit)).rigidbody).gameObject.GetComponentInParent<RigManager>();
if (!((Object)(object)componentInParent == (Object)null))
{
_successSound.Play();
Barcode barcode = ((Scannable)((CrateReferenceT<AvatarCrate>)(object)componentInParent.AvatarCrate).Crate).Barcode;
string title = ((Scannable)((CrateReferenceT<AvatarCrate>)(object)componentInParent.AvatarCrate).Crate).Title;
((TMP_Text)_titleText).text = title;
((TMP_Text)_barcodeText).text = Barcode.op_Implicit(barcode);
((MonoBehaviour)this).CancelInvoke("HideText");
((MonoBehaviour)this).Invoke("HideText", 2f);
ModConsole.Msg($"[WarehouseScanner] Avatar's barcode: {barcode}, title: {title}");
}
}
private void HideText()
{
((TMP_Text)_titleText).text = "";
((TMP_Text)_barcodeText).text = "";
}
public Scanner(IntPtr ptr)
: base(ptr)
{
}
}
}
namespace MarrowUtils.Utilities.Unredacted
{
internal class Unredacted : Utility
{
protected override void Start()
{
ModConsole.Msg("Loading Unredacted...", 1);
}
protected override void OnWarehouseInit(List<Pallet> loadedPalletList)
{
if (!Preferences.UnredactCrates.Value)
{
return;
}
Enumerator<Pallet> enumerator = loadedPalletList.GetEnumerator();
while (enumerator.MoveNext())
{
Enumerator<Crate> enumerator2 = enumerator.Current.Crates.GetEnumerator();
while (enumerator2.MoveNext())
{
Crate current = enumerator2.Current;
if (((Scannable)current).Redacted)
{
((Scannable)current).Redacted = false;
((Scannable)current)._redacted = false;
ModConsole.Msg("[Unredacted] Unredacted " + ((Object)current).name + "!", 1);
}
}
}
}
protected override void CreateMenu()
{
//IL_000a: 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)
Main.MenuCat.CreateSubPanel("Unredacted", Color.magenta).CreateBoolPreference("Toggle Unredaction", Color.white, Preferences.UnredactCrates, Preferences.UnredactedCategory);
}
}
}
namespace MarrowUtils.Utilities.TheJanitor
{
internal class Janitor : Utility
{
private enum ClearType
{
Everything,
UtilityGuns,
Npcs,
Guns,
Melee,
Props,
Decals
}
private static bool _fusionInstalled;
private static ClearType _clearType = ClearType.Everything;
private static readonly List<SpawnableCratePlacer> SpawnableCratePlacers = new List<SpawnableCratePlacer>();
private static Notification EverythingCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared every spawnable!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification NpcsCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all NPCs!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification GunsCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all guns!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification MeleeCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all melee!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification PropsCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all props!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification DecalsCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all decals!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification InFusionServer { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("You are in a fusion server! This would cause desync. Not doing it."),
Type = (NotificationType)2,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification ResetMap { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Reset the map!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
private static Notification UtilityGunsCleared { get; } = new Notification
{
Title = NotificationText.op_Implicit("The Janitor"),
Message = NotificationText.op_Implicit("Cleared all utility guns!"),
Type = (NotificationType)3,
PopupLength = 1f,
ShowTitleOnPopup = true
};
protected override void Start()
{
ModConsole.Msg("Loading The Janitor...", 1);
_fusionInstalled = HelperMethods.CheckIfAssemblyLoaded("labfusion");
}
protected override void CreateMenu()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
SubPanelElement obj = Main.MenuCat.CreateSubPanel("The Janitor", "#ecff6d");
obj.CreateEnumElement<ClearType>("Clear Type", Color.white, ClearType.Everything, (Action<ClearType>)UpdateType);
obj.CreateFunctionElement("Clear", Color.white, (Action)Clear);
obj.CreateFunctionElement("Reset Map", Color.white, (Action)Reset);
obj.CreateBoolPreference("Override Fusion Check", Color.red, Preferences.OverrideFusionCheck, Preferences.JanitorCategory);
}
protected override void OnLevelUnload()
{
SpawnableCratePlacers.Clear();
}
private static void UpdateType(ClearType clearType)
{
_clearType = clearType;
}
private static void Clear()
{
if (_fusionInstalled && !Preferences.OverrideFusionCheck.Value && (NetworkInfo.IsClient || NetworkInfo.IsServer) && _clearType != ClearType.Decals)
{
Notifier.Send(InFusionServer);
return;
}
switch (_clearType)
{
case ClearType.Everything:
ClearEverything();
break;
case ClearType.UtilityGuns:
ClearUtilGuns();
break;
case ClearType.Npcs:
ClearNPCs();
break;
case ClearType.Guns:
ClearGuns();
break;
case ClearType.Melee:
ClearMelee();
break;
case ClearType.Props:
ClearProps();
break;
case ClearType.Decals:
ClearDecals();
break;
default:
ModConsole.Error("[TheJanitor] Invalid clear type!");
break;
}
}
private static void Reset()
{
if (_fusionInstalled && !Preferences.OverrideFusionCheck.Value && (NetworkInfo.IsClient || NetworkInfo.IsServer) && _clearType != ClearType.Decals)
{
Notifier.Send(InFusionServer);
return;
}
ClearEverything(nonotif: true);
if (SpawnableCratePlacers.Count == 0)
{
Il2CppArrayBase<SpawnableCratePlacer> val = Object.FindObjectsOfType<SpawnableCratePlacer>();
if (val.Length == 0)
{
return;
}
SpawnableCratePlacers.AddRange((IEnumerable<SpawnableCratePlacer>)val);
}
foreach (SpawnableCratePlacer spawnableCratePlacer in SpawnableCratePlacers)
{
spawnableCratePlacer.RePlaceSpawnable();
}
Notifier.Send(ResetMap);
}
private static void ClearEverything(bool nonotif = false)
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (Barcode.op_Implicit(((Scannable)item.spawnableCrate).Barcode) == "SLZ.BONELAB.Core.DefaultPlayerRig")
{
return;
}
item.Despawn();
}
if (!nonotif)
{
Notifier.Send(EverythingCleared);
}
}
private static void ClearUtilGuns()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (Barcode.op_Implicit(((Scannable)item.spawnableCrate).Barcode) == "c1534c5a-6b38-438a-a324-d7e147616467" || Barcode.op_Implicit(((Scannable)item.spawnableCrate).Barcode) == "c1534c5a-5747-42a2-bd08-ab3b47616467" || Barcode.op_Implicit(((Scannable)item.spawnableCrate).Barcode) == "c1534c5a-3813-49d6-a98c-f595436f6e73")
{
return;
}
item.Despawn();
}
Notifier.Send(UtilityGunsCleared);
}
private static void ClearNPCs()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (((Crate)item.spawnableCrate).Tags.Contains("NPC"))
{
item.Despawn();
}
}
Notifier.Send(NpcsCleared);
}
private static void ClearGuns()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (((Crate)item.spawnableCrate).Tags.Contains("Gun"))
{
item.Despawn();
}
}
Notifier.Send(GunsCleared);
}
private static void ClearMelee()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (((Crate)item.spawnableCrate).Tags.Contains("Melee"))
{
item.Despawn();
}
}
Notifier.Send(MeleeCleared);
}
private static void ClearProps()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (((Crate)item.spawnableCrate).Tags.Contains("Prop"))
{
item.Despawn();
}
}
Notifier.Send(PropsCleared);
}
private static void ClearDecals()
{
Il2CppArrayBase<AssetPoolee> val = Object.FindObjectsOfType<AssetPoolee>();
if (val.Length == 0)
{
return;
}
foreach (AssetPoolee item in val)
{
if (((Crate)item.spawnableCrate).Tags.Contains("Decal"))
{
item.Despawn();
}
}
Notifier.Send(DecalsCleared);
}
}
}
namespace MarrowUtils.Utilities.Random
{
internal class RandomStuff : Utility
{
protected override void Start()
{
ModConsole.Msg("Loading RandomStuff...", 1);
}
protected override void CreateMenu()
{
//IL_000a: 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_0037: 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_0070: Unknown result type (might be due to invalid IL or missing references)
SubPanelElement obj = Main.MenuCat.CreateSubPanel("Random Stuff", Color.yellow);
obj.CreateFunctionElement("Random Gun", Color.white, (Action)RandomGun);
obj.CreateFunctionElement("Random Melee", Color.white, (Action)RandomMelee);
obj.CreateFunctionElement("Random NPC", Color.white, (Action)RandomNpc);
obj.CreateFunctionElement("Random Level", Color.white, (Action)RandomLevel);
}
private static void RandomGun()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Player.playerHead.position + Player.playerHead.forward * 2f;
HelperMethods.SpawnCrate(Guns.All[Random.Range(0, Guns.All.Count)], val, Quaternion.identity, Vector3.one, false, (Action<GameObject>)delegate
{
});
}
private static void RandomMelee()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Player.playerHead.position + Player.playerHead.forward * 2f;
HelperMethods.SpawnCrate(Melee.All[Random.Range(0, Melee.All.Count)], val, Quaternion.identity, Vector3.one, false, (Action<GameObject>)delegate
{
});
}
private static void RandomNpc()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Player.playerHead.position + Player.playerHead.forward * 2f;
HelperMethods.SpawnCrate(NPCs.All[Random.Range(0, NPCs.All.Count)], val, Quaternion.identity, Vector3.one, false, (Action<GameObject>)delegate
{
});
}
private static void RandomLevel()
{
SceneStreamer.Load(Maps.All[Random.Range(0, Maps.All.Count)], "fa534c5a83ee4ec6bd641fec424c4142.Level.DefaultLoad");
}
}
}
namespace MarrowUtils.Utilities.LevelReloader
{
internal class LevelReloader : Utility
{
protected override void Start()
{
ModConsole.Msg("Loading LevelReloader...", 1);
}
protected override void CreateMenu()
{
//IL_000a: 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)
Main.MenuCat.CreateSubPanel("Level Reloader", Color.cyan).CreateBoolPreference("Enabled", Color.white, Preferences.EnableReloader, Preferences.ReloaderCategory);
}
protected override void Update()
{
if (Preferences.EnableReloader.Value && !HelperMethods.IsAndroid() && (Input.GetKeyDown((KeyCode)306) || Input.GetKeyDown((KeyCode)305)) && Input.GetKeyDown((KeyCode)114))
{
SceneStreamer.Reload();
}
}
}
}
namespace MarrowUtils.Utilities.EmergencyRelocation
{
internal class Teleporter : Utility
{
private static Vector3 _levelStart;
protected override void Start()
{
ModConsole.Msg("Loading EmergencyRelocation...", 1);
}
protected override void CreateMenu()
{
//IL_000a: 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)
Main.MenuCat.CreateSubPanel("Emergency Relocation", Color.green).CreateFunctionElement("Relocate", Color.white, (Action)Relocate);
}
protected override void OnLevelLoad(LevelInfo levelInfo)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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)
if (Maps.All.Contains(levelInfo.barcode))
{
GameObject val = GameObject.Find("[RigManager (Blank)]");
if (!((Object)(object)val == (Object)null))
{
_levelStart = val.transform.position;
}
}
else
{
PlayerMarker val2 = Object.FindObjectOfType<PlayerMarker>();
if (!((Object)(object)val2 == (Object)null))
{
_levelStart = ((Component)val2).transform.position;
}
}
}
private static void Relocate()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Player.rigManager.Teleport(_levelStart, true);
}
}
}
namespace MarrowUtils.Melon
{
internal static class ModConsole
{
private static Instance _logger;
public static void Setup(Instance loggerInstance)
{
_logger = loggerInstance;
}
public static void Msg(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text);
}
}
public static void Msg(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text);
}
}
public static void Msg(ConsoleColor txtcolor, object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text);
}
}
public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text);
}
}
public static void Msg(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text, args);
}
}
public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text, args);
}
}
public static void Error(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text);
}
}
public static void Error(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text);
}
}
public static void Error(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text, args);
}
}
public static void Warning(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text);
}
}
public static void Warning(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text);
}
}
public static void Warning(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text, args);
}
}
}
internal static class Preferences
{
public static readonly MelonPreferences_Category GlobalCategory = MelonPreferences.CreateCategory("Global");
public static readonly MelonPreferences_Category JanitorCategory = MelonPreferences.CreateCategory("TheJanitor");
public static readonly MelonPreferences_Category ReloaderCategory = MelonPreferences.CreateCategory("LevelReloader");
public static readonly MelonPreferences_Category UnredactedCategory = MelonPreferences.CreateCategory("Unredacted");
public static MelonPreferences_Entry<int> LoggingMode { get; set; }
public static MelonPreferences_Entry<bool> OverrideFusionCheck { get; set; }
public static MelonPreferences_Entry<bool> EnableReloader { get; set; }
public static MelonPreferences_Entry<bool> UnredactCrates { get; set; }
public static void Setup()
{
LoggingMode = GlobalCategory.GetEntry<int>("LoggingMode") ?? GlobalCategory.CreateEntry<int>("LoggingMode", 0, "Logging Mode", "The level of logging to use. 0 = Important Only, 1 = All", false, false, (ValueValidator)null, (string)null);
GlobalCategory.SetFilePath(MelonUtils.UserDataDirectory + "/WeatherElectric.cfg");
GlobalCategory.SaveToFile(false);
OverrideFusionCheck = JanitorCategory.GetEntry<bool>("OverrideFusionCheck") ?? JanitorCategory.CreateEntry<bool>("OverrideFusionCheck", false, "Override Fusion Check", "Whether or not to override the Fusion check. This is not recommended, as it causes desync.", false, false, (ValueValidator)null, (string)null);
JanitorCategory.SetFilePath(MelonUtils.UserDataDirectory + "/WeatherElectric.cfg");
JanitorCategory.SaveToFile(false);
EnableReloader = ReloaderCategory.GetEntry<bool>("EnabledReloader") ?? ReloaderCategory.CreateEntry<bool>("EnabledReloader", true, "Enabled", "Whether or not to check for Control + R.", false, false, (ValueValidator)null, (string)null);
UnredactCrates = UnredactedCategory.GetEntry<bool>("UnredactCrates") ?? UnredactedCategory.CreateEntry<bool>("UnredactCrates", true, "Unredact Crates", "Whether or not to unredact crates.", false, false, (ValueValidator)null, (string)null);
UnredactedCategory.SetFilePath(MelonUtils.UserDataDirectory + "/WeatherElectric.cfg");
UnredactedCategory.SaveToFile(false);
ModConsole.Msg("Finished preferences setup for MarrowUtils", 1);
}
}
}
namespace MarrowUtils.Menu
{
internal static class BoneMenuExtensions
{
public static BoolElement CreateBoolPreference(this MenuCategory category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateBoolElement(name, color, pref.Value, (Action<bool>)delegate(bool v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static BoolElement CreateBoolPreference(this MenuCategory category, string name, string hexColor, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateBoolElement(name, hexColor, pref.Value, (Action<bool>)delegate(bool v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static BoolElement CreateBoolPreference(this SubPanelElement category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateBoolElement(name, color, pref.Value, (Action<bool>)delegate(bool v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static BoolElement CreateBoolPreference(this SubPanelElement category, string name, string hexColor, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateBoolElement(name, hexColor, pref.Value, (Action<bool>)delegate(bool v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static FloatElement CreateFloatPreference(this MenuCategory category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateFloatElement(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static FloatElement CreateFloatPreference(this MenuCategory category, string name, string hexColor, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateFloatElement(name, hexColor, pref.Value, increment, min, max, (Action<float>)delegate(float v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static FloatElement CreateFloatPreference(this SubPanelElement category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateFloatElement(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static FloatElement CreateFloatPreference(this SubPanelElement category, string name, string hexColor, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateFloatElement(name, hexColor, pref.Value, increment, min, max, (Action<float>)delegate(float v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static IntElement CreateIntPreference(this MenuCategory category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateIntElement(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static IntElement CreateIntPreference(this MenuCategory category, string name, string hexColor, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateIntElement(name, hexColor, pref.Value, increment, min, max, (Action<int>)delegate(int v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static IntElement CreateIntPreference(this SubPanelElement category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateIntElement(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static IntElement CreateIntPreference(this SubPanelElement category, string name, string hexColor, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
return category.CreateIntElement(name, hexColor, pref.Value, increment, min, max, (Action<int>)delegate(int v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this MenuCategory category, string name, Color color, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateEnumElement<TEnum>(name, color, pref.Value, (Action<TEnum>)delegate(TEnum v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this MenuCategory category, string name, string hexColor, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum
{
return category.CreateEnumElement<TEnum>(name, hexColor, pref.Value, (Action<TEnum>)delegate(TEnum v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this SubPanelElement category, string name, Color color, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateEnumElement<TEnum>(name, color, pref.Value, (Action<TEnum>)delegate(TEnum v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this SubPanelElement category, string name, string hexColor, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum
{
return category.CreateEnumElement<TEnum>(name, hexColor, pref.Value, (Action<TEnum>)delegate(TEnum v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
}
}