Decompiled source of BoneLib v3.0.0

Mods/BoneLib.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.UI;
using BoneLib.MonoBehaviours;
using BoneLib.Notifications;
using BoneLib.RandomShit;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Audio;
using Il2CppSLZ.Marrow.Combat;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Utilities;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BoneLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The BONELAB Modding Community")]
[assembly: AssemblyProduct("BoneLib")]
[assembly: AssemblyCopyright("Created by The BONELAB Modding Community")]
[assembly: AssemblyTrademark("The BONELAB Modding Community")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("3.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "BoneLib", "3.0.0", "The BONELAB Modding Community", "https://thunderstore.io/c/bonelab/p/gnonme/BoneLib")]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonPriority(-1000000)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("3.0.0.0")]
internal enum LoggingMode
{
	NORMAL,
	DEBUG
}
namespace BoneLib
{
	public static class Audio
	{
		public static AudioMixerGroup Ambience => Audio3dManager.ambience;

		public static AudioMixerGroup BulletImpact => Audio3dManager.bulletImpact;

		public static AudioMixerGroup DiegeticMusic => Audio3dManager.diegeticMusic;

		public static AudioMixerGroup Footsteps => Audio3dManager.footsteps;

		public static AudioMixerGroup Gunshot => Audio3dManager.gunShot;

		public static AudioMixerGroup HardInteraction => Audio3dManager.hardInteraction;

		public static AudioMixerGroup InHead => Audio3dManager.inHead;

		public static AudioMixerGroup Impact => Audio3dManager.impact;

		public static AudioMixerGroup NonDiegeticMusic => Audio3dManager.nonDiegeticMusic;

		public static AudioMixerGroup NPCVocals => Audio3dManager.npcVocals;

		public static AudioMixerGroup Shell => Audio3dManager.shells;

		public static AudioMixerGroup SoftInteraction => Audio3dManager.softInteraction;

		public static AudioMixerGroup UI => Audio3dManager.ui;

		public static void Play2DOneShot(AudioClip clip, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f)
		{
			Audio3dManager.Play2dOneShot(clip, mixerGroup, new Nullable<float>(volume), new Nullable<float>(pitch));
		}

		public static void Play2DOneShot(AudioClip[] clips, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f)
		{
			Audio3dManager.Play2dOneShot(Il2CppReferenceArray<AudioClip>.op_Implicit(clips), mixerGroup, new Nullable<float>(volume), new Nullable<float>(pitch));
		}

		public static void PlayAtPoint(AudioClip clip, Vector3 position, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f, float spatialBlend = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Audio3dManager.PlayAtPoint(clip, position, mixerGroup, volume, pitch, new Nullable<float>(0f), new Nullable<float>(0f), new Nullable<float>(spatialBlend));
		}

		public static void PlayAtPoint(AudioClip[] clips, Vector3 position, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f, float spatialBlend = 1f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Audio3dManager.PlayAtPoint(Il2CppReferenceArray<AudioClip>.op_Implicit(clips), position, mixerGroup, volume, pitch, new Nullable<float>(0f), new Nullable<float>(0f), new Nullable<float>(spatialBlend));
		}

		public static void SpawnAudioPlayer(Vector3 position = default(Vector3), Action<GameObject> callback = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Audio3dManager.SpawnAudioPlayer(position, Action<GameObject>.op_Implicit(callback));
		}
	}
	public static class CommonBarcodes
	{
		public static class Avatars
		{
			public static readonly List<string> All = new List<string>
			{
				"fa534c5a83ee4ec6bd641fec424c4142.Avatar.Heavy", "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Fast", "fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharFurv4GB", "fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharTallv4", "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Strong", "SLZ.BONELAB.Content.Avatar.Anime", "SLZ.BONELAB.Content.Avatar.CharJimmy", "SLZ.BONELAB.Content.Avatar.FordBW", "SLZ.BONELAB.Content.Avatar.CharFord", "SLZ.BONELAB.Core.Avatar.PeasantFemaleA",
				"c3534c5a-10bf-48e9-beca-4ca850656173", "c3534c5a-2236-4ce5-9385-34a850656173", "c3534c5a-87a3-48b2-87cd-f0a850656173", "c3534c5a-f12c-44ef-b953-b8a850656173", "c3534c5a-3763-4ddf-bd86-6ca850656173", "SLZ.BONELAB.Content.Avatar.Nullbody", "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Charskeleton", "c3534c5a-d388-4945-b4ff-9c7a53656375", "SLZ.BONELAB.Content.Avatar.DogDuckSeason", "c3534c5a-94b2-40a4-912a-24a8506f6c79",
				"SLZ.BONELAB.NoBuild.Avatar.PolyDebugger"
			};

			public const string Heavy = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Heavy";

			public const string Fast = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Fast";

			public const string Short = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharFurv4GB";

			public const string Tall = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharTallv4";

			public const string Strong = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Strong";

			public const string Light = "SLZ.BONELAB.Content.Avatar.Anime";

			public const string Jimmy = "SLZ.BONELAB.Content.Avatar.CharJimmy";

			public const string FordBW = "SLZ.BONELAB.Content.Avatar.FordBW";

			public const string FordBL = "SLZ.BONELAB.Content.Avatar.CharFord";

			public const string PeasantFemaleA = "SLZ.BONELAB.Core.Avatar.PeasantFemaleA";

			public const string PeasantFemaleB = "c3534c5a-10bf-48e9-beca-4ca850656173";

			public const string PeasantFemaleC = "c3534c5a-2236-4ce5-9385-34a850656173";

			public const string PeasantMaleA = "c3534c5a-87a3-48b2-87cd-f0a850656173";

			public const string PeasantMaleB = "c3534c5a-f12c-44ef-b953-b8a850656173";

			public const string PeasantMaleC = "c3534c5a-3763-4ddf-bd86-6ca850656173";

			public const string Nullbody = "SLZ.BONELAB.Content.Avatar.Nullbody";

			public const string Skeleton = "fa534c5a83ee4ec6bd641fec424c4142.Avatar.Charskeleton";

			public const string SecurityGuard = "c3534c5a-d388-4945-b4ff-9c7a53656375";

			public const string DuckSeasonDog = "SLZ.BONELAB.Content.Avatar.DogDuckSeason";

			public const string PolyBlank = "c3534c5a-94b2-40a4-912a-24a8506f6c79";

			public const string PolyDebugger = "SLZ.BONELAB.NoBuild.Avatar.PolyDebugger";
		}

		public static class Maps
		{
			public static readonly List<string> All = new List<string>
			{
				"c2534c5a-80e1-4a29-93ca-f3254d656e75", "c2534c5a-4197-4879-8cd3-4a695363656e", "c2534c5a-6b79-40ec-8e98-e58c5363656e", "c2534c5a-56a6-40ab-a8ce-23074c657665", "c2534c5a-54df-470b-baaf-741f4c657665", "c2534c5a-7601-4443-bdfe-7f235363656e", "SLZ.BONELAB.Content.Level.LevelStreetPunch", "SLZ.BONELAB.Content.Level.SprintBridge04", "SLZ.BONELAB.Content.Level.SceneMagmaGate", "SLZ.BONELAB.Content.Level.MoonBase",
				"SLZ.BONELAB.Content.Level.LevelKartRace", "c2534c5a-c056-4883-ac79-e051426f6964", "SLZ.BONELAB.Content.Level.LevelBigAnomalyB", "c2534c5a-db71-49cf-b694-24584c657665", "SLZ.BONELAB.Content.Level.LevelOutro", "fa534c5a868247138f50c62e424c4144.Level.VoidG114", "c2534c5a-61b3-4f97-9059-79155363656e", "c2534c5a-2c4c-4b44-b076-203b5363656e", "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelMuseumBasement", "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelHalfwayPark",
				"fa534c5a83ee4ec6bd641fec424c4142.Level.LevelGunRange", "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelHoloChamber", "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelKartBowling", "SLZ.BONELAB.Content.Level.LevelMirror", "c2534c5a-4f3b-480e-ad2f-69175363656e", "c2534c5a-de61-4df9-8f6c-416954726547", "c2534c5a-c180-40e0-b2b7-325c5363656e", "fa534c5a868247138f50c62e424c4144.Level.LevelArenaMin", "c2534c5a-162f-4661-a04d-975d5363656e", "c2534c5a-5c2f-4eef-a851-66214c657665",
				"c2534c5a-c6ac-48b4-9c5f-b5cd5363656e", "fa534c5a83ee4ec6bd641fec424c4142.Level.SceneparkourDistrictLogic"
			};

			public const string MainMenu = "c2534c5a-80e1-4a29-93ca-f3254d656e75";

			public const string Descent = "c2534c5a-4197-4879-8cd3-4a695363656e";

			public const string BLHub = "c2534c5a-6b79-40ec-8e98-e58c5363656e";

			public const string LongRun = "c2534c5a-56a6-40ab-a8ce-23074c657665";

			public const string MineDive = "c2534c5a-54df-470b-baaf-741f4c657665";

			public const string BigAnomaly = "c2534c5a-7601-4443-bdfe-7f235363656e";

			public const string StreetPuncher = "SLZ.BONELAB.Content.Level.LevelStreetPunch";

			public const string SprintBridge = "SLZ.BONELAB.Content.Level.SprintBridge04";

			public const string MagmaGate = "SLZ.BONELAB.Content.Level.SceneMagmaGate";

			public const string Moonbase = "SLZ.BONELAB.Content.Level.MoonBase";

			public const string MonogonMotorway = "SLZ.BONELAB.Content.Level.LevelKartRace";

			public const string PillarClimb = "c2534c5a-c056-4883-ac79-e051426f6964";

			public const string BigAnomaly2 = "SLZ.BONELAB.Content.Level.LevelBigAnomalyB";

			public const string Ascent = "c2534c5a-db71-49cf-b694-24584c657665";

			public const string Home = "SLZ.BONELAB.Content.Level.LevelOutro";

			public const string VoidG114 = "fa534c5a868247138f50c62e424c4144.Level.VoidG114";

			public const string Baseline = "c2534c5a-61b3-4f97-9059-79155363656e";

			public const string Tuscany = "c2534c5a-2c4c-4b44-b076-203b5363656e";

			public const string MuseumBasement = "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelMuseumBasement";

			public const string HalfwayPark = "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelHalfwayPark";

			public const string GunRange = "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelGunRange";

			public const string Holochamber = "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelHoloChamber";

			public const string BigBoneBowling = "fa534c5a83ee4ec6bd641fec424c4142.Level.LevelKartBowling";

			public const string Mirror = "SLZ.BONELAB.Content.Level.LevelMirror";

			public const string NeonTrial = "c2534c5a-4f3b-480e-ad2f-69175363656e";

			public const string DropPit = "c2534c5a-de61-4df9-8f6c-416954726547";

			public const string TunnelTipper = "c2534c5a-c180-40e0-b2b7-325c5363656e";

			public const string FantasyArena = "fa534c5a868247138f50c62e424c4144.Level.LevelArenaMin";

			public const string ContainerYard = "c2534c5a-162f-4661-a04d-975d5363656e";

			public const string DungeonWarrior = "c2534c5a-5c2f-4eef-a851-66214c657665";

			public const string Rooftops = "c2534c5a-c6ac-48b4-9c5f-b5cd5363656e";

			public const string NeonParkour = "fa534c5a83ee4ec6bd641fec424c4142.Level.SceneparkourDistrictLogic";

			public const string LoadDefault = "fa534c5a83ee4ec6bd641fec424c4142.Level.DefaultLoad";

			public const string LoadMod = "SLZ.BONELAB.CORE.Level.LevelModLevelLoad";
		}

		public static class NPCs
		{
			public static readonly List<string> All = new List<string>
			{
				"c1534c5a-4583-48b5-ac3f-eb9543726162", "c1534c5a-af28-46cb-84c1-012343726162", "SLZ.BONELAB.Content.Spawnable.NPCCultist", "c1534c5a-2ab7-46fe-b0d6-7495466f7264", "c1534c5a-3fd8-4d50-9eaf-0695466f7264", "c1534c5a-481a-45d8-8bc1-d810466f7264", "c1534c5a-d82d-4f65-89fd-a4954e756c6c", "c1534c5a-0e54-4d5b-bdb8-31754e756c6c", "c1534c5a-2775-4009-9447-22d94e756c6c", "c1534c5a-ef15-44c0-88ae-aebc4e756c6c",
				"c1534c5a-7c6d-4f53-b61c-e4024f6d6e69", "c1534c5a-0df5-495d-8421-75834f6d6e69", "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemL", "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemM", "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemS", "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleL", "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleM", "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleS", "SLZ.BONELAB.Content.Spawnable.NPCPeasantNull", "SLZ.BONELAB.Content.Spawnable.NPCSecurityGuard",
				"c1534c5a-de57-4aa0-9021-5832536b656c", "c1534c5a-bd53-469d-97f1-165e4e504353", "c1534c5a-a750-44ca-9730-b487536b656c", "c1534c5a-290e-4d56-9b8e-ad95566f6964"
			};

			public const string Crablet = "c1534c5a-4583-48b5-ac3f-eb9543726162";

			public const string CrabletPlus = "c1534c5a-af28-46cb-84c1-012343726162";

			public const string Cultist = "SLZ.BONELAB.Content.Spawnable.NPCCultist";

			public const string EarlyExitZombie = "c1534c5a-2ab7-46fe-b0d6-7495466f7264";

			public const string Ford = "c1534c5a-3fd8-4d50-9eaf-0695466f7264";

			public const string FordVRJunkie = "c1534c5a-481a-45d8-8bc1-d810466f7264";

			public const string Nullbody = "c1534c5a-d82d-4f65-89fd-a4954e756c6c";

			public const string NullbodyAgent = "c1534c5a-0e54-4d5b-bdb8-31754e756c6c";

			public const string NullbodyCorrupted = "c1534c5a-2775-4009-9447-22d94e756c6c";

			public const string Nullrat = "c1534c5a-ef15-44c0-88ae-aebc4e756c6c";

			public const string OmniProjectorHazmat = "c1534c5a-7c6d-4f53-b61c-e4024f6d6e69";

			public const string OmniTurret = "c1534c5a-0df5-495d-8421-75834f6d6e69";

			public const string PeasantFemaleA = "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemL";

			public const string PeasantFemaleB = "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemM";

			public const string PeasantFemaleC = "SLZ.BONELAB.Content.Spawnable.NPCPeasantFemS";

			public const string PeasantMaleA = "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleL";

			public const string PeasantMaleB = "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleM";

			public const string PeasantMaleC = "SLZ.BONELAB.Content.Spawnable.NPCPeasantMaleS";

			public const string PeasantNull = "SLZ.BONELAB.Content.Spawnable.NPCPeasantNull";

			public const string SecurityGuard = "SLZ.BONELAB.Content.Spawnable.NPCSecurityGuard";

			public const string Skeleton = "c1534c5a-de57-4aa0-9021-5832536b656c";

			public const string SkeletonFireMage = "c1534c5a-bd53-469d-97f1-165e4e504353";

			public const string SkeletonSteel = "c1534c5a-a750-44ca-9730-b487536b656c";

			public const string VoidTurret = "c1534c5a-290e-4d56-9b8e-ad95566f6964";
		}

		public static class Guns
		{
			public static readonly List<string> All = new List<string>
			{
				"c1534c5a-fcfc-4f43-8fb0-d29531393131", "c1534c5a-2a4f-481f-8542-cc9545646572", "SLZ.BONELAB.Content.Spawnable.HandgunEder22training", "SLZ.BONELAB.CORE.Spawnable.GunEHG", "c1534c5a-9f55-4c56-ae23-d33b47727562", "c1534c5a-aade-4fa1-8f4b-d4c547756e4d", "c1534c5a-bcb7-4f02-a4f5-da9550333530", "c1534c5a-50cf-4500-83d5-c0b447756e50", "fa534c5a868247138f50c62e424c4144.Spawnable.Stapler", "c1534c5a-a6b5-4177-beb8-04d947756e41",
				"SLZ.BONELAB.Content.Spawnable.RifleM1Garand", "c1534c5a-ea97-495d-b0bf-ac955269666c", "c1534c5a-cc53-4aac-b842-46955269666c", "c1534c5a-9112-49e5-b022-9c955269666c", "c1534c5a-4e5b-4fb7-be33-08955269666c", "SLZ.BONELAB.Content.Spawnable.RifleMK18HoloForegrip", "c1534c5a-c061-4c5c-a5e2-3d955269666c", "c1534c5a-f3b6-4161-a525-a8955269666c", "c1534c5a-ec8e-418a-a545-cf955269666c", "c1534c5a-5c2b-4cb4-ae31-e7955269666c",
				"c1534c5a-4b3e-4288-849c-ce955269666c", "c1534c5a-2774-48db-84fd-778447756e46", "c1534c5a-7f05-402f-9320-609647756e35", "c1534c5a-e0b5-4d4b-9df3-567147756e4d", "c1534c5a-571f-43dc-8bc6-8e9553686f74", "c1534c5a-d00c-4aa8-adfd-3495534d474d", "c1534c5a-3e35-4aeb-b1ec-4a95534d474d", "fa534c5a83ee4ec6bd641fec424c4142.Spawnable.MP5KRedDotSight", "c1534c5a-9f54-4f32-b8b9-f295534d474d", "c1534c5a-ccfa-4d99-af97-5e95534d474d",
				"c1534c5a-6670-4ac2-a82a-a595534d474d", "c1534c5a-04d7-41a0-b7b8-5a95534d4750", "c1534c5a-40e5-40e0-8139-194347756e55", "c1534c5a-8d03-42de-93c7-f595534d4755", "c1534c5a-4c47-428d-b5a5-b05747756e56"
			};

			public const string M1911 = "c1534c5a-fcfc-4f43-8fb0-d29531393131";

			public const string Eder22 = "c1534c5a-2a4f-481f-8542-cc9545646572";

			public const string RedEder22 = "SLZ.BONELAB.Content.Spawnable.HandgunEder22training";

			public const string eHGBlaster = "SLZ.BONELAB.CORE.Spawnable.GunEHG";

			public const string Gruber = "c1534c5a-9f55-4c56-ae23-d33b47727562";

			public const string M9 = "c1534c5a-aade-4fa1-8f4b-d4c547756e4d";

			public const string P350 = "c1534c5a-bcb7-4f02-a4f5-da9550333530";

			public const string PT8Alaris = "c1534c5a-50cf-4500-83d5-c0b447756e50";

			public const string Stapler = "fa534c5a868247138f50c62e424c4144.Spawnable.Stapler";

			public const string AKM = "c1534c5a-a6b5-4177-beb8-04d947756e41";

			public const string Garand = "SLZ.BONELAB.Content.Spawnable.RifleM1Garand";

			public const string M16ACOG = "c1534c5a-ea97-495d-b0bf-ac955269666c";

			public const string M16Holosight = "c1534c5a-cc53-4aac-b842-46955269666c";

			public const string M16IronSights = "c1534c5a-9112-49e5-b022-9c955269666c";

			public const string M16LaserForegrip = "c1534c5a-4e5b-4fb7-be33-08955269666c";

			public const string MK18HoloForegrip = "SLZ.BONELAB.Content.Spawnable.RifleMK18HoloForegrip";

			public const string MK18Holosight = "c1534c5a-c061-4c5c-a5e2-3d955269666c";

			public const string MK18IronSights = "c1534c5a-f3b6-4161-a525-a8955269666c";

			public const string MK18LaserForegrip = "c1534c5a-ec8e-418a-a545-cf955269666c";

			public const string MK18Naked = "c1534c5a-5c2b-4cb4-ae31-e7955269666c";

			public const string MK18Sabrelake = "c1534c5a-4b3e-4288-849c-ce955269666c";

			public const string FAB = "c1534c5a-2774-48db-84fd-778447756e46";

			public const string M590A1 = "c1534c5a-7f05-402f-9320-609647756e35";

			public const string M4 = "c1534c5a-e0b5-4d4b-9df3-567147756e4d";

			public const string DuckSeasonShotgun = "c1534c5a-571f-43dc-8bc6-8e9553686f74";

			public const string MP5 = "c1534c5a-d00c-4aa8-adfd-3495534d474d";

			public const string MP5KFlashlight = "c1534c5a-3e35-4aeb-b1ec-4a95534d474d";

			public const string MP5KHolosight = "fa534c5a83ee4ec6bd641fec424c4142.Spawnable.MP5KRedDotSight";

			public const string MP5KIronsights = "c1534c5a-9f54-4f32-b8b9-f295534d474d";

			public const string MP5KLaser = "c1534c5a-ccfa-4d99-af97-5e95534d474d";

			public const string MP5KSabrelake = "c1534c5a-6670-4ac2-a82a-a595534d474d";

			public const string PDRC = "c1534c5a-04d7-41a0-b7b8-5a95534d4750";

			public const string UMP = "c1534c5a-40e5-40e0-8139-194347756e55";

			public const string UZI = "c1534c5a-8d03-42de-93c7-f595534d4755";

			public const string Vector = "c1534c5a-4c47-428d-b5a5-b05747756e56";
		}

		public static class Melee
		{
			public static readonly List<string> All = new List<string>
			{
				"c1534c5a-e962-46dd-b1ef-f39542617262", "c1534c5a-6441-40aa-a070-909542617365", "c1534c5a-837c-43ca-b4b5-33d842617365", "fa534c5a868247138f50c62e424c4144.Spawnable.Baton", "c1534c5a-0c8a-4b82-9f8b-7a9543726f77", "SLZ.BONELAB.Content.Spawnable.ElectricGuitar", "c1534c5a-d0e9-4d53-9218-e76446727969", "c1534c5a-8597-4ffe-892e-b995476f6c66", "c1534c5a-11d0-4632-b36e-fa9548616d6d", "c1534c5a-dfa6-466d-9ab7-bf9548616e64",
				"c1534c5a-f6f9-4c96-b88e-91d74c656164", "c1534c5a-3d5c-4f9f-92fa-c24c4d656c65", "c1534c5a-5d31-488d-b5b3-aa1c53686f76", "c1534c5a-1f5a-4993-bbc1-03be4d656c65", "c1534c5a-f5a3-4204-a199-a1e14d656c65", "c1534c5a-d30c-4c18-9f5f-7cfe54726173", "c1534c5a-6d15-47c7-9ad4-b04156696b69", "c1534c5a-f6f3-46e2-aa51-67214d656c65", "c1534c5a-02e7-43cf-bc8d-26955772656e", "c1534c5a-6d6b-4414-a9f2-af034d656c65",
				"c1534c5a-4774-460f-a814-149541786546", "c1534c5a-0ba6-4876-be9c-216741786548", "c1534c5a-d086-4e27-918d-ee9542617374", "c1534c5a-8036-440a-8830-b99543686566", "c1534c5a-3481-4025-9d28-2e95436c6561", "c1534c5a-1fb8-477c-afbe-2a95436f6d62", "c1534c5a-d3fc-4987-a93d-d79544616767", "c1534c5a-53ae-487e-956f-707148616c66", "c1534c5a-d605-4f85-870d-f68848617463", "SLZ.BONELAB.Content.Spawnable.MeleeIceAxe",
				"c1534c5a-282b-4430-b009-58954b617461", "c1534c5a-e606-4a82-878c-652f4b617461", "c1534c5a-f0d1-40b6-9f9b-c19544616767", "c1534c5a-a767-4a58-b3ef-26064d616368", "c1534c5a-e75f-4ded-aa5a-a27b4178655f", "c1534c5a-f943-42a8-a994-6e955069636b", "c1534c5a-a97f-4bff-b512-e44d53706561", "c1534c5a-b59c-4790-9b09-499553776f72"
			};

			public const string BarbedBat = "c1534c5a-e962-46dd-b1ef-f39542617262";

			public const string BaseballBat = "c1534c5a-6441-40aa-a070-909542617365";

			public const string Baseball = "c1534c5a-837c-43ca-b4b5-33d842617365";

			public const string Baton = "fa534c5a868247138f50c62e424c4144.Spawnable.Baton";

			public const string Crowbar = "c1534c5a-0c8a-4b82-9f8b-7a9543726f77";

			public const string ElectricGuitar = "SLZ.BONELAB.Content.Spawnable.ElectricGuitar";

			public const string FryingPan = "c1534c5a-d0e9-4d53-9218-e76446727969";

			public const string GolfClub = "c1534c5a-8597-4ffe-892e-b995476f6c66";

			public const string Hammer = "c1534c5a-11d0-4632-b36e-fa9548616d6d";

			public const string HandHammer = "c1534c5a-dfa6-466d-9ab7-bf9548616e64";

			public const string LeadPipe = "c1534c5a-f6f9-4c96-b88e-91d74c656164";

			public const string MorningStar = "c1534c5a-3d5c-4f9f-92fa-c24c4d656c65";

			public const string Shovel = "c1534c5a-5d31-488d-b5b3-aa1c53686f76";

			public const string Sledgehammer = "c1534c5a-1f5a-4993-bbc1-03be4d656c65";

			public const string SpikedClub = "c1534c5a-f5a3-4204-a199-a1e14d656c65";

			public const string TrashcanLid = "c1534c5a-d30c-4c18-9f5f-7cfe54726173";

			public const string VikingShield = "c1534c5a-6d15-47c7-9ad4-b04156696b69";

			public const string Warhammer = "c1534c5a-f6f3-46e2-aa51-67214d656c65";

			public const string Wrench = "c1534c5a-02e7-43cf-bc8d-26955772656e";

			public const string AxeDouble = "c1534c5a-6d6b-4414-a9f2-af034d656c65";

			public const string AxeFirefighter = "c1534c5a-4774-460f-a814-149541786546";

			public const string AxeHorror = "c1534c5a-0ba6-4876-be9c-216741786548";

			public const string BastardSword = "c1534c5a-d086-4e27-918d-ee9542617374";

			public const string ChefKnife = "c1534c5a-8036-440a-8830-b99543686566";

			public const string Cleaver = "c1534c5a-3481-4025-9d28-2e95436c6561";

			public const string CombatKnife = "c1534c5a-1fb8-477c-afbe-2a95436f6d62";

			public const string Dagger = "c1534c5a-d3fc-4987-a93d-d79544616767";

			public const string HalfSword = "c1534c5a-53ae-487e-956f-707148616c66";

			public const string Hatchet = "c1534c5a-d605-4f85-870d-f68848617463";

			public const string IceAxe = "SLZ.BONELAB.Content.Spawnable.MeleeIceAxe";

			public const string Katana = "c1534c5a-282b-4430-b009-58954b617461";

			public const string Katar = "c1534c5a-e606-4a82-878c-652f4b617461";

			public const string Kunai = "c1534c5a-f0d1-40b6-9f9b-c19544616767";

			public const string Machete = "c1534c5a-a767-4a58-b3ef-26064d616368";

			public const string NorseAxe = "c1534c5a-e75f-4ded-aa5a-a27b4178655f";

			public const string Pickaxe = "c1534c5a-f943-42a8-a994-6e955069636b";

			public const string Spear = "c1534c5a-a97f-4bff-b512-e44d53706561";

			public const string SwordClaymore = "c1534c5a-b59c-4790-9b09-499553776f72";
		}

		public static class Misc
		{
			public static readonly List<string> All = new List<string>
			{
				"fa534c5a83ee4ec6bd641fec424c4142.Spawnable.VehicleGokart", "c1534c5a-5747-42a2-bd08-ab3b47616467", "c1534c5a-6b38-438a-a324-d7e147616467", "c1534c5a-3813-49d6-a98c-f595436f6e73", "c1534c5a-e963-4a7c-8c7e-1195546f7942", "c1534c5a-c6a8-45d0-aaa2-2c954465764d", "c1534c5a-87ce-436d-b00c-ef9547726176", "c1534c5a-a1c3-437b-85ac-e09547726176", " c1534c5a-cebf-42cc-be3a-4595506f7765", "c1534c5a-e777-4d15-b0c1-3195426f6172",
				"fa534c5a868247138f50c62e424c4144.Spawnable.OmniWay"
			};

			public const string GoKart = "fa534c5a83ee4ec6bd641fec424c4142.Spawnable.VehicleGokart";

			public const string OmniWay = "fa534c5a868247138f50c62e424c4144.Spawnable.OmniWay";

			public const string SpawnGun = "c1534c5a-5747-42a2-bd08-ab3b47616467";

			public const string NimbusGun = "c1534c5a-6b38-438a-a324-d7e147616467";

			public const string BoardGun = "c1534c5a-e777-4d15-b0c1-3195426f6172";

			public const string BalloonGun = "c1534c5a-e963-4a7c-8c7e-1195546f7942";

			public const string Constrainer = "c1534c5a-3813-49d6-a98c-f595436f6e73";

			public const string DevManipulator = "c1534c5a-c6a8-45d0-aaa2-2c954465764d";

			public const string GravityCup = "c1534c5a-87ce-436d-b00c-ef9547726176";

			public const string GravityPlate = "c1534c5a-a1c3-437b-85ac-e09547726176";

			public const string PowerPuncher = " c1534c5a-cebf-42cc-be3a-4595506f7765";
		}
	}
	public static class Extensions
	{
		public static void SetRpm(this Gun gun, float rpm)
		{
			gun.roundsPerMinute = rpm;
			gun.roundsPerSecond = rpm / 60f;
			gun.fireDuration = 60f / rpm;
		}

		public static void DealDamage(this AIBrain brain, float damage)
		{
			//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_002f: Expected O, but got Unknown
			object obj;
			if (brain == null)
			{
				obj = null;
			}
			else
			{
				BehaviourBaseNav behaviour = brain.behaviour;
				obj = ((behaviour != null) ? behaviour.health : null);
			}
			SubBehaviourHealth val = (SubBehaviourHealth)obj;
			if (val != null)
			{
				val.TakeDamage(1, new Attack
				{
					damage = damage
				});
			}
		}

		public static void InvokeActionSafe(this Action action)
		{
			SafeActions.InvokeActionSafe(action);
		}

		public static void InvokeActionSafe<T>(this Action<T> action, T param)
		{
			SafeActions.InvokeActionSafe(action, param);
		}

		public static void InvokeActionSafe<T1, T2>(this Action<T1, T2> action, T1 param1, T2 param2)
		{
			SafeActions.InvokeActionSafe(action, param1, param2);
		}

		public static T GetRandom<T>(this List<T> list)
		{
			int index = Random.Range(0, list.Count);
			return list.ElementAt(index);
		}
	}
	public enum GameLayers
	{
		DEFAULT = 1,
		TRANSPARENT_FX = 2,
		IGNORE_RAYCAST = 4,
		OBSERVER_TRIGGER = 8,
		WATER = 16,
		UI = 32,
		FIXTURE = 64,
		PLAYER = 256,
		NO_COLLIDE = 512,
		DYNAMIC = 1024,
		ENEMY_COLLIDERS = 4096,
		INTERACTABLE = 32768,
		DECAVERSE = 65536,
		DECIVERSE = 131072,
		SOCKET = 262144,
		PLUG = 524288,
		PLAYER_AND_NPC = 2097152,
		FEET_ONLY = 8388608,
		FEET = 16777216,
		NO_FOOTBALL = 33554432,
		ENTITY_TRACKER = 67108864,
		BEING_TRACKER = 134217728,
		OBSERVER_TRACKER = 268435456,
		ENTITY_TRIGGER = 536870912,
		BEING_TRIGGER = 1073741824,
		BACKGROUND = int.MinValue
	}
	public struct HandNotificationData
	{
		public InputHighlight inputHighlightLeft;

		public InputHighlight inputHighlightRight;

		public LocationHighlight leftHighlightLocation;

		public LocationHighlight rightHighlightLocation;

		public SpecificHand hand;

		public bool isRightHand;

		public string leftTutorialText;

		public string rightTutorialText;

		public int flashRate;

		public float holdTime;

		public Sprite leftSpriteImage;

		public Sprite rightSpriteImage;

		public AudioClip tutorialClip;
	}
	public struct HeadNotificationData
	{
		public string title;

		public string subtitle;

		public AudioClip clip;

		public float holdTime;

		public bool isAvatarLevel;

		public Sprite mainSprite;

		public Sprite spriteA;

		public Sprite spriteB;

		public Sprite spriteC;

		public Sprite spriteD;
	}
	public static class HelperMethods
	{
		private static readonly bool isAndroid = (int)MelonUtils.CurrentPlatform == 3;

		public static string GetCleanObjectName(string name)
		{
			name = new Regex("\\[\\d+\\]|\\(\\d+\\)").Replace(name, "");
			name = name.Replace("(Clone)", "");
			return name.Trim();
		}

		public static bool IsAndroid()
		{
			return isAndroid;
		}

		public static void SpawnCrate(string barcode, Vector3 position, Quaternion rotation = default(Quaternion), Vector3 scale = default(Vector3), bool ignorePolicy = false, Action<GameObject> spawnAction = null, Action<GameObject> despawnAction = null)
		{
			//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_0007: 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_0014: Expected O, but got Unknown
			SpawnCrate(new SpawnableCrateReference(barcode), position, rotation, scale, ignorePolicy, spawnAction, despawnAction);
		}

		public static void SpawnCrate(SpawnableCrateReference crateReference, Vector3 position, Quaternion rotation = default(Quaternion), Vector3 scale = default(Vector3), bool ignorePolicy = false, Action<GameObject> spawnAction = null, Action<GameObject> despawnAction = null)
		{
			//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_0012: 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_002c: Expected O, but got Unknown
			//IL_002c: 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_0046: Expected O, but got Unknown
			Spawnable val = new Spawnable
			{
				crateRef = crateReference
			};
			Nullable<Vector3> val2 = new Nullable<Vector3>
			{
				value = scale
			};
			Nullable<int> val3 = new Nullable<int>
			{
				value = 0
			};
			AssetSpawner.Register(val);
			AssetSpawner.Spawn(val, position, rotation, val2, (Transform)null, ignorePolicy, val3, Action<GameObject>.op_Implicit(spawnAction), Action<GameObject>.op_Implicit(despawnAction));
		}

		public static bool IsLoading()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			return (int)SceneStreamer.Session.Status == 1;
		}

		public static AssetBundle LoadEmbeddedAssetBundle(Assembly assembly, string name)
		{
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			AssetBundle result = null;
			if (manifestResourceNames.Contains(name))
			{
				ModConsole.Msg("Loading embedded resource data " + name + "...", LoggingMode.DEBUG);
				using Stream stream = assembly.GetManifestResourceStream(name);
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				ModConsole.Msg("Done!", LoggingMode.DEBUG);
				byte[] array = memoryStream.ToArray();
				ModConsole.Msg("Loading assetBundle from data " + name + ", please be patient...", LoggingMode.DEBUG);
				result = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
				ModConsole.Msg("Done!", LoggingMode.DEBUG);
			}
			return result;
		}

		public static T LoadPersistentAsset<T>(this AssetBundle assetBundle, string name) where T : Object
		{
			Object val = assetBundle.LoadAsset(name);
			if (val != (Object)null)
			{
				val.hideFlags = (HideFlags)32;
				return ((Il2CppObjectBase)val).TryCast<T>();
			}
			return default(T);
		}

		public static byte[] GetResourceBytes(Assembly assembly, string name)
		{
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (!text.Contains(name))
				{
					continue;
				}
				using Stream stream = assembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				return array;
			}
			return null;
		}

		public static bool CheckIfAssemblyLoaded(string name)
		{
			HashSet<Assembly> hashSet = new HashSet<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
			bool result = false;
			foreach (Assembly item in hashSet)
			{
				if (item.GetName().Name.ToLower() == name.ToLower())
				{
					result = true;
					break;
				}
			}
			return result;
		}
	}
	public static class Hooking
	{
		private struct DelayedHookData
		{
			public MethodInfo original;

			public MethodInfo hook;

			public bool isPrefix;

			public DelayedHookData(MethodInfo original, MethodInfo hook, bool isPrefix)
			{
				this.original = original;
				this.hook = hook;
				this.isPrefix = isPrefix;
			}
		}

		private static Harmony baseHarmony;

		private static Queue<DelayedHookData> delayedHooks = new Queue<DelayedHookData>();

		private static bool currentLevelUnloaded = true;

		public static event Action OnMarrowGameStarted;

		public static event Action OnWarehouseReady;

		public static event Action<LevelInfo> OnLevelLoading;

		public static event Action<LevelInfo> OnLevelLoaded;

		public static event Action OnLevelUnloaded;

		public static event Action OnUIRigCreated;

		public static event Action<Avatar> OnSwitchAvatarPrefix;

		public static event Action<Avatar> OnSwitchAvatarPostfix;

		public static event Action<float> OnPlayerDamageRecieved;

		public static event Action<bool> OnPlayerDeathImminent;

		public static event Action OnPlayerDeath;

		public static event Action<GameObject, Hand> OnGrabObject;

		public static event Action<Hand> OnReleaseObject;

		public static event Action<Grip, Hand> OnGripAttached;

		public static event Action<Grip, Hand> OnGripDetached;

		public static event Action<Gun> OnPreFireGun;

		public static event Action<Gun> OnPostFireGun;

		public static event Action<AIBrain> OnNPCBrainDie;

		public static event Action<AIBrain> OnNPCBrainResurrected;

		public static event Action<BehaviourBaseNav> OnNPCKillStart;

		public static event Action<BehaviourBaseNav> OnNPCKillEnd;

		internal static void SetHarmony(Harmony harmony)
		{
			baseHarmony = harmony;
		}

		internal static void InitHooks()
		{
			MarrowGame.RegisterOnReadyAction(Action.op_Implicit((Action)delegate
			{
				SafeActions.InvokeActionSafe(Hooking.OnMarrowGameStarted);
			}));
			AssetWarehouse.OnReady(Action.op_Implicit((Action)delegate
			{
				SafeActions.InvokeActionSafe(Hooking.OnWarehouseReady);
			}));
			CreateHook(typeof(RigManager).GetMethod("SwitchAvatar", AccessTools.all), typeof(Hooking).GetMethod("OnAvatarSwitchPrefix", AccessTools.all), isPrefix: true);
			CreateHook(typeof(RigManager).GetMethod("SwitchAvatar", AccessTools.all), typeof(Hooking).GetMethod("OnAvatarSwitchPostfix", AccessTools.all));
			CreateHook(typeof(Gun).GetMethod("OnFire", AccessTools.all), typeof(Hooking).GetMethod("OnFirePrefix", AccessTools.all), isPrefix: true);
			CreateHook(typeof(Gun).GetMethod("OnFire", AccessTools.all), typeof(Hooking).GetMethod("OnFirePostfix", AccessTools.all));
			CreateHook(typeof(Hand).GetMethod("AttachObject", AccessTools.all), typeof(Hooking).GetMethod("OnAttachObjectPostfix", AccessTools.all));
			CreateHook(typeof(Hand).GetMethod("DetachObject", AccessTools.all), typeof(Hooking).GetMethod("OnDetachObjectPostfix", AccessTools.all));
			CreateHook(typeof(Grip).GetMethod("OnAttachedToHand", AccessTools.all), typeof(Hooking).GetMethod("OnGripAttachedPostfix", AccessTools.all));
			CreateHook(typeof(Grip).GetMethod("OnDetachedFromHand", AccessTools.all), typeof(Hooking).GetMethod("OnGripDetachedPostfix", AccessTools.all));
			CreateHook(typeof(RigManager).GetMethod("OnDestroy", AccessTools.all), typeof(Hooking).GetMethod("OnRigManagerDestroyed", AccessTools.all));
			CreateHook(typeof(UIRig).GetMethod("Awake", AccessTools.all), typeof(Hooking).GetMethod("OnUIRigAwake", AccessTools.all));
			CreateHook(typeof(AIBrain).GetMethod("OnDeath", AccessTools.all), typeof(Hooking).GetMethod("OnBrainNPCDie", AccessTools.all));
			CreateHook(typeof(AIBrain).GetMethod("OnResurrection", AccessTools.all), typeof(Hooking).GetMethod("OnBrainNPCResurrected", AccessTools.all));
			CreateHook(typeof(BehaviourBaseNav).GetMethod("KillStart", AccessTools.all), typeof(Hooking).GetMethod("OnKillNPCStart", AccessTools.all));
			CreateHook(typeof(BehaviourBaseNav).GetMethod("KillEnd", AccessTools.all), typeof(Hooking).GetMethod("OnKillNPCEnd", AccessTools.all));
			CreateHook(typeof(PlayerMarker).GetMethod("OnPlayerSpawned", AccessTools.all), typeof(Hooking).GetMethod("OnPlayerSpawned", AccessTools.all));
			Player_Health.OnPlayerDamageReceived += PlayerDamageReceived.op_Implicit(Hooking.OnPlayerDamageRecieved);
			Player_Health.OnDeathImminent += PlayerDeathImminent.op_Implicit(Hooking.OnPlayerDeathImminent);
			Player_Health.OnPlayerDeath += PlayerDeath.op_Implicit(Hooking.OnPlayerDeath);
			while (delayedHooks.Count > 0)
			{
				DelayedHookData delayedHookData = delayedHooks.Dequeue();
				CreateHook(delayedHookData.original, delayedHookData.hook, delayedHookData.isPrefix);
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static void CreateHook(MethodInfo original, MethodInfo hook, bool isPrefix = false)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (baseHarmony == null)
			{
				delayedHooks.Enqueue(new DelayedHookData(original, hook, isPrefix));
				return;
			}
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			MelonMod val = ((IEnumerable<MelonMod>)MelonTypeBase<MelonMod>.RegisteredMelons).FirstOrDefault((Func<MelonMod, bool>)((MelonMod x) => ((MelonBase)x).MelonAssembly.Assembly.FullName == callingAssembly.FullName));
			object obj = ((val != null) ? ((MelonBase)val).HarmonyInstance : baseHarmony);
			HarmonyMethod val2;
			obj = (val2 = ((!isPrefix) ? ((HarmonyMethod)null) : new HarmonyMethod(hook)));
			HarmonyMethod val3 = (isPrefix ? ((HarmonyMethod)null) : new HarmonyMethod(hook));
			((Harmony)obj).Patch((MethodBase)original, val2, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			ModConsole.Msg($"New {(isPrefix ? "PREFIX" : "POSTFIX")} on {original.DeclaringType.Name}.{original.Name} to {hook.DeclaringType.Name}.{hook.Name}", LoggingMode.DEBUG);
		}

		private static void OnPlayerSpawned(GameObject go)
		{
			if (!Player.HandsExist && Player.FindObjectReferences())
			{
				SafeActions.InvokeActionSafe(Hooking.OnLevelLoaded, new LevelInfo(SceneStreamer.Session.Level));
			}
		}

		private static void OnRigManagerDestroyed()
		{
			currentLevelUnloaded = true;
			SafeActions.InvokeActionSafe(Hooking.OnLevelUnloaded);
		}

		private static void OnUIRigAwake()
		{
			if (Player.FindUIRigReferences())
			{
				SafeActions.InvokeActionSafe(Hooking.OnUIRigCreated);
			}
		}

		internal static void OnBONELABLevelLoading()
		{
			if (currentLevelUnloaded)
			{
				SafeActions.InvokeActionSafe(Hooking.OnLevelLoading, new LevelInfo(SceneStreamer.Session.Level));
				currentLevelUnloaded = false;
			}
		}

		private static void OnAvatarSwitchPrefix(Avatar newAvatar)
		{
			SafeActions.InvokeActionSafe(Hooking.OnSwitchAvatarPrefix, newAvatar);
		}

		private static void OnAvatarSwitchPostfix(Avatar newAvatar)
		{
			SafeActions.InvokeActionSafe(Hooking.OnSwitchAvatarPostfix, newAvatar);
		}

		private static void OnFirePrefix(Gun __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnPreFireGun, __instance);
		}

		private static void OnFirePostfix(Gun __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnPostFireGun, __instance);
		}

		private static void OnAttachObjectPostfix(GameObject objectToAttach, Hand __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnGrabObject, objectToAttach, __instance);
		}

		private static void OnDetachObjectPostfix(Hand __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnReleaseObject, __instance);
		}

		private static void OnGripAttachedPostfix(Grip __instance, Hand hand)
		{
			SafeActions.InvokeActionSafe(Hooking.OnGripAttached, __instance, hand);
		}

		private static void OnGripDetachedPostfix(Grip __instance, Hand hand)
		{
			SafeActions.InvokeActionSafe(Hooking.OnGripDetached, __instance, hand);
		}

		private static void OnBrainNPCDie(AIBrain __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnNPCBrainDie, __instance);
		}

		private static void OnBrainNPCResurrected(AIBrain __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnNPCBrainResurrected, __instance);
		}

		private static void OnKillNPCStart(BehaviourBaseNav __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnNPCKillStart, __instance);
		}

		private static void OnKillNPCEnd(BehaviourBaseNav __instance)
		{
			SafeActions.InvokeActionSafe(Hooking.OnNPCKillEnd, __instance);
		}
	}
	public struct LevelInfo
	{
		public string title;

		public string barcode;

		public LevelCrateReference levelReference;

		public LevelInfo(LevelCrateReference levelReference)
		{
			title = ((Scannable)((CrateReferenceT<LevelCrate>)(object)levelReference).Crate).Title;
			barcode = ((ScannableReference)levelReference).Barcode.ID;
			this.levelReference = levelReference;
		}

		public LevelInfo(LevelCrate level)
			: this(new LevelCrateReference(((Scannable)level).Barcode))
		{
		}//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown

	}
	public static class BuildInfo
	{
		public const string Name = "BoneLib";

		public const string Author = "The BONELAB Modding Community";

		public const string Company = "The BONELAB Modding Community";

		public const string Version = "3.0.0";

		public const string DownloadLink = "https://thunderstore.io/c/bonelab/p/gnonme/BoneLib";
	}
	internal class Main : MelonMod
	{
		public override void OnInitializeMelon()
		{
			ModConsole.Setup(((MelonBase)this).LoggerInstance);
			Preferences.Setup();
			Hooking.SetHarmony(((MelonBase)this).HarmonyInstance);
			Hooking.InitHooks();
			MenuBootstrap.InitializeBundles();
			Menu.Initialize();
			DefaultMenu.CreateDefaultElements();
			NotifAssets.SetupBundles();
			Hooking.OnLevelLoaded += OnLevelLoaded;
			Hooking.OnUIRigCreated += OnUIRigCreated;
			ClassInjector.RegisterTypeInIl2Cpp<PopupBox>();
			ModConsole.Msg("BoneLib loaded");
		}

		public override void OnUpdate()
		{
			if ((Object)(object)Player.ControllerRig != (Object)null && !Player.ControllerRig.quickmenuEnabled)
			{
				Player.ControllerRig.quickmenuEnabled = true;
			}
			Notifier.OnUpdate();
		}

		private void OnLevelLoaded(LevelInfo info)
		{
			PopupBoxManager.CreateBaseAd();
		}

		private void OnUIRigCreated()
		{
			MenuBootstrap.InitializeReferences();
		}
	}
	internal static class ModConsole
	{
		private static Instance logger;

		public static void Setup(Instance logger)
		{
			ModConsole.logger = logger;
		}

		public static void Msg(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text, args);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text, args);
			}
		}

		public static void Error(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text);
			}
		}

		public static void Error(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text);
			}
		}

		public static void Error(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text, args);
			}
		}

		public static void Warning(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text);
			}
		}

		public static void Warning(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text);
			}
		}

		public static void Warning(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text, args);
			}
		}
	}
	public class ModPref<T>
	{
		public MelonPreferences_Entry<T> entry { get; }

		public ModPref(MelonPreferences_Category category, string identifier, T default_value, string display_name = null, string description = null, bool is_hidden = false, bool dont_save_default = false, ValueValidator validator = null)
		{
			entry = category.CreateEntry<T>(identifier, default_value, display_name, description, is_hidden, dont_save_default, validator);
		}

		public static implicit operator T(ModPref<T> m)
		{
			return m.entry.Value;
		}
	}
	public static class Player
	{
		public static Avatar Avatar => RigManager.avatar;

		public static RigManager RigManager { get; private set; }

		public static PhysicsRig PhysicsRig { get; private set; }

		public static OpenControllerRig ControllerRig { get; private set; }

		public static RemapRig RemapRig { get; private set; }

		public static UIRig UIRig { get; private set; }

		public static Hand LeftHand { get; private set; }

		public static Hand RightHand { get; private set; }

		public static bool HandsExist
		{
			get
			{
				if ((Object)(object)LeftHand != (Object)null)
				{
					return (Object)(object)RightHand != (Object)null;
				}
				return false;
			}
		}

		public static BaseController LeftController { get; private set; }

		public static BaseController RightController { get; private set; }

		public static bool ControllersExist
		{
			get
			{
				if ((Object)(object)LeftController != (Object)null)
				{
					return (Object)(object)RightController != (Object)null;
				}
				return false;
			}
		}

		public static Transform Head { get; private set; }

		public static Transform Chest { get; private set; }

		internal static bool FindObjectReferences(RigManager manager = null)
		{
			ModConsole.Msg("Finding player object references");
			if ((Object)(object)manager == (Object)null)
			{
				manager = Object.FindObjectOfType<RigManager>();
			}
			RigManager = manager;
			PhysicsRig = RigManager.physicsRig;
			ControllerRig = ((Il2CppObjectBase)RigManager.ControllerRig).Cast<OpenControllerRig>();
			RemapRig = RigManager.remapHeptaRig;
			ControllerRig controllerRig = RigManager.ControllerRig;
			LeftController = ((controllerRig != null) ? controllerRig.leftController : null);
			ControllerRig controllerRig2 = RigManager.ControllerRig;
			RightController = ((controllerRig2 != null) ? controllerRig2.rightController : null);
			LeftHand = PhysicsRig.leftHand;
			RightHand = PhysicsRig.rightHand;
			Head = ((Rig)PhysicsRig).m_head;
			ModConsole.Msg("Found player object references", LoggingMode.DEBUG);
			if (ControllersExist && HandsExist)
			{
				return (Object)(object)ControllerRig != (Object)null;
			}
			return false;
		}

		internal static bool FindUIRigReferences()
		{
			UIRig = UIRig.Instance;
			return (Object)(object)UIRig != (Object)null;
		}

		public static PhysicsRig GetPhysicsRig()
		{
			if ((Object)(object)PhysicsRig == (Object)null)
			{
				PhysicsRig = Object.FindObjectOfType<PhysicsRig>();
			}
			return PhysicsRig;
		}

		public static T GetComponentInHand<T>(Hand hand) where T : Component
		{
			T val = default(T);
			if ((Object)(object)hand != (Object)null)
			{
				GameObject currentAttachedGO = hand.m_CurrentAttachedGO;
				if ((Object)(object)currentAttachedGO != (Object)null)
				{
					val = currentAttachedGO.GetComponentInParent<T>();
					if (!Object.op_Implicit((Object)(object)val))
					{
						val = currentAttachedGO.GetComponentInChildren<T>();
					}
				}
			}
			return val;
		}

		public static GameObject GetObjectInHand(Hand hand)
		{
			if (hand == null)
			{
				return null;
			}
			return hand.m_CurrentAttachedGO;
		}

		public static void RotatePlayer(float degrees)
		{
			if (!((Object)(object)RemapRig == (Object)null))
			{
				RemapRig.SetTwist(degrees);
			}
		}
	}
	internal static class Preferences
	{
		private static MelonPreferences_Category category = MelonPreferences.CreateCategory("BoneLib");

		public static ModPref<LoggingMode> loggingMode;

		public static ModPref<bool> skipIntro;

		public static void Setup()
		{
			skipIntro = new ModPref<bool>(category, "SkipIntro", default_value: false);
			loggingMode = new ModPref<LoggingMode>(category, "LoggingMode", LoggingMode.NORMAL);
			category.SaveToFile(false);
			ModConsole.Msg("Finished preferences setup", LoggingMode.DEBUG);
		}
	}
	public static class SafeActions
	{
		public static void InvokeActionSafe(Action action)
		{
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action)@delegate)();
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod? obj = ((IEnumerable<MelonMod>)MelonTypeBase<MelonMod>.RegisteredMelons).FirstOrDefault((Func<MelonMod, bool>)((MelonMod i) => ((MelonBase)i).MelonAssembly.Assembly.FullName == asm));
					ModConsole.Error("Exception while invoking hook callback!");
					((MelonBase)obj).LoggerInstance.Error(ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T>(Action<T> action, T param)
		{
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T>)@delegate)(param);
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod? obj = ((IEnumerable<MelonMod>)MelonTypeBase<MelonMod>.RegisteredMelons).FirstOrDefault((Func<MelonMod, bool>)((MelonMod i) => ((MelonBase)i).MelonAssembly.Assembly.FullName == asm));
					ModConsole.Error("Exception while invoking hook callback!");
					((MelonBase)obj).LoggerInstance.Error(ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T1, T2>(Action<T1, T2> action, T1 param1, T2 param2)
		{
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T1, T2>)@delegate)(param1, param2);
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod? obj = ((IEnumerable<MelonMod>)MelonTypeBase<MelonMod>.RegisteredMelons).FirstOrDefault((Func<MelonMod, bool>)((MelonMod i) => ((MelonBase)i).MelonAssembly.Assembly.FullName == asm));
					ModConsole.Error("Exception while invoking hook callback!");
					((MelonBase)obj).LoggerInstance.Error(ex.ToString());
				}
			}
		}
	}
}
namespace BoneLib.RandomShit
{
	public static class PopupBoxManager
	{
		private static GameObject basePopup;

