Decompiled source of BoneLib v2.4.0

Mods/BoneLib.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
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 System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using BoneLib.BoneMenu.UI;
using BoneLib.MonoBehaviours;
using BoneLib.Notifications;
using BoneLib.Nullables;
using BoneLib.RandomShit;
using Cysharp.Threading.Tasks;
using HarmonyLib;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using Newtonsoft.Json;
using PuppetMasta;
using SLZ.AI;
using SLZ.Bonelab;
using SLZ.Combat;
using SLZ.Data;
using SLZ.Interaction;
using SLZ.Marrow.Data;
using SLZ.Marrow.Pool;
using SLZ.Marrow.SceneStreaming;
using SLZ.Marrow.Utilities;
using SLZ.Marrow.Warehouse;
using SLZ.Player;
using SLZ.Props;
using SLZ.Props.Weapons;
using SLZ.Rig;
using SLZ.SFX;
using SLZ.UI;
using SLZ.Utilities;
using SLZ.VRMK;
using SLZ.Zones;
using TMPro;
using UnhollowerBaseLib;
using UnhollowerBaseLib.Attributes;
using UnhollowerRuntimeLib;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BoneLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("BoneLib")]
[assembly: AssemblyCopyright("Created by Gnonme")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("2.4.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "BoneLib", "2.4.0", "Gnonme", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonPriority(-1000000)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.0.0")]
[module: UnverifiableCode]
internal enum LoggingMode
{
	NORMAL,
	DEBUG
}
namespace System.Runtime.CompilerServices
{
	public class IsUnmanagedAttribute
	{
	}
}
namespace BoneLib
{
	public static class Audio
	{
		private static bool HasFoundMixers => (Object)(object)MusicMixer != (Object)null && (Object)(object)SFXMixer != (Object)null && (Object)(object)GunshotMixer != (Object)null && (Object)(object)MasterMixer != (Object)null;

		public static AudioMixerGroup MasterMixer { get; private set; }

		public static AudioMixerGroup MusicMixer { get; private set; }

		public static AudioMixerGroup SFXMixer { get; private set; }

		public static AudioMixerGroup GunshotMixer { get; private set; }

