Decompiled source of NightbaneHardcore v1.0.3

NightbaneHardcore.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Bloodstone.API;
using Bloody.Core;
using Bloody.Core.API.v1;
using Bloody.Core.GameData.v1;
using Bloody.Core.Methods;
using Bloody.Core.Models.v1;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using NightbaneHardcore;
using ProjectM;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Scripting;
using ProjectM.Shared;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Scenes;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("NightbaneHardcore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("V Rising Hardcore Mode - Wipes your entire progress on death.")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e.190ffc3e8cb34e387b2387062779ed3ab52248ab")]
[assembly: AssemblyProduct("NightbaneHardcore")]
[assembly: AssemblyTitle("NightbaneHardcore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal class Configuration
{
	internal static bool PvPOnBloodmoon { get; private set; }

	internal static bool HigherDropOnBloodmoon { get; private set; }

	internal static int DropRateOnBloodmoon { get; private set; }

	internal static bool AnnounceDeaths { get; private set; }

	internal static bool LockItemDropping { get; private set; }

	internal static bool LastWords { get; private set; }

	internal static bool DiscordDeathlog { get; private set; }

	internal static string DiscordWebhookID { get; private set; }

	internal static string DiscordWebhookToken { get; private set; }

	internal static string DiscordWebhookIDPvP { get; private set; }

	internal static string DiscordWebhookTokenPvP { get; private set; }

	internal static void InitConfig(ConfigFile config)
	{
		PvPOnBloodmoon = config.Bind<bool>("Bloodmoon", "PvPOnBloodmoon", true, "Enable PvP during Bloodmoon.").Value;
		HigherDropOnBloodmoon = config.Bind<bool>("Bloodmoon", "HigherDropOnBloodmoon", true, "Enable higher item drop rates during Bloodmoon.").Value;
		DropRateOnBloodmoon = config.Bind<int>("Bloodmoon", "DropRateOnBloodmoon", 3, "Drop rate during Bloodmoon. (if enabled)").Value;
		AnnounceDeaths = config.Bind<bool>("General", "AnnounceDeaths", true, "Announce player deaths in chat.").Value;
		LockItemDropping = config.Bind<bool>("General", "LockItemDropping", true, "Prevent players from dropping items.").Value;
		LastWords = config.Bind<bool>("General", "LastWords", true, "Add last words of player that just died to the chat announcement.").Value;
		DiscordDeathlog = config.Bind<bool>("Discord", "DiscordDeathlog", false, "Log deaths to a Discord webhook.").Value;
		DiscordWebhookID = config.Bind<string>("Discord", "DiscordWebhookID", "", "Discord webhook ID for PvE death logging.").Value;
		DiscordWebhookToken = config.Bind<string>("Discord", "DiscordWebhookToken", "", "Discord webhook token for PvE death logging.").Value;
		DiscordWebhookIDPvP = config.Bind<string>("Discord", "DiscordWebhookIDPvP", "", "Discord webhook ID for PvP kill logging.").Value;
		DiscordWebhookTokenPvP = config.Bind<string>("Discord", "DiscordWebhookTokenPvP", "", "Discord webhook token for PvP kill logging.").Value;
	}
}
[HarmonyPatch(typeof(ChatMessageSystem), "OnUpdate")]
public static class ChatMessageSystemHook
{
	public static void Prefix(ChatMessageSystem __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		EntityQuery _query_661171423_ = __instance.__query_661171423_0;
		NativeArray<Entity> val = ((EntityQuery)(ref _query_661171423_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				ChatMessageEvent val2 = ECSExtensions.Read<ChatMessageEvent>(current);
				FromCharacter val3 = ECSExtensions.Read<FromCharacter>(current);
				User val4 = ECSExtensions.Read<User>(val3.User);
				if (Hardcore.LastWords.ContainsKey(val4.PlatformId))
				{
					Hardcore.LastWords[val4.PlatformId] = ((FixedString512Bytes)(ref val2.MessageText)).Value;
					string contents = JsonSerializer.Serialize(Hardcore.LastWords, new JsonSerializerOptions
					{
						WriteIndented = true
					});
					File.WriteAllText(Hardcore.LastWordsJson, contents);
				}
				else
				{
					Hardcore.LastWords.Add(val4.PlatformId, ((FixedString512Bytes)(ref val2.MessageText)).Value);
				}
			}
		}
		finally
		{
			val.Dispose();
		}
	}
}
[HarmonyPatch(typeof(KillEventSystem), "OnUpdate")]
public static class DeathEventListenerHook
{
	public static void Prefix(KillEventSystem __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		EntityQuery _query_463356032_ = __instance.__query_463356032_0;
		NativeArray<Entity> val = ((EntityQuery)(ref _query_463356032_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (ECSExtensions.Has<KillEvent>(current) && ECSExtensions.Has<FromCharacter>(current))
				{
					FromCharacter val2 = ECSExtensions.Read<FromCharacter>(current);
					KillEvent val3 = ECSExtensions.Read<KillEvent>(current);
					if (((object)(KillWho)(ref val3.Who)).ToString() == "Self")
					{
						EntityManager entityManager = VWorld.Server.EntityManager;
						((EntityManager)(ref entityManager)).DestroyEntity(current);
						ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, ECSExtensions.Read<User>(val2.User), "<color=red>You can't use unstuck in Hardcore mode!");
					}
				}
			}
		}
		finally
		{
			val.Dispose();
		}
	}
}
[HarmonyPatch(typeof(DropInventoryItemSystem), "OnUpdate")]
public static class DropItemThrowSystemHook
{
	[HarmonyPrefix]
	public static void Prefix(DropInventoryItemSystem __instance)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_003c: 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_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		if (!Configuration.LockItemDropping)
		{
			return;
		}
		EntityQuery _query_1470978867_ = __instance.__query_1470978867_0;
		NativeArray<Entity> val = ((EntityQuery)(ref _query_1470978867_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator = val.GetEnumerator();
			Entity val3 = default(Entity);
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (ECSExtensions.Has<DropInventoryItemEvent>(current))
				{
					DropInventoryItemEvent val2 = ECSExtensions.Read<DropInventoryItemEvent>(current);
					FromCharacter fromCharacter = ECSExtensions.Read<FromCharacter>(current);
					((NetworkIdLookupMap)(ref Hardcore.networkIdSystem._NetworkIdLookupMap)).TryGetValue(val2.Inventory, ref val3);
					if (!ECSExtensions.Has<Attached>(val3))
					{
						Hardcore.HandleDropItemChest(val3, fromCharacter, val2.SlotIndex);
					}
					else
					{
						Hardcore.HandleDropItem(fromCharacter, val2.SlotIndex);
					}
					EntityManager entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).DestroyEntity(current);
				}
			}
		}
		finally
		{
			val.Dispose();
		}
	}
}
[HarmonyPatch(typeof(DropItemSystem), "OnUpdate")]
public static class DropItemSystemHook
{
	[HarmonyPrefix]
	public static void Prefix(DropItemSystem __instance)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: 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_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		if (!Configuration.LockItemDropping)
		{
			return;
		}
		EntityQuery val = __instance.__query_1470978519_2;
		NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		EntityManager entityManager;
		try
		{
			Enumerator<Entity> enumerator = val2.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (ECSExtensions.Has<DropEntireInventoryEvent>(current))
				{
					FromCharacter val3 = ECSExtensions.Read<FromCharacter>(current);
					ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, ECSExtensions.Read<User>(val3.User), "<color=red>You can't drop your inventory in Hardcore Mode!");
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).DestroyEntity(current);
				}
			}
		}
		finally
		{
			val2.Dispose();
		}
		val = __instance.__query_1470978519_0;
		NativeArray<Entity> val4 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator2 = val4.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				Entity current2 = enumerator2.Current;
				if (ECSExtensions.Has<DropItemAtSlotEvent>(current2))
				{
					DropItemAtSlotEvent val5 = ECSExtensions.Read<DropItemAtSlotEvent>(current2);
					FromCharacter fromCharacter = ECSExtensions.Read<FromCharacter>(current2);
					Hardcore.HandleDropItem(fromCharacter, val5.SlotIndex);
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).DestroyEntity(current2);
				}
			}
		}
		finally
		{
			val4.Dispose();
		}
		val = __instance.__query_1470978519_1;
		NativeArray<Entity> val6 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator3 = val6.GetEnumerator();
			while (enumerator3.MoveNext())
			{
				Entity current3 = enumerator3.Current;
				entityManager = VWorld.Server.EntityManager;
				((EntityManager)(ref entityManager)).DestroyEntity(current3);
			}
		}
		finally
		{
			val6.Dispose();
		}
	}
}
[HarmonyPatch(typeof(VampireDownedServerEventSystem), "OnUpdate")]
public static class VampireDownedHook
{
	public static void Prefix(VampireDownedServerEventSystem __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_0029: 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)
		EntityQuery _query_1174204813_ = __instance.__query_1174204813_0;
		NativeArray<Entity> val = ((EntityQuery)(ref _query_1174204813_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		try
		{
			Enumerator<Entity> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				Hardcore.HardcoreDeath(current);
			}
		}
		finally
		{
			val.Dispose();
		}
	}
}
namespace NightbaneHardcore
{
	public static class Hardcore
	{
		[HarmonyPatch]
		internal static class InitializationPatch
		{
			[HarmonyPatch(typeof(SceneSystem), "ShutdownStreamingSupport")]
			[HarmonyPostfix]
			private static void ShutdownStreamingSupportPostfix()
			{
				Initialize();
			}
		}