		private const string API_SHIBE = "http://shibe.online/api/shibes";

		private const string API_CAT = "http://shibe.online/api/cats";

		private const string API_BIRD = "http://shibe.online/api/birds";

		internal static List<string> adMessages { get; private set; } = new List<string>
		{
			"BONETOME.COM FOR COOL NEW MODS", "GET THE CHUNGUS GUN IT DOES CHUNGUS STUFF \n\nhttps://bonetome.com/boneworks/code/87/", "MAKE THE GAME HARDER AND POWERED BY PAINKILLERS \n\nhttps://bonetome.com/boneworks/code/147/", "FEELING SNACKY? DOWNLOAD THE FOOD FRAMEWORK TODAY! \n\nhttps://bonetome.com/boneworks/code/185/", "i've never used this but apparently it's good? \n\nhttps://bonetome.com/boneworks/code/323/", "WHAT DOES IT DO? IT MODS. \n\nhttps://bonetome.com/boneworks/code/498/", "No memes here, this mod is actually so fun. \n\nhttps://bonetome.com/boneworks/code/661/", "DOWNLOAD NOW TO MAKE CHROMIUM VERY ANGRY!!!!1! \n\nhttps://bonetome.com/boneworks/simple/505/", "BEST MOD EVER v2 \n\nhttps://bonetome.com/boneworks/simple/719/", "GET YOUR GUNS AT BONETOME.COM TODAY",
			"THIS INTERRUPTION TO YOUR GAME IS SPONSORED BY TOMME150", "HAHAHA LASER GUN GO BRRRRR \n\nhttps://bonetome.com/boneworks/weapon/823/", "I don't get paid enough for this, and neither does TabloidA. \n\nSUPPORT THE BONETOME ON PATREON TODAY! \n\nhttps://www.patreon.com/thebonetome", "kinda pog ngl \n\nhttps://bonetome.com/boneworks/weapon/891/ https://bonetome.com/boneworks/weapon/894/", "BEST. PISTOL. EVER. \n\nhttps://bonetome.com/boneworks/weapon/798/", "THE THERMAL KATANA \nBRIGHTER THAN MY FUTURE. \n\nhttps://bonetome.com/boneworks/weapon/858/", "uwu uwu owo uwu uwu \n\nhttps://bonetome.com/boneworks/weapon/771/", "OMG GUYS IT'S A SHOTGUN!! LEAK!!1!!!!! \n\nhttps://bonetome.com/boneworks/weapon/413/", "THE BEST GUN YOU WILL EVER USE \n\nhttps://bonetome.com/boneworks/weapon/99/", "Just a friendly little fellow to keep you company while you play. \n\nhttps://bonetome.com/boneworks/item/114/",
			"guys this thing is really big lol \n\nhttps://bonetome.com/boneworks/weapon/361/", "Chap is Gay MINIGUN also tabloid no one likes you \n\nhttps://bonetome.com/boneworks/weapon/107/", "my motivation is gone and my life is spiraling into the abyss, but at least i have these honey badgers! download today! \n\nhttps://bonetome.com/boneworks/weapon/515/", "the constant stream of void energy being pumped into my brain is killing me, i can feel the names of my family growing fainter in my mind, but at least i have these honey badgers! download today! \n\nhttps://bonetome.com/boneworks/weapon/515/", "Ever wanted to have a thermal scope on a dope ass gun with laser beams? No? Well here it is anyways: \n\nhttps://bonetome.com/boneworks/weapon/918/", "Have bad aim? Download the SMART PISTOL! \n\nhttps://bonetome.com/boneworks/weapon/447/", "Half Life: Alyx pistol, for when you're too poor to afford the actual game. \n\nhttps://bonetome.com/boneworks/weapon/348/", "AMONG US PET POGGERS https://bonetome.com/boneworks/npc/464/", "Happy friendly NPCs for a good time :) \n\nhttps://bonetome.com/boneworks/npc/222/", "BONETOME IS GOOD \n\n\n\nBOTTOM TEXT",
			"there's a big purple thing and it looks kinda cool i guess \n\nhttps://bonetome.com/boneworks/map/520/", "void bad, you need to escape it. \n\nhttps://bonetome.com/boneworks/map/893/", "parkour but with melons? \nidk i never played it. \n\nhttps://bonetome.com/boneworks/map/899/", "rip bonetome.com :(", "Solace Station is kinda cool i guess \n\nhttps://boneworks.thunderstore.io/package/TabloidA/Solace_Station/", "hotel? chicago.", "GUYS IM FROM THE FUTURE! \nPROJECT 4 IS CALLED BONELAB!", "You should check out MrPotatoMod by Lucy Cola on thunderstore.io \nThat would be funny I think", "Nexus Mods is mid!", "Oops!... I corrupted the memory profile again",
			"haha you can't grab this one", "which one is your tabloid tabloid \nwhat", "Tabloid \"What, you think they're gonna have a mario-kart level? Yeah right\" A", "Parzival x Chromium: My Immortal", "The Fog is Coming"
		};