		internal static void GetAudioMixers()
		{
			if (!HasFoundMixers)
			{
				AudioMixerGroup[] source = Il2CppArrayBase<AudioMixerGroup>.op_Implicit(Resources.FindObjectsOfTypeAll<AudioMixerGroup>());
				MasterMixer = ((IEnumerable<AudioMixerGroup>)source).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name == "Master"));
				MusicMixer = ((IEnumerable<AudioMixerGroup>)source).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name == "Music"));
				SFXMixer = ((IEnumerable<AudioMixerGroup>)source).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name == "SFX"));
				GunshotMixer = ((IEnumerable<AudioMixerGroup>)source).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name == "GunShot"));
			}
		}
	}
	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 enum GameLayers
	{
		DEFAULT = 1,
		TRANSPARENT_FX = 2,
		IGNORE_RAYCAST = 4,
		WATER = 16,
		UI = 32,
		PLAYER = 256,
		NO_COLLIDE = 512,
		DYNAMIC = 1024,
		STEREO_RENDER_IGNORE = 2048,
		ENEMY_COLLIDERS = 4096,
		STATIC = 8192,
		SPAWNGUN_UI = 16384,
		INTERACTABLE = 32768,
		HAND = 65536,
		HAND_ONLY = 131072,
		SOCKET = 262144,
		PLUG = 524288,
		INTERACTABLE_ONLY = 1048576,
		PLAYER_AND_NPC = 2097152,
		NO_SELF_COLLIDE = 4194304,
		FEET_ONLY = 8388608,
		FEET = 16777216,
		NO_FOOTBALL = 33554432,
		TRACKER = 67108864,
		TRIGGER = 134217728,
		BACKGROUND = int.MinValue
	}
	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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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 static class HelperMethods
	{
		private static readonly bool isAndroid = (int)MelonUtils.CurrentPlatform == 3;

		public static string GetCleanObjectName(string name)
		{
			Regex regex = new Regex("\\[\\d+\\]|\\(\\d+\\)");
			name = regex.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, Vector3 scale, bool ignorePolicy, Action<GameObject> spawnAction)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			SpawnableCrateReference crateRef = new SpawnableCrateReference(barcode);
			Spawnable val = new Spawnable
			{
				crateRef = crateRef
			};
			AssetSpawner.Register(val);
			AssetSpawner.Spawn(val, position, rotation, (Nullable<Vector3>)new BoxedNullable<Vector3>(scale), ignorePolicy, (Nullable<int>)new BoxedNullable<int>(null), Action<GameObject>.op_Implicit(spawnAction), (Action<GameObject>)null);
		}

		public static void SpawnCrate(SpawnableCrateReference crateReference, Vector3 position, Quaternion rotation, Vector3 scale, bool ignorePolicy, Action<GameObject> spawnAction)
		{
			//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_000f: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Spawnable val = new Spawnable
			{
				crateRef = crateReference
			};
			AssetSpawner.Register(val);
			AssetSpawner.Spawn(val, position, rotation, (Nullable<Vector3>)new BoxedNullable<Vector3>(scale), ignorePolicy, (Nullable<int>)new BoxedNullable<int>(null), Action<GameObject>.op_Implicit(spawnAction), (Action<GameObject>)null);
		}

		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)
		{
			return AppDomain.CurrentDomain.GetAssemblies().Any((Assembly asm) => asm.GetName().Name.ToLower().Contains(name.ToLower()));
		}
	}
	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<LevelInfo> OnLevelLoading;

		public static event Action<LevelInfo> OnLevelInitialized;

		public static event Action OnLevelUnloaded;

		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);
			}));
			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("Awake", AccessTools.all), typeof(Hooking).GetMethod("OnRigManagerAwake", AccessTools.all));
			CreateHook(typeof(RigManager).GetMethod("OnDestroy", AccessTools.all), typeof(Hooking).GetMethod("OnRigManagerDestroyed", 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));
			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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			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));
			Harmony val2 = ((val != null) ? ((MelonBase)val).HarmonyInstance : baseHarmony);
			HarmonyMethod val3 = ((!isPrefix) ? ((HarmonyMethod)null) : new HarmonyMethod(hook));
			HarmonyMethod val4 = (isPrefix ? ((HarmonyMethod)null) : new HarmonyMethod(hook));
			val2.Patch((MethodBase)original, val3, val4, (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 OnRigManagerAwake(RigManager __instance)
		{
			if (!Player.handsExist && Player.FindObjectReferences(__instance))
			{
				SafeActions.InvokeActionSafe(Hooking.OnLevelInitialized, new LevelInfo(SceneStreamer.Session.Level));
			}
		}

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

		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 = Barcode.op_Implicit(((CrateReference)levelReference).Barcode);
			this.levelReference = levelReference;
		}

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

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

		public const string Author = "Gnonme";

		public const string Company = null;

		public const string Version = "2.4.0";

		public const string DownloadLink = null;
	}
	internal class Main : MelonMod
	{
		public override void OnInitializeMelon()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			ModConsole.Setup(((MelonBase)this).LoggerInstance);
			Preferences.Setup();
			Hooking.SetHarmony(((MelonBase)this).HarmonyInstance);
			Hooking.InitHooks();
			MenuManager.SetRoot(new MenuCategory("BoneMenu", Color.white));
			DefaultMenu.CreateDefaultElements();
			NotifAssets.SetupBundles();
			DataManager.Bundles.Init();
			DataManager.UI.AddComponents();
			Hooking.OnLevelInitialized += OnLevelInitialized;
			ClassInjector.RegisterTypeInIl2Cpp<PopupBox>();
			ModConsole.Msg("BoneLib loaded");
		}

		public override void OnUpdate()
		{
			Notifier.OnUpdate();
		}

		private void OnLevelInitialized(LevelInfo info)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			DataManager.Player.FindReferences();
			PopupBoxManager.CreateBaseAd();
			Audio.GetAudioMixers();
			if (info.title == "00 - Main Menu" || info.title == "15 - Void G114")
			{
				SkipIntro();
			}
			DataManager.UI.InitializeReferences();
			new GameObject("[BoneMenu] - UI Manager").AddComponent<UIManager>();
		}

		private void SkipIntro()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if ((bool)Preferences.skipIntro)
			{
				GameObject val = GameObject.Find("CANVAS_UX");
				GameObject gameObject = ((Component)val.transform.Find("SLZ_ROOT")).gameObject;
				GameObject gameObject2 = ((Component)val.transform.Find("CREDITS_ROOT")).gameObject;
				GameObject gameObject3 = ((Component)val.transform.Find("BONELAB_ANIM")).gameObject;
				Object.Destroy((Object)(object)gameObject);
				Object.Destroy((Object)(object)gameObject2);
				gameObject3.transform.localPosition = Vector3.up * 0.375f;
				gameObject3.transform.localScale = Vector3.one * 0.5f;
				GameObject gameObject4 = ((Component)val.transform.Find("REQUIRED")).gameObject;
				gameObject4.SetActiveRecursively(true);
				GameObject gameObject5 = ((Component)val.transform.Find("MENU")).gameObject;
				gameObject5.gameObject.SetActive(true);
				((Component)gameObject5.transform.Find("group_Enter")).gameObject.SetActive(false);
				((Component)gameObject5.transform.Find("group_Options")).gameObject.SetActive(false);
				((Component)gameObject5.transform.Find("group_Mods")).gameObject.SetActive(false);
				((Component)gameObject5.transform.Find("group_Info")).gameObject.SetActive(false);
				((Component)gameObject5.transform.Find("group_BETA")).gameObject.SetActive(false);
				GameControl_MenuVoidG114 val2 = Object.FindObjectOfType<GameControl_MenuVoidG114>();
				if ((Object)(object)val2 != (Object)null)
				{
					val2.holdTime = 0f;
					val2.holdTime_SLZ = 0f;
					val2.holdTime_Credits = 0f;
					val2.holdTime_GameTitle = 0f;
					val2.timerHold = 0f;
					val2.holdTime_Rest = 0f;
					val2.canClick = true;
					((Component)val2.fadeVolume).gameObject.SetActive(false);
				}
			}
		}
	}
	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
	{
		private static readonly string playerHeadPath = "[PhysicsRig]/Head";

		public static RigManager rigManager { get; private set; }

		public static PhysicsRig physicsRig { get; private set; }

		public static ControllerRig 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 => (Object)(object)leftHand != (Object)null && (Object)(object)rightHand != (Object)null;

		public static BaseController leftController { get; private set; }

		public static BaseController rightController { get; private set; }

		public static bool controllersExist => (Object)(object)leftController != (Object)null && (Object)(object)rightController != (Object)null;

		public static Transform playerHead { get; private set; }

		internal static bool FindObjectReferences(RigManager manager = null)
		{
			ModConsole.Msg("Finding player object references", LoggingMode.DEBUG);
			if (controllersExist && handsExist && (Object)(object)controllerRig != (Object)null)
			{
				return false;
			}
			if ((Object)(object)manager == (Object)null)
			{
				manager = Object.FindObjectOfType<RigManager>();
			}
			rigManager = manager;
			physicsRig = ((manager != null) ? manager.physicsRig : null);
			controllerRig = ((manager != null) ? manager.ControllerRig : null);
			remapRig = ((manager != null) ? manager.remapHeptaRig : null);
			uiRig = ((manager != null) ? manager.uiRig : null);
			object obj;
			if (manager == null)
			{
				obj = null;
			}
			else
			{
				ControllerRig obj2 = manager.ControllerRig;
				obj = ((obj2 != null) ? obj2.leftController : null);
			}
			leftController = (BaseController)obj;
			object obj3;
			if (manager == null)
			{
				obj3 = null;
			}
			else
			{
				ControllerRig obj4 = manager.ControllerRig;
				obj3 = ((obj4 != null) ? obj4.rightController : null);
			}
			rightController = (BaseController)obj3;
			object obj5;
			if (manager == null)
			{
				obj5 = null;
			}
			else
			{
				PhysicsRig obj6 = manager.physicsRig;
				obj5 = ((obj6 != null) ? obj6.leftHand : null);
			}
			leftHand = (Hand)obj5;
			object obj7;
			if (manager == null)
			{
				obj7 = null;
			}
			else
			{
				PhysicsRig obj8 = manager.physicsRig;
				obj7 = ((obj8 != null) ? obj8.rightHand : null);
			}
			rightHand = (Hand)obj7;
			playerHead = ((Component)rigManager).transform.Find(playerHeadPath);
			ModConsole.Msg("Found player object references", LoggingMode.DEBUG);
			return controllersExist && handsExist && (Object)(object)controllerRig != (Object)null;
		}

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

		public static Avatar GetCurrentAvatar()
		{
			return rigManager.avatar;
		}

		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 Gun GetGunInHand(Hand hand)
		{
			return Player.GetComponentInHand<Gun>(hand);
		}

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

		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 action2 = (Action)@delegate;
					action2();
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod val = ((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)val).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> action2 = (Action<T>)@delegate;
					action2(param);
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod val = ((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)val).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> action2 = (Action<T1, T2>)@delegate;
					action2(param1, param2);
				}
				catch (Exception ex)
				{
					string asm = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					MelonMod val = ((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)val).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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			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 = ((Component)Player.playerHead).transform.position + ((Component)Player.playerHead).transform.forward * 2f;
			val.transform.rotation = Quaternion.LookRotation(val.transform.position - ((Component)Player.playerHead).transform.position);
			return val;
		}

		public static GameObject CreateNewImagePopup(byte[] imageBytes)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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 = ((Component)Player.playerHead).transform.position + ((Component)Player.playerHead).transform.forward * 2f;
			val2.transform.rotation = Quaternion.LookRotation(val2.transform.position - ((Component)Player.playerHead).transform.position);
			return val2;
		}

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

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

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

		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;
			}
			Result result = urlReq.result;
			Result val = result;
			if ((int)val != 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 jsonUrls = urlReq.downloadHandler.text;
			string imageUrl = JsonConvert.DeserializeObject<string[]>(jsonUrls)[0];
			UnityWebRequest imageReq = UnityWebRequest.Get(imageUrl);
			imageReq.BeginWebRequest();
			while ((int)imageReq.result == 0)
			{
				ModConsole.Msg($"Image request progress={urlReq.downloadProgress}", LoggingMode.DEBUG);
				yield return null;
			}
			Result result2 = imageReq.result;
			Result val2 = result2;
			if ((int)val2 != 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 createdPopup = CreateNewImagePopup(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)imageReq.downloadHandler.data));
			callback?.Invoke(createdPopup);
		}

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

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

		internal static void CreateBaseAd()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: 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_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: 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)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Expected O, but got Unknown
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: 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>());
			HandPose[] array4 = array3;
			foreach (HandPose val2 in array4)
			{
				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 val3 = basePopup.AddComponent<Rigidbody>();
			val3.mass = 8f;
			val3.drag = 0.15f;
			val3.angularDrag = 0.15f;
			ImpactProperties val4 = basePopup.AddComponent<ImpactProperties>();
			((ImpactPropertiesVariables)val4).material = (Material)2;
			((ImpactPropertiesVariables)val4).modelType = (ModelType)2;
			((ImpactPropertiesVariables)val4).MainColor = Color.white;
			((ImpactPropertiesVariables)val4).SecondaryColor = Color.white;
			((ImpactPropertiesVariables)val4).PenetrationResistance = 0.9f;
			((ImpactPropertiesVariables)val4).megaPascalModifier = 1f;
			((ImpactPropertiesVariables)val4).FireResistance = 100f;
			ImpactSFX val5 = basePopup.AddComponent<ImpactSFX>();
			val5.impactSoft = Il2CppReferenceArray<AudioClip>.op_Implicit(list.ToArray());
			val5.impactHard = Il2CppReferenceArray<AudioClip>.op_Implicit(list.ToArray());
			val5.pitchMod = 1f;
			val5.bluntDamageMult = 1f;
			val5.minVelocity = 0.4f;
			val5.velocityClipSplit = 4f;
			val5.jointBreakVolume = 1f;
			InteractableHost val6 = basePopup.AddComponent<InteractableHost>();
			val6.HasRigidbody = true;
			GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val7).name = "Mesh";
			val7.transform.parent = basePopup.transform;
			val7.transform.localPosition = Vector3.zero;
			val7.transform.localScale = new Vector3(2f, 1f, 0.02f);
			((Renderer)val7.GetComponent<MeshRenderer>()).material.shader = Shader.Find("Universal Render Pipeline/Lit (PBR Workflow)");
			((Renderer)val7.GetComponent<MeshRenderer>()).material.color = new Color(0.1509434f, 0.1509434f, 0.1509434f);
			GameObject val8 = new GameObject("Grip");
			val8.transform.parent = basePopup.transform;
			val8.layer = LayerMask.NameToLayer("Interactable");
			BoxCollider val9 = val8.AddComponent<BoxCollider>();
			val9.size = val7.transform.localScale;
			((Collider)val7.GetComponent<BoxCollider>()).enabled = false;
			BoxGrip val10 = val8.AddComponent<BoxGrip>();
			((Grip)val10).isThrowable = true;
			((Grip)val10).handleAmplifyCurve = new AnimationCurve(Il2CppStructArray<Keyframe>.op_Implicit((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(-180f, 0f),
				new Keyframe(180f, 0f)
			}));
			((Grip)val10).gripOptions = (InteractionOptions)1;
			((Grip)val10).priority = 1f;
			((Grip)val10).minBreakForce = float.PositiveInfinity;
			((Grip)val10).maxBreakForce = float.PositiveInfinity;
			((Grip)val10).defaultGripDistance = float.PositiveInfinity;
			((Grip)val10).gripDistanceSqr = float.PositiveInfinity;
			((TargetGrip)val10).rotationLimit = 180f;
			((TargetGrip)val10).rotationPriorityBuffer = 20f;
			val10.sandwichSize = 0.12f;
			val10.edgePadding = 0.1f;
			val10.sandwichHandPose = sandwichHandPose;
			val10.canBeSandwichedGrabbed = true;
			val10.edgeHandPose = edgeHandPose;
			val10.edgeHandPoseRadius = 0.05f;
			val10.canBeEdgeGrabbed = true;
			val10.cornerHandPose = cornerHandPose;
			val10.cornerHandPoseRadius = 0.05f;
			val10.canBeCornerGrabbed = true;
			val10.faceHandPose = faceHandPose;
			val10.faceHandPoseRadius = 1f;
			val10.canBeFaceGrabbed = true;
			val10.enabledCorners = (Corners)(-1);
			val10.enabledEdges = (Edges)(-1);
			val10.enabledFaces = (Faces)(-1);
			val10._boxCollider = val9;
			ObjectDestructable val11 = basePopup.AddComponent<ObjectDestructable>();
			val11.damageFromImpact = true;
			val11.blasterScale = Vector3.one * 3f;
			val11.maxHealth = 30f;
			val11.reqHitCount = 1;
			val11.perBloodied = 0.1f;
			val11.explosiveForceOnDestruct = 1f;
			val11.damageFromAttack = true;
			val11.attackMod = 2f;
			val11.modTypeDamage = 2f;
			val11.modImpact = 1f;
			val11.thrImpact = 3f;
			val11.feetDamageMult = 0.1f;
			val11._impactSfx = val5;
			GameObject val12 = new GameObject("Text");
			val12.transform.parent = basePopup.transform;
			TextMeshPro val13 = val12.AddComponent<TextMeshPro>();
			((TMP_Text)val13).enableAutoSizing = true;
			((TMP_Text)val13).fontSizeMin = 0.5f;
			((TMP_Text)val13).fontSizeMax = 4f;
			((TMP_Text)val13).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val13).enableWordWrapping = true;
			RectTransform component = val12.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(2f, 1f);
			((Transform)component).localPosition = new Vector3(0f, 0f, -0.015f);
		}
	}
}
namespace BoneLib.Nullables
{
	public static class NullableMethodExtensions
	{
		public static void Attenuate(this AudioPlayer inst, float? volume = null, float? pitch = null, float? minDistance = null)
		{
			inst.Attenuate((Nullable<float>)new BoxedNullable<float>(volume), (Nullable<float>)new BoxedNullable<float>(pitch), (Nullable<float>)new BoxedNullable<float>(minDistance));
		}

