Decompiled source of Mag Holster v1.0.0

Mods/ChestRIgCompat.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Pool;
using LabFusion.Entities;
using LabFusion.UI.Popups;
using MelonLoader;
using ReloadButtonMod;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "ChestRigCompat", "1.0.0", "Gemini", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ReloadButtonMod;

public class Core : MelonMod
{
	internal static Color Pink = new Color(1f, 0.2f, 0.7f);

	internal static Color Orange = new Color(1f, 0.647f, 0f);

	private BaseController leftController = Player.LeftController;

	private BaseController rightController = Player.RightController;

	internal static RigPose lastrecievedpose;

	internal static bool GhostMode;

	internal static bool GhostModeGlobal;

	internal static bool GhostModeAX;

	public static MelonPreferences_Entry<string> DevSpawningKeybind;

	private static MelonPreferences_Category _prefCategory;

	private static EnumElement _handElement;

	private static Poolee poolee;

	private bool flag2;

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		if (!(sceneName == "Initialization") && !(sceneName == "VoidG114"))
		{
			ProcessExistingGuns();
		}
	}

	private void ProcessExistingGuns()
	{
		Magazine[] array = Il2CppArrayBase<Magazine>.op_Implicit(Object.FindObjectsOfType<Magazine>(true));
		for (int i = 0; i < array.Length; i++)
		{
			GameObject gameObject = ((Component)array[i]).gameObject;
			if (!((Object)(object)gameObject != (Object)null) || !((Object)(object)gameObject.GetComponent<WeaponSlot>() == (Object)null))
			{
				continue;
			}
			try
			{
				WeaponSlot val = gameObject.AddComponent<WeaponSlot>();
				val.slotType = (SlotType)1;
				Grip val2 = gameObject.GetComponentInChildren<Grip>(true);
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = gameObject.GetComponentInParent<Grip>();
				}
				if ((Object)(object)val2 != (Object)null)
				{
					val.grip = val2;
					MelonLogger.Msg("[WeaponSlotMod] Succesfully added slot to " + ((Object)gameObject).name + " and mapped to grip: " + ((Object)((Component)val2).gameObject).name);
				}
				else
				{
					MelonLogger.Warning("[WeaponSlotMod] Added WeaponSlot to " + ((Object)gameObject).name + ", but NO Grip was found in its hierarchy!");
				}
				MelonLogger.Msg("Successfully injected WeaponSlot to: " + ((Object)gameObject).name);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Failed to append WeaponSlot component to " + ((Object)gameObject).name + ": " + ex.Message);
			}
		}
	}

	private void SetupCustomSlotSettings(WeaponSlot slot)
	{
	}

	private void GripSet()
	{
	}

	public override void OnUpdate()
	{
		ProcessExistingGuns();
	}

	private static void ShowNotification(string title, string message, NotificationType type)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: 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)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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_0024: 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_003b: Expected O, but got Unknown
		Notifier.Send(new Notification
		{
			Title = NotificationText.op_Implicit(title),
			Message = NotificationText.op_Implicit(message),
			Type = type,
			ShowPopup = true,
			PopupLength = 1.5f
		});
	}

	public override void OnInitializeMelon()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		Page.Root.CreatePage("ChestRiG Compat CodeMod", Pink, 0, true);
	}
}