		internal static List<string> androidAdMessages { get; private set; } = new List<string>
		{
			"'Anything is possible with Lava Gang!' but apparently not supporting Quest", "SMH. not everone has a pec... Port this to quest.", "F*ck you. Quest owners are so supportive and yet motherfrickers like you just ignore a large number of users.", "Is therea Qest version?", "Upload this for Quest. Build it with the Quest Sdk and uploadpl ease", "gib qust suport", "waitin gfor the quest version!", "I was trying to install this to my qujest 2 but it wasn't. Why?", "Will you please work on porting it to quest 2 because I don't have a pc", "can u pls port this to quest? :) this would go great on it ^-^",
			"hi I was wondering if you would be able to add this to Quest? thanks.", "I was the Quest 2 but then the Mod was not the download when i clic kthe cdownload mod.", "can U add it on quest 2?", "can you make android copy please, thanks.", "can you port this to Quest?", "OMG the Pack for Quest button is RIGHT THERE, its NOT that hard to CLICK it and UPLOAD IT.", "Does this work on Quest 2?", "can you make it compatible withquest?", "do questr version? pls.", "can u port this to quest 2 pls",
			"port 2 quedt?", "can I mod this Into my Quest?", "omfg can you please not make mods that are PC only? not everyone can afford one.", "There are no QEst but I have. Why are you?"
		};