		public static void Play(this AudioPlayer inst, AudioClip clip, AudioMixerGroup mixerGroup = null, float? volume = null, bool? isLooping = null, float? pitch = null, float? minDistance = null)
		{
			inst.Play(clip, mixerGroup, (Nullable<float>)new BoxedNullable<float>(volume), (Nullable<bool>)new BoxedNullable<bool>(isLooping), (Nullable<float>)new BoxedNullable<float>(pitch), (Nullable<float>)new BoxedNullable<float>(minDistance), (Nullable<float>)null);
		}

		public static void Play(this AudioPlayer inst, AudioClip[] clips, AudioMixerGroup mixerGroup = null, float? volume = null, bool? isLooping = null, float? pitch = null, float? minDistance = null)
		{
			Il2CppReferenceArray<AudioClip> val = new Il2CppReferenceArray<AudioClip>(clips);
			inst.Play(val, mixerGroup, (Nullable<float>)new BoxedNullable<float>(volume), (Nullable<bool>)new BoxedNullable<bool>(isLooping), (Nullable<float>)new BoxedNullable<float>(pitch), (Nullable<float>)new BoxedNullable<float>(minDistance), (Nullable<float>)null);
		}

		public static void AudioPlayer_PlayAtPoint(AudioClip clip, Vector3 position, AudioMixerGroup mixerGroup = null, float? volume = null, bool? isLooping = null, float? pitch = null, float? minDistance = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			AudioPlayer.PlayAtPoint(clip, position, mixerGroup, (Nullable<float>)new BoxedNullable<float>(volume), (Nullable<bool>)new BoxedNullable<bool>(isLooping), (Nullable<float>)new BoxedNullable<float>(pitch), (Nullable<float>)new BoxedNullable<float>(minDistance));
		}