		[CompilerGenerated]
		private sealed class <DestroyCastleOnDeath>d__22 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Entity userEntity;

			private User <userOwner>5__1;

			private EntityManager <entityManager>5__2;

			private EntityQueryOptions <entityQueryOptions>5__3;

			private EntityQueryDesc <entityQueryDesc>5__4;

			private EntityQuery <query>5__5;

			private NativeArray<Entity> <entities>5__6;

			private List<Entity> <entitiesToDestroy>5__7;

			private int <batchSize>5__8;

			private float <delayBetweenBatches>5__9;

			private Enumerator<Entity> <>s__10;

			private Entity <entity>5__11;

			private UserOwner <ownerUser>5__12;

			private User <owner>5__13;

			private int <i>5__14;

			private int <j>5__15;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DestroyCastleOnDeath>d__22(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<entityQueryDesc>5__4 = null;
				<entitiesToDestroy>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Expected O, but got Unknown
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<userOwner>5__1 = ECSExtensions.Read<User>(userEntity);
					<entityManager>5__2 = VWorld.Server.EntityManager;
					<entityQueryOptions>5__3 = (EntityQueryOptions)195;
					EntityQueryDesc val = new EntityQueryDesc();
					val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
					{
						new ComponentType(Il2CppType.Of<UserOwner>(), (AccessMode)1)
					});
					val.Options = <entityQueryOptions>5__3;
					<entityQueryDesc>5__4 = val;
					<query>5__5 = ((EntityManager)(ref <entityManager>5__2)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { <entityQueryDesc>5__4 });
					<entities>5__6 = ((EntityQuery)(ref <query>5__5)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)3));
					<entitiesToDestroy>5__7 = new List<Entity>();
					<>s__10 = <entities>5__6.GetEnumerator();
					while (<>s__10.MoveNext())
					{
						<entity>5__11 = <>s__10.Current;
						<ownerUser>5__12 = ((EntityManager)(ref <entityManager>5__2)).GetComponentData<UserOwner>(<entity>5__11);
						if (!(<ownerUser>5__12.Owner._Entity == Entity.Null))
						{
							<owner>5__13 = ((EntityManager)(ref <entityManager>5__2)).GetComponentData<User>(<ownerUser>5__12.Owner._Entity);
							if (((FixedString64Bytes)(ref <owner>5__13.CharacterName)).Value == ((FixedString64Bytes)(ref <userOwner>5__1.CharacterName)).Value)
							{
								<entitiesToDestroy>5__7.Add(<entity>5__11);
							}
						}
					}
					<entities>5__6.Dispose();
					<batchSize>5__8 = 20;
					<delayBetweenBatches>5__9 = 0.5f;
					<i>5__14 = 0;
					break;
				}
				case 1:
					<>1__state = -1;
					<i>5__14 += <batchSize>5__8;
					break;
				}
				if (<i>5__14 < <entitiesToDestroy>5__7.Count)
				{
					<j>5__15 = 0;
					while (<j>5__15 < <batchSize>5__8 && <i>5__14 + <j>5__15 < <entitiesToDestroy>5__7.Count)
					{
						DestroyUtility.Destroy(<entityManager>5__2, <entitiesToDestroy>5__7[<i>5__14 + <j>5__15], (DestroyDebugReason)0, (string)null, 0);
						<j>5__15++;
					}
					<>2__current = (object)new WaitForSeconds(<delayBetweenBatches>5__9);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <KickPlayerWithDelay>d__21 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Entity userEntity;

			private string <jsonDataDeaths>5__1;

			private User <user>5__2;

			private string <newName>5__3;

			private UserModel <userModel>5__4;

			private Entity <entity>5__5;

			private NetworkId <networkId>5__6;

			private RenameUserDebugEvent <renameEvent>5__7;

			private FromCharacter <fromCharacter>5__8;

			private string <jsonData>5__9;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <KickPlayerWithDelay>d__21(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<jsonDataDeaths>5__1 = null;
				<newName>5__3 = null;
				<userModel>5__4 = null;
				<jsonData>5__9 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_01df: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_023a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_027f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_0295: Unknown result type (might be due to invalid IL or missing references)
				//IL_0299: Unknown result type (might be due to invalid IL or missing references)
				//IL_029e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02be: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fa: 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)
				//IL_0304: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_0311: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Expected O, but got Unknown
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					Deaths++;
					<jsonDataDeaths>5__1 = JsonSerializer.Serialize(Deaths, new JsonSerializerOptions
					{
						WriteIndented = true
					});
					File.WriteAllText(DeathsJson, <jsonDataDeaths>5__1);
					<user>5__2 = ECSExtensions.Read<User>(userEntity);
					FixedString64Bytes characterName = <user>5__2.CharacterName;
					<newName>5__3 = ((object)(FixedString64Bytes)(ref characterName)).ToString() + Deaths;
					<userModel>5__4 = GameData.Users.FromEntity(userEntity);
					if (LastWords.ContainsKey(<user>5__2.PlatformId) && Configuration.LastWords)
					{
						ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "<color=red>Last Words: <color=yellow>" + LastWords[<user>5__2.PlatformId]);
						LastWords.Remove(<user>5__2.PlatformId);
						<jsonData>5__9 = JsonSerializer.Serialize(LastWords, new JsonSerializerOptions
						{
							WriteIndented = true
						});
						File.WriteAllText(LastWordsJson, <jsonData>5__9);
						<jsonData>5__9 = null;
					}
					ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, <user>5__2, "<color=red>You Died! Your character and castle is being removed.");
					ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, <user>5__2, "<color=red>You will be kicked from server in 5 seconds...");
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					EntityManager entityManager = VWorld.Server.EntityManager;
					<entity>5__5 = ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[3]
					{
						ComponentType.ReadOnly<NetworkEventType>(),
						ComponentType.ReadOnly<SendEventToUser>(),
						ComponentType.ReadOnly<KickEvent>()
					});
					ECSExtensions.Write<KickEvent>(<entity>5__5, new KickEvent
					{
						PlatformId = <user>5__2.PlatformId
					});
					ECSExtensions.Write<SendEventToUser>(<entity>5__5, new SendEventToUser
					{
						UserIndex = <user>5__2.Index
					});
					ECSExtensions.Write<NetworkEventType>(<entity>5__5, new NetworkEventType
					{
						EventId = NetworkEvents.EventId_KickEvent,
						IsAdminEvent = false,
						IsDebugEvent = false
					});
					<user>5__2.PlatformId = 0uL;
					ECSExtensions.Write<User>(userEntity, <user>5__2);
					entityManager = VWorld.Server.EntityManager;
					<networkId>5__6 = ((EntityManager)(ref entityManager)).GetComponentData<NetworkId>(userEntity);
					<renameEvent>5__7 = new RenameUserDebugEvent
					{
						NewName = FixedString64Bytes.op_Implicit(<newName>5__3),
						Target = <networkId>5__6
					};
					<fromCharacter>5__8 = new FromCharacter
					{
						User = userEntity,
						Character = <userModel>5__4.Character.Entity
					};
					debugEventsSystem.RenameUser(<fromCharacter>5__8, <renameEvent>5__7);
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static MonoBehaviour monoBehaviour;

		private static HttpClient httpClient = new HttpClient();

		public static ServerGameSettingsSystem serverGameSettingsSystem;

		public static DebugEventsSystem debugEventsSystem;

		public static Singleton networkIdSystem;

		public static string LastWordsJson = "BepInEx/config/NightbaneHardcore/LastWords.json";

		public static string DeathsJson = "BepInEx/config/NightbaneHardcore/DeathsCount.json";

		public static string ItemDropsJson = "BepInEx/config/NightbaneHardcore/ItemDropsConfirms.json";

		public static Dictionary<ulong, string> LastWords = new Dictionary<ulong, string>();

		public static List<ulong> ItemDropConfirms = new List<ulong>();

		public static int Deaths = 0;

		public static bool PvPEnabled;

		public static half DefaultDropRate;

		public static bool HigherDropRateEnabled = false;

		public static bool Initialized = false;

		public static void Initialize()
		{
			//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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!Initialized)
			{
				serverGameSettingsSystem = VWorld.Server.GetExistingSystemManaged<ServerGameSettingsSystem>();
				debugEventsSystem = VWorld.Server.GetExistingSystemManaged<DebugEventsSystem>();
				ServerScriptMapper existingSystemManaged = VWorld.Server.GetExistingSystemManaged<ServerScriptMapper>();
				networkIdSystem = ((ComponentSystemBase)existingSystemManaged).GetSingleton<Singleton>();
				ServerGameBalanceSettings val = serverGameSettingsSystem._Settings.ToStruct(false);
				if ((int)val.GameModeType == 1)
				{
					PvPEnabled = true;
				}
				else
				{
					PvPEnabled = false;
				}
				DefaultDropRate = val.DropTableModifier_General;
				string path = "BepInEx/config/NightbaneHardcore";
				Directory.CreateDirectory(path);
				LastWords = Helper.LoadJson<Dictionary<ulong, string>>(LastWordsJson);
				Deaths = Helper.LoadJson<int>(DeathsJson);
				ItemDropConfirms = Helper.LoadJson<List<ulong>>(ItemDropsJson);
				CoroutineHandler.StartRepeatingCoroutine((Action)delegate
				{
					PvPOnBloodmoon();
				}, 2f);
				Initialized = true;
			}
		}

		public static void HandleDropItem(FromCharacter fromCharacter, int slotIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			User val = ECSExtensions.Read<User>(fromCharacter.User);
			if (!ItemDropConfirms.Contains(val.PlatformId))
			{
				ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, val, "<color=red>WARNING! item drops on ground is disabled in Hardcore Mode! If you want to remove your items, use <color=yellow>.dropenable<color=red> command, it will let you remove items instead of dropping.");
				return;
			}
			InventoryInstanceElement val2 = ECSExtensions.ReadBuffer<InventoryInstanceElement>(fromCharacter.Character)[0];
			InventoryUtilitiesServer.ClearSlot(VWorld.Server.EntityManager, val2.ExternalInventoryEntity._Entity, slotIndex);
		}

		public static void HandleDropItemChest(Entity chestEntity, FromCharacter fromCharacter, int slotIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			User val = ECSExtensions.Read<User>(fromCharacter.User);
			if (!ItemDropConfirms.Contains(val.PlatformId))
			{
				ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, val, "<color=red>WARNING! item drops on ground is disabled in Hardcore Mode! If you want to remove your items, use <color=yellow>.dropenable<color=red> command, it will let you remove items instead of dropping.");
				return;
			}
			InventoryInstanceElement val2 = ECSExtensions.ReadBuffer<InventoryInstanceElement>(chestEntity)[0];
			InventoryUtilitiesServer.ClearSlot(VWorld.Server.EntityManager, val2.ExternalInventoryEntity._Entity, slotIndex);
		}

		public static void HardcoreDeath(Entity deathEntity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			Entity val = default(Entity);
			VampireDownedServerEventSystem.TryFindRootOwner(deathEntity, 1, VWorld.Server.EntityManager, ref val);
			VampireDownedBuff val2 = ECSExtensions.Read<VampireDownedBuff>(deathEntity);
			Entity val3 = default(Entity);
			VampireDownedServerEventSystem.TryFindRootOwner(val2.Source, 1, VWorld.Server.EntityManager, ref val3);
			bool flag = ECSExtensions.Has<PlayerCharacter>(val3);
			Entity controller = ECSExtensions.Read<ControlledBy>(val).Controller;
			User val4 = ECSExtensions.Read<User>(controller);
			Equipment val5 = ECSExtensions.Read<Equipment>(val);
			float num = ModifiableFloat.op_Implicit(val5.ArmorLevel) + ModifiableFloat.op_Implicit(val5.SpellLevel) + ModifiableFloat.op_Implicit(val5.WeaponLevel);
			ServerScriptMapper existingSystemManaged = VWorld.Server.GetExistingSystemManaged<ServerScriptMapper>();
			ServerGameManager serverGameManager = existingSystemManaged._ServerGameManager;
			if (flag)
			{
				Equipment val6 = ECSExtensions.Read<Equipment>(val3);
				float num2 = ModifiableFloat.op_Implicit(val6.ArmorLevel) + ModifiableFloat.op_Implicit(val6.SpellLevel) + ModifiableFloat.op_Implicit(val6.WeaponLevel);
				if (Configuration.DiscordDeathlog)
				{
					string discordWebhookIDPvP = Configuration.DiscordWebhookIDPvP;
					string discordWebhookTokenPvP = Configuration.DiscordWebhookTokenPvP;
					List<object> list = new List<object>();
					DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(25, 4);
					defaultInterpolatedStringHandler.AppendLiteral("Player ");
					PlayerCharacter val7 = ECSExtensions.Read<PlayerCharacter>(val3);
					defaultInterpolatedStringHandler.AppendFormatted(((FixedString64Bytes)(ref val7.Name)).Value);
					defaultInterpolatedStringHandler.AppendLiteral(" (");
					defaultInterpolatedStringHandler.AppendFormatted(Mathf.Floor(num2));
					defaultInterpolatedStringHandler.AppendLiteral(") has slain ");
					defaultInterpolatedStringHandler.AppendFormatted<FixedString64Bytes>(ECSExtensions.Read<PlayerCharacter>(val).Name);
					defaultInterpolatedStringHandler.AppendLiteral(" (");
					defaultInterpolatedStringHandler.AppendFormatted(Mathf.Floor(num));
					defaultInterpolatedStringHandler.AppendLiteral(")!");
					list.Add(new
					{
						title = "PvP Kill",
						description = defaultInterpolatedStringHandler.ToStringAndClear(),
						color = int.Parse("FF0000", NumberStyles.HexNumber)
					});
					var value = new
					{
						embeds = list
					};
					string requestUri = $"https://discordapp.com/api/webhooks/{discordWebhookIDPvP}/{discordWebhookTokenPvP}";
					StringContent content = new StringContent(JsonSerializer.Serialize(value), Encoding.UTF8, "application/json");
					httpClient.PostAsync(requestUri, content);
				}
				StatChangeUtility.KillEntity(VWorld.Server.EntityManager, val, serverGameManager.ServerTime, (StatChangeReason)1);
			}
			else if (Configuration.DiscordDeathlog)
			{
				string discordWebhookID = Configuration.DiscordWebhookID;
				string discordWebhookToken = Configuration.DiscordWebhookToken;
				var value2 = new
				{
					embeds = new List<object>
					{
						new
						{
							title = "PvE Death",
							description = $"Player {ECSExtensions.Read<PlayerCharacter>(val).Name} has died at level {Mathf.Floor(num)}!",
							color = int.Parse("FF0000", NumberStyles.HexNumber)
						}
					}
				};
				string requestUri2 = $"https://discordapp.com/api/webhooks/{discordWebhookID}/{discordWebhookToken}";
				StringContent content2 = new StringContent(JsonSerializer.Serialize(value2), Encoding.UTF8, "application/json");
				httpClient.PostAsync(requestUri2, content2);
			}
			UserModel val8 = GameData.Users.FromEntity(controller);
			UserModelMethods.TeleportTo(val8, new float3(-2016.0348f, 5f, -2778.0544f));
			if (Configuration.AnnounceDeaths)
			{
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, $"<color=red><size=20>Vampire {val4.CharacterName} Has died at level {Mathf.Floor(num)}!");
			}
			StartCoroutine(KickPlayerWithDelay(controller));
			StartCoroutine(DestroyCastleOnDeath(controller));
		}

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)monoBehaviour == (Object)null)
			{
				GameObject val = new GameObject("NightbaneHardcore");
				monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
				Object.DontDestroyOnLoad((Object)(object)val);
			}
			return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
		}

		[IteratorStateMachine(typeof(<KickPlayerWithDelay>d__21))]
		public static IEnumerator KickPlayerWithDelay(Entity userEntity)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <KickPlayerWithDelay>d__21(0)
			{
				userEntity = userEntity
			};
		}

		[IteratorStateMachine(typeof(<DestroyCastleOnDeath>d__22))]
		public static IEnumerator DestroyCastleOnDeath(Entity userEntity)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DestroyCastleOnDeath>d__22(0)
			{
				userEntity = userEntity
			};
		}

		public static void PvPOnBloodmoon()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			ServerScriptMapper existingSystemManaged = VWorld.Server.GetExistingSystemManaged<ServerScriptMapper>();
			ServerGameManager serverGameManager = existingSystemManaged._ServerGameManager;
			bool flag = ((DayNightCycle)(ref serverGameManager.DayNightCycle)).IsBloodMoonDay();
			Entity val = Helper.GetEntitiesByComponentType<ServerGameBalanceSettings>()[0];
			ServerGameBalanceSettings val2 = serverGameSettingsSystem._Settings.ToStruct(false);
			float timeSinceDayStart = ((DayNightCycle)(ref serverGameManager.DayNightCycle)).TimeSinceDayStart;
			if (timeSinceDayStart < 361f && flag)
			{
				return;
			}
			EntityManager entityManager;
			if (Configuration.HigherDropOnBloodmoon)
			{
				if (flag && !HigherDropRateEnabled)
				{
					HigherDropRateEnabled = true;
					val2.DropTableModifier_General = (half)(float)Configuration.DropRateOnBloodmoon;
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
					ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, $"<color=red>The Blood Moon rises, X{Configuration.DropRateOnBloodmoon} Drop Rate is now ACTIVE!");
				}
				else if (!flag && HigherDropRateEnabled)
				{
					HigherDropRateEnabled = false;
					val2.DropTableModifier_General = DefaultDropRate;
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
					ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "<color=green>The Blood Moon fades, drop rates are back to normal.");
				}
			}
			if (Configuration.PvPOnBloodmoon)
			{
				if (flag && !PvPEnabled)
				{
					PvPEnabled = true;
					val2.GameModeType = (GameModeType)1;
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
				}
				else if (!flag && PvPEnabled)
				{
					PvPEnabled = false;
					val2.GameModeType = (GameModeType)0;
					entityManager = VWorld.Server.EntityManager;
					((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
				}
			}
		}

		[Command("dropenable", null, null, null, null, false)]
		public static void DropEnableCommand(ChatCommandContext ctx)
		{
			//IL_000c: 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)
			if (ItemDropConfirms.Contains(ctx.Event.User.PlatformId))
			{
				ctx.Reply("<color=red>Item removing is already enabled! Use .dropdisable command to disable it.");
				return;
			}
			ItemDropConfirms.Add(ctx.Event.User.PlatformId);
			string contents = JsonSerializer.Serialize(ItemDropConfirms, new JsonSerializerOptions
			{
				WriteIndented = true
			});
			File.WriteAllText(ItemDropsJson, contents);
			ctx.Reply("<color=green>Item removing is now enabled! Use .dropdisable command to disable it.");
		}

		[Command("dropdisable", null, null, null, null, false)]
		public static void DropDisableCommand(ChatCommandContext ctx)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (!ItemDropConfirms.Contains(ctx.Event.User.PlatformId))
			{
				ctx.Reply("<color=red>Item removing is already disabled! Use .dropenable command to enable it.");
				return;
			}
			ItemDropConfirms.Remove(ctx.Event.User.PlatformId);
			string contents = JsonSerializer.Serialize(ItemDropConfirms, new JsonSerializerOptions
			{
				WriteIndented = true
			});
			File.WriteAllText(ItemDropsJson, contents);
			ctx.Reply("<color=green>Item removing is now disabled! Use .dropenable command to enable it again.");
		}
	}
	public static class Helper
	{
		public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0027: 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_0030: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			EntityQueryOptions val = (EntityQueryOptions)0;
			if (includeAll)
			{
				val = (EntityQueryOptions)(val | 0xC3);
			}
			if (includeDisabled)
			{
				val = (EntityQueryOptions)(val | 2);
			}
			if (includeSpawn)
			{
				val = (EntityQueryOptions)(val | 0x40);
			}
			if (includePrefab)
			{
				val = (EntityQueryOptions)(val | 1);
			}
			if (includeDestroyed)
			{
				val = (EntityQueryOptions)(val | 0x80);
			}
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)
			});
			val2.Options = val;
			EntityQueryDesc val3 = val2;
			EntityManager entityManager = VWorld.Server.EntityManager;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val3 });
			return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static T LoadJson<T>(string filePath) where T : new()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			if (!File.Exists(filePath))
			{
				return new T();
			}
			try
			{
				string json = File.ReadAllText(filePath);
				T val = JsonSerializer.Deserialize<T>(json, new JsonSerializerOptions
				{
					WriteIndented = true
				});
				return (val != null) ? val : new T();
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Plugin.logger;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(46, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[NightbaneHardcore] Error loading JSON from ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(filePath);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				logger.LogError(val2);
				return new T();
			}
		}
	}
	[BepInPlugin("NightbaneHardcore", "NightbaneHardcore", "1.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		private Harmony _harmony;

		public static ManualLogSource logger;

		public override void Load()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			logger = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("NightbaneHardcore");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.3");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			_harmony = new Harmony("NightbaneHardcore");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			CommandRegistry.RegisterAll();
			Configuration.InitConfig(((BasePlugin)this).Config);
		}

		public override bool Unload()
		{
			CommandRegistry.UnregisterAssembly();
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NightbaneHardcore";

		public const string PLUGIN_NAME = "NightbaneHardcore";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}