		public static GameObject CreateNewPopupBox()
		{
			string adText = adMessages[Random.Range(0, adMessages.Count)];
			if (HelperMethods.IsAndroid() && Random.Range(1, 11) != 5)
			{
				adText = "\"" + androidAdMessages[Random.Range(0, androidAdMessages.Count)] + "\" -fordkiller2014 (you.)";
			}
			return CreateNewPopupBox(adText);
		}

		public static GameObject CreateNewPopupBox(string adText)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)basePopup == (Object)null)
			{
				ModConsole.Error("PopupBoxManager: Base popup is null");
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(basePopup);
			TextMeshPro componentInChildren = val.GetComponentInChildren<TextMeshPro>();
			((TMP_Text)componentInChildren).text = adText;
			val.SetActive(true);
			((TMP_Text)componentInChildren).enableAutoSizing = true;
			((TMP_Text)componentInChildren).fontSizeMin = 0.5f;
			((TMP_Text)componentInChildren).fontSizeMax = 4f;
			((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)514;
			((TMP_Text)componentInChildren).enableWordWrapping = true;
			((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)514;
			if (adText == "haha you can't grab this one")
			{
				((Behaviour)val.GetComponentInChildren<BoxGrip>()).enabled = false;
			}
			val.AddComponent<PopupBox>();
			val.transform.position = Player.Head.position + Player.Head.forward * 2f;
			val.transform.rotation = Quaternion.LookRotation(val.transform.position - Player.Head.position);
			return val;
		}

		public static GameObject CreateNewImagePopup(byte[] imageBytes)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(imageBytes));
			GameObject val2 = Object.Instantiate<GameObject>(basePopup);
			((Component)val2.GetComponentInChildren<TextMeshPro>()).gameObject.SetActive(false);
			MeshRenderer componentInChildren = val2.GetComponentInChildren<MeshRenderer>();
			Material material = ((Renderer)componentInChildren).material;
			material.SetTexture("_BaseMap", (Texture)(object)val);
			material.color = Color.white;
			Vector3 localScale = ((Component)componentInChildren).transform.localScale;
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor((float)((Texture)val).width / (float)((Texture)val).height * localScale.y, localScale.y, localScale.z);
			((Component)componentInChildren).transform.localScale = val3;
			((Component)componentInChildren).transform.Rotate(((Component)componentInChildren).transform.up, 180f);
			foreach (BoxCollider componentsInChild in val2.GetComponentsInChildren<BoxCollider>())
			{
				componentsInChild.size = val3;
			}
			val2.SetActive(true);
			val2.transform.position = Player.Head.position + Player.Head.forward * 2f;
			val2.transform.rotation = Quaternion.LookRotation(val2.transform.position - Player.Head.position);
			return val2;
		}

		public static void CreateNewShibePopup(Action<GameObject> returnCallback = null)
		{
			MelonCoroutines.Start(SpawnImagePopupFromApi("http://shibe.online/api/shibes", returnCallback));
		}

		public static void CreateNewCatPopup(Action<GameObject> returnCallback = null)
		{
			MelonCoroutines.Start(SpawnImagePopupFromApi("http://shibe.online/api/cats", returnCallback));
		}

		public static void CreateNewBirdPopup(Action<GameObject> returnCallback = null)
		{
			MelonCoroutines.Start(SpawnImagePopupFromApi("http://shibe.online/api/birds", returnCallback));
		}

		private static IEnumerator SpawnImagePopupFromApi(string apiBase, Action<GameObject> callback)
		{
			UnityWebRequest urlReq = UnityWebRequest.Get(apiBase);
			yield return urlReq.BeginWebRequest();
			while ((int)urlReq.result == 0)
			{
				ModConsole.Msg($"Initial API request progress={urlReq.downloadProgress}", LoggingMode.DEBUG);
				yield return null;
			}
			if ((int)urlReq.result != 1)
			{
				try
				{
					callback?.Invoke(null);
					yield break;
				}
				finally
				{
					ModConsole.Error("Exception whilst invoking image popup callback with null to signify error.");
					ModConsole.Msg($"Initial API web request failed, status = {urlReq.result}", LoggingMode.DEBUG);
				}
			}
			string text = JsonConvert.DeserializeObject<string[]>(urlReq.downloadHandler.text)[0];
			UnityWebRequest imageReq = UnityWebRequest.Get(text);
			imageReq.BeginWebRequest();
			while ((int)imageReq.result == 0)
			{
				ModConsole.Msg($"Image request progress={urlReq.downloadProgress}", LoggingMode.DEBUG);
				yield return null;
			}
			if ((int)imageReq.result != 1)
			{
				try
				{
					callback?.Invoke(null);
					yield break;
				}
				finally
				{
					ModConsole.Error("Exception whilst invoking image popup callback with null to signify error.");
					ModConsole.Msg($"Image web request failed, status = {urlReq.result}", LoggingMode.DEBUG);
				}
			}
			GameObject obj = CreateNewImagePopup(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)imageReq.downloadHandler.data));
			callback?.Invoke(obj);
		}

		internal static void StartCoroutines()
		{
			MelonCoroutines.Start(CoSpawnAds());
		}

		internal static IEnumerator CoSpawnAds()
		{
			while ((Object)(object)basePopup == (Object)null)
			{
				yield return (object)new WaitForSeconds(5f);
			}
			GameObject val = CreateNewPopupBox();
			val.transform.position = Player.Head.position + Player.Head.forward * 2f;
			val.transform.rotation = Quaternion.LookRotation(val.transform.position - Player.Head.position);
			MelonCoroutines.Start(CoSpawnAds());
		}

		internal static void CreateBaseAd()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Expected O, but got Unknown
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			AudioClip[] array = Il2CppArrayBase<AudioClip>.op_Implicit(Resources.FindObjectsOfTypeAll<AudioClip>());
			List<AudioClip> list = new List<AudioClip>();
			AudioClip[] array2 = array;
			foreach (AudioClip val in array2)
			{
				if (((Object)val).name.Contains("ImpactSoft_SwordBroad"))
				{
					list.Add(val);
				}
			}
			HandPose sandwichHandPose = null;
			HandPose edgeHandPose = null;
			HandPose cornerHandPose = null;
			HandPose faceHandPose = null;
			HandPose[] array3 = Il2CppArrayBase<HandPose>.op_Implicit(Resources.FindObjectsOfTypeAll<HandPose>());
			foreach (HandPose val2 in array3)
			{
				if (((Object)val2).name == "BoxSandwichGrip")
				{
					sandwichHandPose = val2;
				}
				else if (((Object)val2).name == "BoxEdgeGrip")
				{
					edgeHandPose = val2;
				}
				else if (((Object)val2).name == "BoxCornerGrip")
				{
					cornerHandPose = val2;
				}
				else if (((Object)val2).name == "BoxFaceGrip")
				{
					faceHandPose = val2;
				}
			}
			basePopup = new GameObject("Ad Base");
			basePopup.SetActive(false);
			Rigidbody obj = basePopup.AddComponent<Rigidbody>();
			obj.mass = 8f;
			obj.drag = 0.15f;
			obj.angularDrag = 0.15f;
			ImpactProperties obj2 = basePopup.AddComponent<ImpactProperties>();
			obj2.decalType = (DecalType)0;
			obj2.megaPascalModifier = 1f;
			ImpactSFX val3 = basePopup.AddComponent<ImpactSFX>();
			val3.impactSoft = Il2CppReferenceArray<AudioClip>.op_Implicit(list.ToArray());
			val3.impactHard = Il2CppReferenceArray<AudioClip>.op_Implicit(list.ToArray());
			val3.pitchMod = 1f;
			val3.bluntDamageMult = 1f;
			val3.minVelocity = 0.4f;
			val3.velocityClipSplit = 4f;
			val3.jointBreakVolume = 1f;
			basePopup.AddComponent<InteractableHost>();
			GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val4).name = "Mesh";
			val4.transform.parent = basePopup.transform;
			val4.transform.localPosition = Vector3.zero;
			val4.transform.localScale = new Vector3(2f, 1f, 0.02f);
			((Renderer)val4.GetComponent<MeshRenderer>()).material.shader = Shader.Find("Universal Render Pipeline/Lit (PBR Workflow)");
			((Renderer)val4.GetComponent<MeshRenderer>()).material.color = new Color(0.1509434f, 0.1509434f, 0.1509434f);
			GameObject val5 = new GameObject("Grip");
			val5.transform.parent = basePopup.transform;
			val5.layer = LayerMask.NameToLayer("Interactable");
			BoxCollider val6 = val5.AddComponent<BoxCollider>();
			val6.size = val4.transform.localScale;
			((Collider)val4.GetComponent<BoxCollider>()).enabled = false;
			BoxGrip val7 = val5.AddComponent<BoxGrip>();
			((Grip)val7).isThrowable = true;
			((Grip)val7).handleAmplifyCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(-180f, 0f),
				new Keyframe(180f, 0f)
			});
			((Grip)val7).gripOptions = (InteractionOptions)1;
			((Grip)val7).priority = 1f;
			((Grip)val7).minBreakForce = float.PositiveInfinity;
			((Grip)val7).maxBreakForce = float.PositiveInfinity;
			((Grip)val7).defaultGripDistance = float.PositiveInfinity;
			((Grip)val7).gripDistanceSqr = float.PositiveInfinity;
			((TargetGrip)val7).rotationLimit = 180f;
			((TargetGrip)val7).rotationPriorityBuffer = 20f;
			val7.sandwichSize = 0.12f;
			val7.edgePadding = 0.1f;
			val7.sandwichHandPose = sandwichHandPose;
			val7.canBeSandwichedGrabbed = true;
			val7.edgeHandPose = edgeHandPose;
			val7.edgeHandPoseRadius = 0.05f;
			val7.canBeEdgeGrabbed = true;
			val7.cornerHandPose = cornerHandPose;
			val7.cornerHandPoseRadius = 0.05f;
			val7.canBeCornerGrabbed = true;
			val7.faceHandPose = faceHandPose;
			val7.faceHandPoseRadius = 1f;
			val7.canBeFaceGrabbed = true;
			val7.enabledCorners = (Corners)(-1);
			val7.enabledEdges = (Edges)(-1);
			val7.enabledFaces = (Faces)(-1);
			val7._boxCollider = val6;
			ObjectDestructible obj3 = basePopup.AddComponent<ObjectDestructible>();
			obj3.damageFromImpact = true;
			obj3.blasterScale = Vector3.one * 3f;
			obj3.maxHealth = 30f;
			obj3.reqHitCount = 1;
			obj3.perBloodied = 0.1f;
			obj3.explosiveForceOnDestruct = 1f;
			obj3.damageFromAttack = true;
			obj3.attackMod = 2f;
			obj3.modTypeDamage = 2f;
			obj3.modImpact = 1f;
			obj3.thrImpact = 3f;
			obj3.feetDamageMult = 0.1f;
			obj3._impactSfx = val3;
			GameObject val8 = new GameObject("Text");
			val8.transform.parent = basePopup.transform;
			TextMeshPro obj4 = val8.AddComponent<TextMeshPro>();
			((TMP_Text)obj4).enableAutoSizing = true;
			((TMP_Text)obj4).fontSizeMin = 0.5f;
			((TMP_Text)obj4).fontSizeMax = 4f;
			((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj4).enableWordWrapping = true;
			RectTransform component = val8.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(2f, 1f);
			((Transform)component).localPosition = new Vector3(0f, 0f, -0.015f);
		}
	}
}
namespace BoneLib.Notifications
{
	internal static class NotifAssets
	{
		internal static Texture2D Information;