		public static void AudioPlayer_PlayAtPoint(AudioClip[] clips, Vector3 position, AudioMixerGroup mixerGroup = null, float? volume = null, bool? isLooping = null, float? pitch = null, float? minDistance = null)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Il2CppReferenceArray<AudioClip> val = new Il2CppReferenceArray<AudioClip>(clips);
			AudioPlayer.PlayAtPoint(val, position, mixerGroup, (Nullable<float>)new BoxedNullable<float>(volume), (Nullable<bool>)new BoxedNullable<bool>(isLooping), (Nullable<float>)new BoxedNullable<float>(pitch), (Nullable<float>)new BoxedNullable<float>(minDistance));
		}

		public static void SetTrigger(this AITrigger inst, float? radius = null, float? fov = null, TriggerTypes? type = null)
		{
			inst.SetTrigger((Nullable<float>)new BoxedNullable<float>(radius), (Nullable<float>)new BoxedNullable<float>(fov), (Nullable<TriggerTypes>)new BoxedNullable<TriggerTypes>(type));
		}

		public static UniTask<AssetPoolee> Spawn(this AssetPool inst, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion), Vector3? scale = null, bool? autoEnable = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return inst.Spawn(position, rotation, (Nullable<Vector3>)new BoxedNullable<Vector3>(scale), (Nullable<bool>)new BoxedNullable<bool>(autoEnable));
		}

		public static UniTask<AssetPoolee> PoolManager_SpawnAsync(Spawnable spawnable, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion), Vector3? scale = null, bool ignorePolicy = false, int? groupID = null, Action<GameObject> spawnCallback = null, Action<GameObject> despawnCallback = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return AssetSpawner.SpawnAsync(spawnable, position, rotation, (Nullable<Vector3>)new BoxedNullable<Vector3>(scale), ignorePolicy, (Nullable<int>)new BoxedNullable<int>(groupID), spawnCallback, despawnCallback);
		}

		public static void PoolManager_Spawn(Spawnable spawnable, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion), Vector3? scale = null, bool ignorePolicy = false, int? groupID = null, Action<GameObject> spawnCallback = null, Action<GameObject> despawnCallback = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			AssetSpawner.Spawn(spawnable, position, rotation, (Nullable<Vector3>)new BoxedNullable<Vector3>(scale), ignorePolicy, (Nullable<int>)new BoxedNullable<int>(groupID), spawnCallback, despawnCallback);
		}

		public static void SetRigidbody(this SpawnFragment inst, int idx, Vector3? velocity = null, Vector3? angularVelocity = null, float? mass = null, Vector3? worldCenter = null, float? explosiveForce = null)
		{
			inst.SetRigidbody(idx, (Nullable<Vector3>)new BoxedNullable<Vector3>(velocity), (Nullable<Vector3>)new BoxedNullable<Vector3>(angularVelocity), (Nullable<float>)new BoxedNullable<float>(mass), (Nullable<Vector3>)new BoxedNullable<Vector3>(worldCenter), (Nullable<float>)new BoxedNullable<float>(explosiveForce));
		}

		public static void Despawn(this ZoneTracker inst, bool? playVFX = null)
		{
			inst.Despawn((Nullable<bool>)new BoxedNullable<bool>(playVFX));
		}
	}
	public class BoxedNullable<T> : ValueType where T : unmanaged
	{
		private static readonly IntPtr classPtr;

		private static readonly IntPtr TClassPtr;

		private static readonly int valueSize;

		private static readonly int marshalSize;

		private static readonly int hasValueOffset;

		public IntPtr ValuePtr => IL2CPP.il2cpp_object_unbox(((Il2CppObjectBase)this).Pointer);

		public unsafe bool HasValue
		{
			get
			{
				return *(byte*)(void*)(((Il2CppObjectBase)this).Pointer + hasValueOffset) != 0;
			}
			set
			{
				*(sbyte*)(void*)(((Il2CppObjectBase)this).Pointer + hasValueOffset) = (sbyte)(value ? 1 : 0);
			}
		}

		public unsafe T Value
		{
			get
			{
				if (marshalSize == valueSize)
				{
					return *(T*)(void*)ValuePtr;
				}
				if (valueSize == 1 && marshalSize > 0)
				{
					T result = default(T);
					*(sbyte*)(&result) = *(sbyte*)(void*)ValuePtr;
					return result;
				}
				throw new InvalidOperationException("Interop done goof?");
			}
			set
			{
				if (marshalSize == valueSize)
				{
					*(T*)(void*)ValuePtr = value;
					return;
				}
				if (valueSize == 1 && marshalSize > 0)
				{
					*(sbyte*)(void*)ValuePtr = *(sbyte*)(&value);
					return;
				}
				throw new InvalidOperationException("Interop done goof?");
			}
		}

		static BoxedNullable()
		{
			classPtr = Il2CppClassPointerStore<Nullable<T>>.NativeClassPtr;
			TClassPtr = Il2CppClassPointerStore<T>.NativeClassPtr;
			uint num = 0u;
			hasValueOffset = (int)IL2CPP.il2cpp_field_get_offset(IL2CPP.GetIl2CppField(classPtr, "hasValue"));
			valueSize = IL2CPP.il2cpp_class_value_size(TClassPtr, ref num);
			marshalSize = Marshal.SizeOf(typeof(T));
		}

		public BoxedNullable(T? nullable)
		{
			IntPtr intPtr = IL2CPP.il2cpp_object_new(classPtr);
			uint num = (RuntimeSpecificsStore.ShouldUseWeakRefs(classPtr) ? IL2CPP.il2cpp_gchandle_new_weakref(intPtr, false) : IL2CPP.il2cpp_gchandle_new(intPtr, false));
			AccessTools.Field(typeof(Il2CppObjectBase), "myGcHandle").SetValue(this, num);
			if (nullable.HasValue)
			{
				Value = nullable.Value;
				HasValue = true;
			}
			else
			{
				Value = default(T);
				HasValue = false;
			}
		}

		public unsafe BoxedNullable(T value)
		{
			IntPtr intPtr = IL2CPP.il2cpp_object_new(classPtr);
			IntPtr intPtr2 = IL2CPP.il2cpp_object_unbox(intPtr);
			if (value is bool)
			{
				object obj = value;
				bool flag = (bool)((obj is bool) ? obj : null);
				if (true)
				{
					Set(intPtr2, (byte)(flag ? 1 : 0));
					goto IL_005e;
				}
			}
			Set(intPtr2, value);
			goto IL_005e;
			IL_005e:
			*(sbyte*)(void*)(intPtr2 + hasValueOffset) = 1;
			uint num = (RuntimeSpecificsStore.ShouldUseWeakRefs(classPtr) ? IL2CPP.il2cpp_gchandle_new_weakref(intPtr, false) : IL2CPP.il2cpp_gchandle_new(intPtr, false));
			AccessTools.Field(typeof(Il2CppObjectBase), "myGcHandle").SetValue(this, num);
		}

		private unsafe static void Set<U>(IntPtr tgt, U value) where U : unmanaged
		{
			*(U*)(void*)tgt = value;
		}

		public static implicit operator Nullable<T>(BoxedNullable<T> me)
		{
			return new Nullable<T>(((Il2CppObjectBase)me).Pointer);
		}
	}
}
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_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)
			if (!richText)
			{
				Regex regex = new Regex("<[^>]*>");
				text = 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 = false;

		public float PopupLength = 2f;

		public NotificationType Type = NotificationType.Information;

		public Texture2D CustomIcon = null;
	}
	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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Notification notification = QueuedNotifications.Dequeue();
			RigManager rigManager = Player.rigManager;
			if ((Object)(object)rigManager != (Object)null)
			{
				TutorialRig tutorialRig = rigManager.tutorialRig;
				HeadTitles headTitles = tutorialRig.headTitles;
				EnableTutorialRig();
				string text = "New Notification";
				if (notification.ShowTitleOnPopup)
				{
					text = notification.Title.Text;
				}
				string text2 = notification.Message.Text;
				NotificationType type = notification.Type;
				if (1 == 0)
				{
				}
				Texture2D val = (Texture2D)(type switch
				{
					NotificationType.Warning => NotifAssets.Warning, 
					NotificationType.Error => NotifAssets.Error, 
					NotificationType.Success => NotifAssets.Success, 
					NotificationType.Information => NotifAssets.Information, 
					NotificationType.CustomIcon => notification.CustomIcon, 
					_ => NotifAssets.Information, 
				});
				if (1 == 0)
				{
				}
				Texture2D val2 = val;
				Sprite val3 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
				float popupLength = notification.PopupLength;
				headTitles.CUSTOMDISPLAY(text, text2, val3, popupLength, (AudioClip)null, false, (Sprite)null, (Sprite)null, (Sprite)null, (Sprite)null);
				headTitles.sr_element.sprite = val3;
			}
		}

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

		private static bool IsPlayingNotification()
		{
			RigManager rigManager = Player.rigManager;
			if ((Object)(object)rigManager != (Object)null)
			{
				TutorialRig tutorialRig = rigManager.tutorialRig;
				HeadTitles headTitles = tutorialRig.headTitles;
				return ((Component)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 tmpro;

		private float timeToLerp = 5f;

		private float timeForNextColor = 0f;

		private int curColorIndex = 0;

		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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)


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

		private void Update()
		{
			//IL_006d: 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_00a0: 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;
			}
			((TMP_Text)tmpro).color = Color.Lerp(colors[curColorIndex], colors[nextColorIndex], Mathf.InverseLerp(timeForNextColor - timeToLerp, timeForNextColor, Time.time));
		}
	}
}
namespace BoneLib.BoneMenu
{
	internal static class DataManager
	{
		public static class Bundles
		{
			private static AssetBundle _bundle;