		internal static Texture2D Warning;

		internal static Texture2D Error;

		internal static Texture2D Success;

		internal static void SetupBundles()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = (HelperMethods.IsAndroid() ? "BoneLib.Resources.notifications.android.bundle" : "BoneLib.Resources.notifications.bundle");
			AssetBundle assetBundle = HelperMethods.LoadEmbeddedAssetBundle(executingAssembly, name);
			Information = assetBundle.LoadPersistentAsset<Texture2D>("Assets/information.png");
			Warning = assetBundle.LoadPersistentAsset<Texture2D>("Assets/warning.png");
			Error = assetBundle.LoadPersistentAsset<Texture2D>("Assets/error.png");
			Success = assetBundle.LoadPersistentAsset<Texture2D>("Assets/success.png");
		}
	}
	public enum NotificationType
	{
		Information,
		Warning,
		Error,
		Success,
		CustomIcon
	}
	public struct NotificationText
	{
		public string Text;

		public Color Color;

		public bool RichText;

		public NotificationText(string text)
			: this(text, Color.white)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)


		public NotificationText(string text, Color color, bool richText = false)
		{
			//IL_0022: 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)
			if (!richText)
			{
				text = new Regex("<[^>]*>").Replace(text, string.Empty);
			}
			Text = text;
			Color = color;
			RichText = richText;
		}

		public static implicit operator NotificationText(string text)
		{
			return new NotificationText(text);
		}
	}
	public class Notification
	{
		public NotificationText Title;

		public NotificationText Message;

		public bool ShowTitleOnPopup;

		public float PopupLength = 2f;

		public NotificationType Type;

		public Texture2D CustomIcon;
	}
	public static class Notifier
	{
		private static readonly Queue<Notification> QueuedNotifications = new Queue<Notification>();

		private static bool _hasEnabledTutorialRig = false;

		public static void Send(Notification notification)
		{
			QueueNotification(notification);
		}

		private static void QueueNotification(Notification notification)
		{
			QueuedNotifications.Enqueue(notification);
		}

		private static void DequeueNotification()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			Notification notification = QueuedNotifications.Dequeue();
			if ((Object)(object)Player.RigManager != (Object)null)
			{
				HeadTitles headTitles = TutorialRig.Instance.headTitles;
				EnableTutorialRig();
				string text = "New Notification";
				if (notification.ShowTitleOnPopup)
				{
					text = notification.Title.Text;
				}
				string text2 = notification.Message.Text;
				Texture2D val = (Texture2D)(notification.Type switch
				{
					NotificationType.Warning => NotifAssets.Warning, 
					NotificationType.Error => NotifAssets.Error, 
					NotificationType.Success => NotifAssets.Success, 
					NotificationType.Information => NotifAssets.Information, 
					NotificationType.CustomIcon => notification.CustomIcon, 
					_ => NotifAssets.Information, 
				});
				Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
				float popupLength = notification.PopupLength;
				headTitles.CUSTOMDISPLAY(text, text2, val2, popupLength, (AudioClip)null, false, (Sprite)null, (Sprite)null, (Sprite)null, (Sprite)null);
				headTitles.sr_element.sprite = val2;
			}
		}

		private static void EnableTutorialRig()
		{
			if ((Object)(object)Player.RigManager != (Object)null)
			{
				TutorialRig instance = TutorialRig.Instance;
				HeadTitles headTitles = instance.headTitles;
				((Component)instance).gameObject.SetActive(true);
				((Component)headTitles).gameObject.SetActive(true);
			}
		}

		private static bool IsPlayingNotification()
		{
			if ((Object)(object)Player.RigManager != (Object)null)
			{
				return ((Component)TutorialRig.Instance.headTitles.headFollower).gameObject.activeInHierarchy;
			}
			return false;
		}

		internal static void OnUpdate()
		{
			if (QueuedNotifications.Count > 0 && !HelperMethods.IsLoading() && (Object)(object)Player.RigManager != (Object)null)
			{
				if (!_hasEnabledTutorialRig)
				{
					EnableTutorialRig();
					_hasEnabledTutorialRig = true;
				}
				else if (QueuedNotifications.Count > 0 && !IsPlayingNotification())
				{
					DequeueNotification();
				}
			}
			else
			{
				_hasEnabledTutorialRig = false;
			}
		}
	}
}
namespace BoneLib.MonoBehaviours
{
	internal class PopupBox : MonoBehaviour
	{
		private TextMeshPro Il2CppTMPro;