			private static List<GameObject> _bundleObjects;

			public static AssetBundle bundle => _bundle;

			public static IReadOnlyList<GameObject> BundleObjects => _bundleObjects.AsReadOnly();

			public static void Init()
			{
				_bundleObjects = new List<GameObject>();
				_bundle = GetEmbeddedBundle();
				((Object)_bundle).hideFlags = (HideFlags)32;
				Il2CppReferenceArray<Object> val = bundle.LoadAllAssets();
				foreach (Object item in (Il2CppArrayBase<Object>)(object)val)
				{
					if ((Object)(object)((Il2CppObjectBase)item).TryCast<GameObject>() != (Object)null)
					{
						GameObject val2 = ((Il2CppObjectBase)item).Cast<GameObject>();
						((Object)val2).hideFlags = (HideFlags)32;
						val2.AddComponent<ButtonHoverClick>();
						val2.AddComponent<GlassHandler>();
						_bundleObjects.Add(val2);
					}
				}
			}

			public static GameObject FindBundleObject(string name)
			{
				return _bundleObjects.Find((GameObject x) => ((Object)x).name == name);
			}

			private static AssetBundle GetEmbeddedBundle()
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				string text = (HelperMethods.IsAndroid() ? "bonemenu.android.pack" : "bonemenu.pack");
				using Stream stream = executingAssembly.GetManifestResourceStream("BoneLib.Resources." + text);
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				return AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(memoryStream.ToArray()));
			}
		}

		public static class Player
		{
			internal static RigManager _rigManager;

			internal static UIRig _uiRig;

			public static RigManager RigManager
			{
				get
				{
					if (_rigManager == null || ((Il2CppObjectBase)_rigManager).WasCollected)
					{
						return null;
					}
					return _rigManager;
				}
			}

			public static UIRig UIRig
			{
				get
				{
					if (_rigManager == null || ((Il2CppObjectBase)_rigManager).WasCollected)
					{
						return null;
					}
					return _uiRig;
				}
			}

			internal static void FindReferences()
			{
				_rigManager = ((Component)BoneLib.Player.rigManager).GetComponent<RigManager>();
				_uiRig = _rigManager.uiRig;
			}
		}

		public static class UI
		{
			public static PreferencesPanelView panelView;

			public static GameObject optionsPanel;

			public static GameObject pagePrefab = Bundles.FindBundleObject("Element_Page");

			public static GameObject categoryPrefab = Bundles.FindBundleObject("Element_Category");

			public static GameObject functionPrefab = Bundles.FindBundleObject("Element_Function");

			public static GameObject valuePrefab = Bundles.FindBundleObject("Element_Value");

			public static GameObject valueListPrefab = Bundles.FindBundleObject("Element_ValueList");

			public static GameObject togglePrefab = Bundles.FindBundleObject("Element_Toggle");

			public static GameObject subPanelPrefab = Bundles.FindBundleObject("Element_SubPanel");

			public static GameObject emptyPrefab = Bundles.FindBundleObject("Element_Empty");

			public static GameObject bmButtonObject = Bundles.FindBundleObject("BoneMenuButton");

			private static GameObject _optionButton;

			private static Transform _optionsGrid;

			private static Button _optionButtonComponent;

			public static Transform OptionsGrid
			{
				get
				{
					if (_optionsGrid == null || ((Il2CppObjectBase)_optionsGrid).WasCollected)
					{
						return null;
					}
					return _optionsGrid;
				}
			}

			public static void Init()
			{
				_optionButton = SetupElement(bmButtonObject, OptionsGrid, startActive: true);
				ModifyBaseUI();
			}

			public static void InitializeReferences()
			{
				Player._rigManager = ((Component)BoneLib.Player.rigManager).GetComponent<RigManager>();
				Player._uiRig = Player.RigManager.uiRig;
				panelView = Player.UIRig.popUpMenu.preferencesPanelView;
				optionsPanel = ((Il2CppArrayBase<GameObject>)(object)panelView.pages)[panelView.defaultPage];
				_optionsGrid = optionsPanel.transform.Find("grid_Options");
			}

			public static void AddComponents()
			{
				pagePrefab.GetComponent<UIPage>();
				categoryPrefab.GetComponent<UICategoryField>();
				functionPrefab.GetComponent<UIFunctionField>();
				valuePrefab.GetComponent<UIValueField>();
			}

			private static void ModifyBaseUI()
			{
				Action action = delegate
				{
					panelView.PAGESELECT(11);
					MenuManager.SelectCategory(MenuManager.RootCategory);
				};
				_optionButtonComponent = _optionButton.GetComponent<Button>();
				((UnityEvent)_optionButtonComponent.onClick).AddListener(UnityAction.op_Implicit(action));
				InjectPage();
			}

			private static void InjectPage()
			{
				Il2CppReferenceArray<GameObject> val = new Il2CppReferenceArray<GameObject>(12L);
				for (int i = 0; i <= 10; i++)
				{
					((Il2CppArrayBase<GameObject>)(object)val)[i] = ((Il2CppArrayBase<GameObject>)(object)panelView.pages)[i];
				}
				((Il2CppArrayBase<GameObject>)(object)val)[11] = ((Component)UIManager.Instance.MainPage).gameObject;
				panelView.pages = val;
			}

			private static GameObject SetupElement(GameObject objectToCreate, Transform parent, bool startActive)
			{
				GameObject val = Object.Instantiate<GameObject>(objectToCreate, parent);
				val.SetActive(startActive);
				val.transform.SetSiblingIndex(5);
				return val;
			}
		}
	}
	internal static class DefaultMenu
	{
		private static int lightAmmoValue = 100;

		private static int mediumAmmoValue = 100;

		private static int heavyAmmoValue = 100;

		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_0006: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory menuCategory = MenuManager.CreateCategory("BoneLib", Color.white);
			SubPanelElement subPanelElement = menuCategory.CreateSubPanel("Ammo Settings", Color.yellow);
			SubPanelElement subPanelElement2 = menuCategory.CreateSubPanel("Item Spawning", Color.white);
			SubPanelElement subPanelElement3 = menuCategory.CreateSubPanel("Fun Stuff", "#e600ff");
			subPanelElement.CreateFunctionElement("Add Light Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(LightAmmo, lightAmmoValue);
			});
			subPanelElement.CreateFunctionElement("Add Medium Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(MediumAmmo, mediumAmmoValue);
			});
			subPanelElement.CreateFunctionElement("Add Heavy Ammo", Color.white, delegate
			{
				AmmoInventory.AddCartridge(HeavyAmmo, heavyAmmoValue);
			});
			subPanelElement.CreateIntElement("Light Ammo", "#ffe11c", lightAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				lightAmmoValue = value;
			});
			subPanelElement.CreateIntElement("Medium Ammo", "#ff9d1c", mediumAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				mediumAmmoValue = value;
			});
			subPanelElement.CreateIntElement("Heavy Ammo", "#ff2f1c", heavyAmmoValue, 100, 0, int.MaxValue, delegate(int value)
			{
				heavyAmmoValue = value;
			});
			subPanelElement2.CreateFunctionElement("Spawn Utility Gun", Color.white, SpawnUtilityGun);
			subPanelElement2.CreateFunctionElement("Spawn Nimbus Gun", Color.white, SpawnNimbusGun);
			subPanelElement2.CreateFunctionElement("Spawn Random Gun", Color.white, SpawnRandomGun);
			subPanelElement2.CreateFunctionElement("Spawn Random Melee", Color.white, SpawnRandomMelee);
			subPanelElement2.CreateFunctionElement("Spawn Random NPC", Color.white, SpawnRandomNPC);
			subPanelElement2.CreateFunctionElement("Load Random Level", Color.white, LoadRandomLevel);
			subPanelElement3.CreateFunctionElement("Spawn Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewPopupBox();
			});
			subPanelElement3.CreateFunctionElement("Spawn Shibe Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewShibePopup();
			});
			subPanelElement3.CreateFunctionElement("Spawn Bird Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewBirdPopup();
			});
			subPanelElement3.CreateFunctionElement("Spawn Cat Ad", Color.white, delegate
			{
				PopupBoxManager.CreateNewCatPopup();
			});
			subPanelElement3.CreateFunctionElement("Notification Test", Color.white, delegate
			{
				Notification notification = new Notification
				{
					Title = "Hello!",
					Message = "Fuck you!",
					Type = NotificationType.Error,
					ShowTitleOnPopup = true,
					PopupLength = 5f
				};
				Notifier.Send(notification);
			});
		}

		internal static void SpawnUtilityGun()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)Player.playerHead).transform;
			HelperMethods.SpawnCrate("c1534c5a-5747-42a2-bd08-ab3b47616467", transform.position + transform.forward, default(Quaternion), Vector3.one, ignorePolicy: false, null

Plugins/BoneLibUpdater.dll

Decompiled 6 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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[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(MelonHandler.ModsDirectory, "BoneLib.dll");

	public static readonly string boneLibUpdaterAssemblyPath = Path.Combine(MelonHandler.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(MelonUtils.UserDataDirectory, "BoneLibUpdater");

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

	private static bool pluginNeedsUpdating = false;

	public static void UpdateMod()
	{
		Version arg = new Version(0, 0, 0);
		if (File.Exists(Main.boneLibAssemblyPath))
		{
			AssemblyName assemblyName = AssemblyName.GetAssemblyName(Main.boneLibAssemblyPath);
			arg = new Version(assemblyName.Version.Major, assemblyName.Version.Minor, assemblyName.Version.Build);
			Main.Logger.Msg($"BoneLib.dll found in Mods folder. Version: {arg}");
		}
		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 = $"{arg} \"{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
}