		private float timeToLerp = 5f;

		private float timeForNextColor;

		private int curColorIndex;

		private int nextColorIndex = 1;

		private Color[] colors = (Color[])(object)new Color[4]
		{
			Color.red,
			Color.yellow,
			Color.green,
			Color.blue
		};

		public PopupBox(IntPtr intPtr)
			: base(intPtr)
		{
		}//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)


		private void Start()
		{
			Il2CppTMPro = ((Component)this).gameObject.GetComponentInChildren<TextMeshPro>();
			timeForNextColor = Time.time + timeToLerp;
		}

		private void Update()
		{
			//IL_005f: 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)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time >= timeForNextColor)
			{
				curColorIndex = nextColorIndex;
				if (++nextColorIndex == colors.Length)
				{
					nextColorIndex = 0;
				}
				timeForNextColor = Time.time + timeToLerp;
			}
			((Graphic)Il2CppTMPro).color = Color.Lerp(colors[curColorIndex], colors[nextColorIndex], Mathf.InverseLerp(timeForNextColor - timeToLerp, timeForNextColor, Time.time));
		}
	}
}
namespace BoneLib.BoneMenu
{
	internal static class DefaultMenu
	{
		private static int lightAmmoValue = 100;

		private static int mediumAmmoValue = 100;

		private static int heavyAmmoValue = 100;

		private static string textValue = "";

		private static AmmoInventory AmmoInventory => AmmoInventory.Instance;

		private static AmmoGroup LightAmmo => AmmoInventory.lightAmmoGroup;

		private static AmmoGroup MediumAmmo => AmmoInventory.mediumAmmoGroup;

		private static AmmoGroup HeavyAmmo => AmmoInventory.heavyAmmoGroup;

		public static void CreateDefaultElements()
		{
			//IL_000a: 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)
			//IL_002f: 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_0053: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			Page page = Page.Root.CreatePage("BoneLib", Color.white);
			Page page2 = page.CreatePage("Ammo Settings", Color.yellow);
			Page page3 = page.CreatePage("Item Spawning", Color.white);
			Page page4 = page.CreatePage("Fun Stuff", Color.white);
			page2.CreateFunction("Add Light Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(LightAmmo, lightAmmoValue);
			});
			page2.CreateFunction("Add Medium Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(MediumAmmo, mediumAmmoValue);
			});
			page2.CreateFunction("Add Heavy Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(HeavyAmmo, heavyAmmoValue);
			});
			page2.CreateInt("Light Ammo", Color.white, lightAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				lightAmmoValue = value;
			});
			page2.CreateInt("Medium Ammo", Color.white, mediumAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				mediumAmmoValue = value;
			});
			page2.CreateInt("Heavy Ammo", Color.white, heavyAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				heavyAmmoValue = value;
			});
			page3.CreateFunction("Spawn Utility Gun", Color.white, SpawnUtilityGun);
			page3.CreateFunction("Spawn Nimbus Gun", Color.white, SpawnNimbusGun);
			page3.CreateFunction("Spawn Random Gun", Color.white, SpawnRandomGun);
			page3.CreateFunction("Spawn Random Melee", Color.white, SpawnRandomMelee);
			page3.CreateFunction("Spawn Random NPC", Color.white, SpawnRandomNPC);
			page3.CreateFunction("Load Random Level", Color.white, LoadRandomLevel);
			page4.CreateFunction("Spawn Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewPopupBox();
			});
			page4.CreateFunction("Spawn Shibe Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewShibePopup();
			});
			page4.CreateFunction("Spawn Bird Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewBirdPopup();
			});
			page4.CreateFunction("Spawn Cat Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewCatPopup();
			});
			page4.CreateString("Notification Text", Color.white, "None", delegate(string input)
			{
				textValue = input;
			});
			page4.CreateFunction("Notification Test", Color.white, delegate
			{
				Notifier.Send(new Notification
				{
					Title = "Hello!",
					Message = textValue,
					Type = NotificationType.Error,
					ShowTitleOnPopup = true,
					PopupLength = 5f
				});
			});
			page4.CreateFunction("Make Dialog", Color.white, delegate
			{
				Menu.DisplayDialog("Test", "This is a test message. Don't worry about it.", null, delegate
				{
					ModConsole.Msg("Hello from the Dialog confirm option!");
				});
			});
		}

		internal static void SpawnUtilityGun()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			Transform head = Player.Head;
			HelperMethods.SpawnCrate("c1534c5a-5747-42a2-bd08-ab3b47616467", head.position + head.forward, default(Quaternion), Vector3.one);
		}

		internal static void SpawnNimbusGun()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			Transform head = Player.Head;
			HelperMethods.SpawnCrate("c1534c5a-6b38-438a-a324-d7e147616467", head.position + head.forward, default(Quaternion), Vector3.one);
		}

		internal static void SpawnRandomGun()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
			Transform head = Player.Head;
			int index = Random.RandomRangeInt(0, CommonBarcodes.Guns.All.Count);
			HelperMethods.SpawnCrate(CommonBarcodes.Guns.All[index], head.position + head.forward, default(Quaternion), Vector3.one);
		}

		internal static void SpawnRandomMelee()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
			Transform head = Player.Head;
			int index = Random.RandomRangeInt(0, CommonBarcodes.Melee.All.Count);
			HelperMethods.SpawnCrate(CommonBarcodes.Melee.All[index], head.position + head.forward, default(Quaternion), Vector3.one);
		}

		internal static void SpawnRandomNPC()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)Player.PhysicsRig.artOutput).transform;
			int index = Random.RandomRangeInt(0, CommonBarcodes.NPCs.All.Count);
			HelperMethods.SpawnCrate(CommonBarcodes.NPCs.All[index], transform.position + transform.forward, default(Quaternion), Vector3.one);
		}

		internal static void LoadRandomLevel()
		{
			//IL_001c: 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_0030: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			int index = Random.RandomRangeInt(0, CommonBarcodes.Maps.All.Count);
			SceneStreamer.Load(new Barcode(CommonBarcodes.Maps.All[index]), new Barcode("fa534c5a83ee4ec6bd641fec424c4142.Level.DefaultLoad"));
		}
	}
	[Serializable]
	public class BoolElement : Element
	{
		private bool _startValue;

		private bool _value;

		private Action<bool> _callback;

		public bool Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				OnElementChanged?.Invoke();
			}
		}

		public BoolElement(string name, Color color, bool startValue, Action<bool> callback = null)
			: base(name, color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			_elementName = name;
			_elementColor = color;
			_elementType = "Function";
			_startValue = startValue;
			_callback = callback;
			_value = _startValue;
		}

		public override void OnElementSelected()
		{
			_value = !_value;
			_callback?.Invoke(_value);
		}
	}
	[Serializable]
	public class Dialog
	{
		public static Action<Dialog> OnDialogOpened;

		public static Action<Dialog> OnDialogClosed;

		public static Texture2D ErrorIcon;

		public static Texture2D WarningIcon;

		public static Texture2D InfoIcon;

		public static Texture2D QuestionIcon;

		private Action _confirmAction;

		private Action _denyAction;

		private string _dialogTitle;

		private string _dialogDescription;

		private Texture2D _dialogIcon;

		public string DialogTitle => _dialogTitle;

		public string DialogDescription => _dialogDescription;

		public bool HasConfirmAction => _confirmAction != null;

		public bool HasDenyAction => _denyAction != null;

		public Texture2D DialogIcon => _dialogIcon;

		public Dialog(string title, string description, Texture2D icon, Action confirmAction = null, Action denyAction = null)
		{
			_dialogTitle = title;
			_dialogDescription = description;
			_dialogIcon = icon;
			_confirmAction = confirmAction;
			_denyAction = denyAction;
		}

		public void OnConfirmPressed()
		{
			_confirmAction.InvokeActionSafe();
		}

		public void OnDeclinePressed()
		{
			_denyAction.InvokeActionSafe();
		}
	}
	[Serializable]
	public class Element
	{
		public Action OnElementChanged;

		protected string _elementName;

		protected Color _elementColor;

		protected string _elementType;

		protected string _elementTooltip;

		public string ElementName
		{
			get
			{
				return _elementName;
			}
			set
			{
				_elementName = value;
				OnElementChanged?.Invoke();
			}
		}

		public Color ElementColor
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _elementColor;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				_elementColor = value;
				OnElementChanged?.Invoke();
			}
		}

		public string ElementType => _elementType;

		public string ElementTooltip
		{
			get
			{
				return _elementTooltip;
			}
			set
			{
				_elementTooltip = value;
				OnElementChanged?.Invoke();
			}
		}

		public bool HasTooltip => !string.IsNullOrEmpty(_elementTooltip);

		public ElementProperties Properties { get; private set; }

		public Element(string name, Color color)
		{
			//IL_000e: 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)
			_elementName = name;
			_elementColor = color;
			_elementType = "Base";
		}

		public void SetProperty(ElementProperties properties)
		{
			Properties = properties;
		}

		public virtual void OnElementAdded()
		{
		}

		public virtual void OnElementHover()
		{
		}

		public virtual void OnElementSelected()
		{
		}

		public virtual void OnElementDeselected()
		{
		}

		public virtual void OnElementPressed()
		{
		}

		public virtual void OnElementRemoved()
		{
		}

		public void SetTooltip(string tooltip)
		{
			_elementTooltip = tooltip;
		}
	}
	[Flags]
	public enum ElementProperties : byte
	{
		Default = 0,
		NoBorder = 1,
		Password = 2
	}
	public class EnumElement : Element
	{
		private Action<Enum> _callback;

		private Enum _value;

		private Array _internalValues;

		private int _index = 1;

		public Enum Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				OnElementChanged?.Invoke();
			}
		}

		public EnumElement(string name, Color color, Enum value, Action<Enum> callback)
			: base(name, color)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			_internalValues = Enum.GetValues(value.GetType());
			_value = value;
			_callback = callback;
			Array values = Enum.GetValues(value.GetType());
			_index = Array.IndexOf(values, values.OfType<Enum>().First((Enum v) => v.Equals(value))) + 1;
		}

		public void GetNext()
		{
			_index %= _internalValues.Length;
			_value = _internalValues.GetValue(_index++) as Enum;
			_callback?.InvokeActionSafe(_value);
		}
	}
	public class FloatElement : Element
	{
		public static Action<Element, float> OnValueChanged;

		private Action<float> _callback;

		private float _value;

		private float _minValue;

		private float _maxValue;

		private float _increment;

		public float Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				OnElementChanged?.Invoke();
			}
		}

		public FloatElement(string name, Color color, float startValue, float increment, float minValue, float maxValue, Action<float> callback = null)
			: base(name, color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			_elementName = name;
			_elementColor = color;
			_elementType = "Float";
			_value = startValue;
			_minValue = minValue;
			_maxValue = maxValue;
			_increment = increment;
			_callback = callback;
		}

		public void Increment()
		{
			_value = Mathf.Min(_maxValue, Mathf.Max(_minValue, _value + _increment));
			OnValueChanged?.Invoke(this, _value);
			_callback?.InvokeActionSafe(_value);
		}

		public void Decrement()
		{
			_value = Mathf.Max(_minValue, Mathf.Min(_maxValue, _value - _increment));
			OnValueChanged?.Invoke(this, _value);
			_callback?.InvokeActionSafe(_value);
		}
	}
	[Serializable]
	public class FunctionElement : Element
	{
		private Texture2D _logo;

		private Action _callback;

		public Texture2D Logo
		{
			get
			{
				return _logo;
			}
			set
			{
				_logo = value;
				OnElementChanged?.Invoke();
			}
		}

		public FunctionElement(string name, Color color, Action callback)
			: base(name, color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			_elementName = name;
			_elementColor = color;
			_callback = callback;
		}

		public override void OnElementSelected()
		{
			_callback?.Invoke();
		}
	}
	public class IntElement : Element
	{
		public static Action<Element, int> OnValueChanged;

		private int _value;

		private int _minValue;

		private int _maxValue;

		private int _increment;

		private Action<int> _callback;

		public int Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				OnElementChanged?.Invoke();
			}
		}

		public IntElement(string name, Color color, int startValue, int increment, int minValue, int maxValue, Action<int> callback)
			: base(name, color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			_elementName = name;
			_elementColor = color;
			_elementType = "Int";
			_value = startValue;
			_minValue = minValue;
			_maxValue = maxValue;
			_increment = increment;
			_callback = callback;
		}

		public void Increment()
		{
			_value = Mathf.Min(_maxValue, Mathf.Max(_minValue, _value + _increment));
			OnValueChanged?.Invoke(this, _value);
			_callback?.InvokeActionSafe(_value);
		}

		public void Decrement()
		{
			_value = Mathf.Max(_minValue, Mathf.Min(_maxValue, _value - _increment));
			OnValueChanged?.Invoke(this, _value);
			_callback?.InvokeActionSafe(_value);
		}
	}
	[Serializable]
	public class PageLinkElement : FunctionElement
	{
		private Page _linkedPage;

		public Page LinkedPage => _linkedPage;

		public PageLinkElement(string name, Color color, Action callback)
			: base(name, color, callback)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)


		public void AssignPage(Page page)
		{
			_linkedPage = page;
			Menu.OnPageUpdated = (Action<Page>)Delegate.Combine(Menu.OnPageUpdated, new Action<Page>(OnPageUpdated));
		}

		public override void OnElementRemoved()
		{
			base.OnElementRemoved();
			if (_linkedPage != null)
			{
				Menu.OnPageUpdated = (Action<Page>)Delegate.Remove(Menu.OnPageUpdated, new Action<Page>(OnPageUpdated));
				_linkedPage = null;
			}
		}

		[HideFromIl2Cpp]
		private void OnPageUpdated(Page page)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (page == _linkedPage)
			{
				base.ElementName = page.Name;
				base.ElementColor = page.Color;
			}
		}
	}
	[Serializable]
	public class StringElement : Element
	{
		private string _startValue;

		private string _value;

		private Action<string> _callback;

		public string Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				OnElementChanged?.Invoke();
			}
		}

		public StringElement(string name, Color color, string startValue, Action<string> callback = null)
			: base(name, color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			_elementName = name;
			_elementColor = color;
			_startValue = startValue;
			_callback = callback;
		}

		public override void OnElementSelected()
		{
			base.OnElementSelected();
			_callback?.Invoke(_value);
		}
	}
	public enum LayoutType
	{
		Default,
		Horizontal,
		Vertical,
		Grid
	}
	[Serializable]
	public static class Menu
	{
		public static Action<Page> OnPageCreated;

		public static Action<Page> OnPageOpened;

		public static Action<Page> OnPageUpdated;

		public static Action<Page> OnPageRemoved;

		public static Page CurrentPage;

		public static Dictionary<string, Page> PageDirectory;

		private static bool _initialized;

		public static Dialog ActiveDialog { get; private set; }

		public static void Initialize()
		{
			if (!_initialized)
			{
				PageDirectory = new Dictionary<string, Page>();
				Page.Root = new Page("BoneMenu", 10);
				Page.Root.SetLayout(LayoutType.Vertical);
				OpenPage(Page.Root);
				_initialized = true;
			}
		}

		public static Page CreatePage(string name, int maxElements = 0, bool createLink = true)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return CreatePage(Page.Root, name, Color.white, maxElements, createLink);
		}

		public static Page CreatePage(Page parent, string name, int maxElements = 0, bool createLink = true)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return CreatePage(parent, name, Color.white, maxElements, createLink);
		}

		public static Page CreatePage(string name, Color color, int maxElements = 0, bool createLink = true)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return CreatePage(Page.Root, name, co

Plugins/BoneLibUpdater.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLibUpdater;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BoneLibUpdater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("BoneLibUpdater")]
[assembly: AssemblyCopyright("Created by Gnonme")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "BoneLibUpdater", "1.1.1", "Gnonme", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.1.1.0")]
namespace BoneLibUpdater;

public static class BuildInfo
{
	public const string Name = "BoneLibUpdater";

	public const string Author = "Gnonme";

	public const string Company = null;

	public const string Version = "1.1.1";

	public const string DownloadLink = null;
}
public class Main : MelonPlugin
{
	private MelonPreferences_Category prefsCategory = MelonPreferences.CreateCategory("BoneLibUpdater");

	private MelonPreferences_Entry<bool> offlineModePref;

	public static readonly string boneLibAssemblyPath = Path.Combine(MelonEnvironment.ModsDirectory, "BoneLib.dll");

	public static readonly string boneLibUpdaterAssemblyPath = Path.Combine(MelonEnvironment.PluginsDirectory, "BoneLibUpdater.dll");

	private bool isOffline => offlineModePref.Value;

	public static Instance Logger { get; private set; }

	public override void OnPreInitialization()
	{
		Logger = ((MelonBase)this).LoggerInstance;
		offlineModePref = prefsCategory.CreateEntry<bool>("OfflineMode", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		prefsCategory.SaveToFile(false);
		((MelonBase)this).LoggerInstance.Msg(isOffline ? ConsoleColor.Yellow : ConsoleColor.Green, isOffline ? "BoneLib is in OFFLINE mode" : "BoneLib is in ONLINE mode");
		if (isOffline)
		{
			if (!File.Exists(boneLibAssemblyPath))
			{
				((MelonBase)this).LoggerInstance.Warning("BoneLib.dll was not found in the Mods folder");
				((MelonBase)this).LoggerInstance.Warning("Download it from github or switch to ONLINE mode");
				((MelonBase)this).LoggerInstance.Warning("https://github.com/yowchap/BoneLib/releases");
			}
		}
		else
		{
			Updater.UpdateMod();
		}
	}

	public override void OnApplicationQuit()
	{
		Updater.UpdatePlugin();
	}
}
internal static class Updater
{
	private static readonly string dataDir = Path.Combine(MelonEnvironment.UserDataDirectory, "BoneLibUpdater");

	private static readonly string updaterAppName = "updater.exe";

	private static bool pluginNeedsUpdating = false;

	public static void UpdateMod()
	{
		Version value = new Version(0, 0, 0);
		if (File.Exists(Main.boneLibAssemblyPath))
		{
			AssemblyName assemblyName = AssemblyName.GetAssemblyName(Main.boneLibAssemblyPath);
			value = new Version(assemblyName.Version.Major, assemblyName.Version.Minor, assemblyName.Version.Build);
			Main.Logger.Msg($"BoneLib.dll found in Mods folder. Version: {value}");
		}
		try
		{
			Directory.CreateDirectory(dataDir);
			string text = Path.Combine(dataDir, updaterAppName);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().First((string x) => x.Contains(updaterAppName));
			using (Stream stream = executingAssembly.GetManifestResourceStream(name))
			{
				using FileStream destination = File.Create(text);
				stream.CopyTo(destination);
			}
			Process process = new Process();
			process.StartInfo.FileName = text;
			process.StartInfo.Arguments = $"{value} \"{Main.boneLibAssemblyPath}\" \"{Main.boneLibUpdaterAssemblyPath}\" \"false\"";
			process.Start();
			process.WaitForExit();
			switch ((ExitCode)process.ExitCode)
			{
			case ExitCode.Success:
				Main.Logger.Msg("BoneLib.dll updated successfully!");
				pluginNeedsUpdating = true;
				break;
			case ExitCode.UpToDate:
				Main.Logger.Msg("BoneLib.dll is already up to date");
				break;
			case ExitCode.Error:
				Main.Logger.Error("BoneLib.dll failed to update");
				break;
			}
		}
		catch (Exception ex)
		{
			Main.Logger.Error("Error while running BoneLib updater");
			Main.Logger.Error(ex.ToString());
		}
	}

	public static void UpdatePlugin()
	{
		if (!pluginNeedsUpdating)
		{
			return;
		}
		Directory.CreateDirectory(dataDir);
		string text = Path.Combine(dataDir, updaterAppName);
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string name = executingAssembly.GetManifestResourceNames().First((string x) => x.Contains(updaterAppName));
		using (Stream stream = executingAssembly.GetManifestResourceStream(name))
		{
			using FileStream destination = File.Create(text);
			stream.CopyTo(destination);
		}
		Process process = new Process();
		process.StartInfo.FileName = text;
		process.StartInfo.Arguments = $"{new Version(0, 0, 0)} \"{Main.boneLibAssemblyPath}\" \"{Main.boneLibUpdaterAssemblyPath}\" true";
		process.Start();
	}
}
internal enum ExitCode
{
	Success,
	UpToDate,
	Error
}