Decompiled source of BloodyNotify v1.0.0

BloodyNotify.dll

Decompiled 12 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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 Bloodstone.API;
using Bloodstone.Hooks;
using BloodyNotify.Hooks;
using BloodyNotify.Structs;
using BloodyNotify.Utils;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using Stunlock.Core;
using Stunlock.Network;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
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("BloodyNotify")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Notify mod for VRising by Backxtar.")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BloodyNotify")]
[assembly: AssemblyTitle("BloodyNotify")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.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]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[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;
		}
	}
}
namespace BloodyNotify
{
	[BepInPlugin("BloodyNotify", "BloodyNotify", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[Reloadable]
	public class Plugin : BasePlugin, IRunOnInitialized
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static GameFrameUpdateEventHandler <0>__HandleNotifyFrame;
		}

		private Harmony _harmony;

		public static ManualLogSource LogInstance { get; private set; }

		public static Settings Settings { get; private set; }

		public override void Load()
		{
			//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_006a: Expected O, but got Unknown
			LogInstance = ((BasePlugin)this).Log;
			Settings = new Settings(((BasePlugin)this).Config);
			Settings.InitConfig();
			if (!VWorld.IsServer)
			{
				((BasePlugin)this).Log.LogWarning((object)"This plugin is a server-only plugin.");
			}
			CommandRegistry.RegisterAll();
			object obj = <>O.<0>__HandleNotifyFrame;
			if (obj == null)
			{
				GameFrameUpdateEventHandler val = ActionScheduler.HandleNotifyFrame;
				<>O.<0>__HandleNotifyFrame = val;
				obj = (object)val;
			}
			GameFrame.OnUpdate += (GameFrameUpdateEventHandler)obj;
		}

		public void OnGameInitialized()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			if (!VWorld.IsClient)
			{
				_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
				Core.InitializeAfterLoaded();
				ManualLogSource log = ((BasePlugin)this).Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BloodyNotify");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
				}
				log.LogInfo(val);
			}
		}

		public override bool Unload()
		{
			//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_003a: Expected O, but got Unknown
			CommandRegistry.UnregisterAssembly();
			((BasePlugin)this).Config.Clear();
			_harmony.UnpatchSelf();
			object obj = <>O.<0>__HandleNotifyFrame;
			if (obj == null)
			{
				GameFrameUpdateEventHandler val = ActionScheduler.HandleNotifyFrame;
				<>O.<0>__HandleNotifyFrame = val;
				obj = (object)val;
			}
			GameFrame.OnUpdate -= (GameFrameUpdateEventHandler)obj;
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BloodyNotify";

		public const string PLUGIN_NAME = "BloodyNotify";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BloodyNotify.Utils
{
	internal static class Core
	{
		public static ManualLogSource Log = Plugin.LogInstance;

		private static bool _hasInitialized = false;

		public static World Server { get; } = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");


		public static EntityManager EntityManager { get; } = Server.EntityManager;


		public static PlayerService Players { get; internal set; }

		public static UnitSpawnerService UnitSpawner { get; internal set; }

		public static PrefabService Prefabs { get; internal set; }

		public static void LogException(Exception e, [CallerMemberName] string caller = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 5, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner:");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.StackTrace);
			}
			log.LogError(val);
		}

		internal static void InitializeAfterLoaded()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			if (!_hasInitialized)
			{
				Players = new PlayerService();
				UnitSpawner = new UnitSpawnerService();
				Prefabs = new PrefabService();
				_hasInitialized = true;
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("InitializeAfterLoaded");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed");
				}
				log.LogInfo(val);
			}
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}
	}
	public static class ECSExtensionService
	{
		public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			byte[] array = StructureToByteArray(componentData);
			int num = Marshal.SizeOf<T>();
			fixed (byte* ptr = array)
			{
				EntityManager entityManager = VWorld.Server.EntityManager;
				((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num);
			}
		}

		public static byte[] StructureToByteArray<T>(T structure) where T : struct
		{
			int num = Marshal.SizeOf(structure);
			byte[] array = new byte[num];
			IntPtr intPtr = Marshal.AllocHGlobal(num);
			Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true);
			Marshal.Copy(intPtr, array, 0, num);
			Marshal.FreeHGlobal(intPtr);
			return array;
		}

		public unsafe static T Read<T>(this Entity entity) where T : struct
		{
			//IL_0013: 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_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)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = VWorld.Server.EntityManager;
			void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex);
			return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO));
		}

		public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
		{
			//IL_0006: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			EntityManager entityManager = VWorld.Server.EntityManager;
			return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity);
		}

		public static void Add<T>(this Entity entity)
		{
			//IL_0013: 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_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)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = VWorld.Server.EntityManager;
			((EntityManager)(ref entityManager)).AddComponent(entity, val);
		}

		public static void Remove<T>(this Entity entity)
		{
			//IL_0013: 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_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)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = VWorld.Server.EntityManager;
			((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
		}

		public static bool Has<T>(this Entity entity)
		{
			//IL_0013: 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_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)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = VWorld.Server.EntityManager;
			return ((EntityManager)(ref entityManager)).HasComponent(entity, val);
		}

		public static void LogComponentTypes(this Entity entity)
		{
			//IL_0006: 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_000e: 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_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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = VWorld.Server.EntityManager;
			Enumerator<ComponentType> enumerator = ((EntityManager)(ref entityManager)).GetComponentTypes(entity, (Allocator)2).GetEnumerator();
			bool flag = default(bool);
			while (enumerator.MoveNext())
			{
				ComponentType current = enumerator.Current;
				ManualLogSource logInstance = Plugin.LogInstance;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ComponentType>(current);
				}
				logInstance.LogInfo(val);
			}
			Plugin.LogInstance.LogInfo((object)"===");
		}

		public static void LogComponentTypes(this EntityQuery entityQuery)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			Il2CppStructArray<ComponentType> queryTypes = ((EntityQuery)(ref entityQuery)).GetQueryTypes();
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			foreach (ComponentType item in (Il2CppArrayBase<ComponentType>)(object)queryTypes)
			{
				ManualLogSource logInstance = Plugin.LogInstance;
				val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Query Component Type: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ComponentType>(item);
				}
				logInstance.LogInfo(val);
			}
			ManualLogSource logInstance2 = Plugin.LogInstance;
			val = new BepInExInfoLogInterpolatedStringHandler(3, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("===");
			}
			logInstance2.LogInfo(val);
		}

		public static string LookupName(this PrefabGUID prefabGuid)
		{
			//IL_0012: 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_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)
			PrefabCollectionSystem existingSystem = VWorld.Server.GetExistingSystem<PrefabCollectionSystem>();
			object obj;
			if (!((PrefabCollectionSystem_Base)existingSystem).PrefabGuidToNameDictionary.ContainsKey(prefabGuid))
			{
				obj = "GUID Not Found";
			}
			else
			{
				string text = ((PrefabCollectionSystem_Base)existingSystem).PrefabGuidToNameDictionary[prefabGuid];
				PrefabGUID val = prefabGuid;
				obj = text + " " + ((object)(PrefabGUID)(ref val)).ToString();
			}
			return obj.ToString();
		}
	}
	public static class Il2cppService
	{
		private static Type GetType<T>()
		{
			return Il2CppType.Of<T>();
		}

		public unsafe static T GetComponentDataAOT<T>(this EntityManager entityManager, Entity entity) where T : unmanaged
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			int typeIndex = TypeManager.GetTypeIndex(GetType<T>());
			T* componentDataRawRW = (T*)((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, typeIndex);
			return *componentDataRawRW;
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1>(bool includeAll = false)
		{
			//IL_0009: 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_0011: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0069: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions options = (EntityQueryOptions)(includeAll ? 27 : 0);
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)
			});
			val.Options = options;
			EntityQueryDesc val2 = val;
			EntityManager entityManager = VWorld.Server.EntityManager;
			EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val2 });
			return ((EntityQuery)(ref val3)).ToEntityArray((Allocator)2);
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false)
		{
			//IL_0009: 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_0011: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions options = (EntityQueryOptions)(includeAll ? 27 : 0);
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0),
				new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0)
			});
			val.Options = options;
			EntityQueryDesc val2 = val;
			EntityManager entityManager = VWorld.Server.EntityManager;
			EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val2 });
			return ((EntityQuery)(ref val3)).ToEntityArray((Allocator)2);
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2, T3>(bool includeAll = false)
		{
			//IL_0009: 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_0011: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions options = (EntityQueryOptions)(includeAll ? 27 : 0);
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[3]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0),
				new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0),
				new ComponentType(Il2CppType.Of<T3>(), (AccessMode)0)
			});
			val.Options = options;
			EntityQueryDesc val2 = val;
			EntityManager entityManager = VWorld.Server.EntityManager;
			EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val2 });
			return ((EntityQuery)(ref val3)).ToEntityArray((Allocator)2);
		}
	}
	internal class PlayerService
	{
		private Dictionary<FixedString64, PlayerData> NamePlayerCache = new Dictionary<FixedString64, PlayerData>();

		private Dictionary<ulong, PlayerData> SteamPlayerCache = new Dictionary<ulong, PlayerData>();

		internal bool TryFindSteam(ulong steamId, out PlayerData playerData)
		{
			return SteamPlayerCache.TryGetValue(steamId, out playerData);
		}

		internal bool TryFindName(FixedString64 name, out PlayerData playerData)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return NamePlayerCache.TryGetValue(name, out playerData);
		}

		internal PlayerService()
		{
			//IL_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//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_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_0086: 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_008f: 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_009d: 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)
			//IL_00a5: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			NamePlayerCache.Clear();
			SteamPlayerCache.Clear();
			EntityManager entityManager = Core.EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			val.Options = (EntityQueryOptions)2;
			array[0] = val;
			EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			Enumerator<Entity> enumerator = ((EntityQuery)(ref val2)).ToEntityArray((Allocator)2).GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				entityManager = Core.EntityManager;
				User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(current);
				PlayerData value = new PlayerData(componentData.CharacterName, componentData.PlatformId, componentData.IsConnected, current, componentData.LocalCharacter._Entity);
				NamePlayerCache.TryAdd(FixedString64.op_Implicit(((object)(FixedString64)(ref componentData.CharacterName)).ToString().ToLower()), value);
				SteamPlayerCache.TryAdd(componentData.PlatformId, value);
			}
			IEnumerable<string> enumerable = from p in NamePlayerCache.Values
				where p.IsOnline
				select $"\t{p.CharacterName}";
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(58, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Player Cache Created with ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(NamePlayerCache.Count);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" entries total, listing ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(enumerable.Count());
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" online:");
			}
			log.LogWarning(val3);
			Core.Log.LogWarning((object)string.Join("\n", enumerable));
		}

		internal void UpdatePlayerCache(Entity userEntity, string oldName, string newName, bool forceOffline = false)
		{
			//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_0009: 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_000f: 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_0038: 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_0043: 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_004a: 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_0066: 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)
			EntityManager entityManager = Core.EntityManager;
			User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
			NamePlayerCache.Remove(FixedString64.op_Implicit(oldName.ToLower()));
			if (forceOffline)
			{
				componentData.IsConnected = false;
			}
			PlayerData value = new PlayerData(FixedString64.op_Implicit(newName), componentData.PlatformId, componentData.IsConnected, userEntity, componentData.LocalCharacter._Entity);
			NamePlayerCache[FixedString64.op_Implicit(newName.ToLower())] = value;
			SteamPlayerCache[componentData.PlatformId] = value;
		}

		internal bool RenamePlayer(Entity userEntity, Entity charEntity, FixedString64 newName)
		{
			//IL_000c: 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_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_0021: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0051: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			DebugEventsSystem existingSystem = Core.Server.GetExistingSystem<DebugEventsSystem>();
			EntityManager entityManager = Core.EntityManager;
			NetworkId componentData = ((EntityManager)(ref entityManager)).GetComponentData<NetworkId>(userEntity);
			entityManager = Core.EntityManager;
			User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
			RenameUserDebugEvent val = default(RenameUserDebugEvent);
			val.NewName = newName;
			val.Target = componentData;
			RenameUserDebugEvent val2 = val;
			FromCharacter val3 = default(FromCharacter);
			val3.User = userEntity;
			val3.Character = charEntity;
			FromCharacter val4 = val3;
			existingSystem.RenameUser(val4, val2);
			UpdatePlayerCache(userEntity, ((object)(FixedString64)(ref componentData2.CharacterName)).ToString(), ((object)(FixedString64)(ref newName)).ToString());
			return true;
		}

		public static bool IsNewUser(Entity userEntity)
		{
			//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)
			User userComponente = GetUserComponente(userEntity);
			return ((FixedString64)(ref userComponente.CharacterName)).IsEmpty;
		}

		public static User GetUserComponente(Entity userEntity)
		{
			//IL_0006: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			EntityManager entityManager = VWorld.Server.EntityManager;
			return ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
		}

		public static string GetCharacterName(Entity userEntity)
		{
			//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)
			User userComponente = GetUserComponente(userEntity);
			return ((object)(FixedString64)(ref userComponente.CharacterName)).ToString();
		}

		public static string GetCharacterName(User user)
		{
			return ((object)(FixedString64)(ref user.CharacterName)).ToString();
		}

		public static IEnumerable<Entity> GetUsersOnline()
		{
			EntityManager entityManager = VWorld.Server.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> _userEntities = ((EntityQuery)(ref val)).ToEntityArray((Allocator)2);
			int len = _userEntities.Length;
			int i = 0;
			while (i < len)
			{
				if (_userEntities[i].Read<User>().IsConnected)
				{
					yield return _userEntities[i];
				}
				int num = i + 1;
				i = num;
			}
		}
	}
	internal class PrefabService
	{
		internal Dictionary<string, (string Name, PrefabGUID Prefab)> NameToGuid { get; init; } = new Dictionary<string, (string, PrefabGUID)>();


		internal PrefabService()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			PrefabCollectionSystem existingSystem = Core.Server.GetExistingSystem<PrefabCollectionSystem>();
			Dictionary<string, PrefabGUID> spawnableNameToPrefabGuidDictionary = ((PrefabCollectionSystem_Base)existingSystem).SpawnableNameToPrefabGuidDictionary;
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Spawnable prefabs: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(spawnableNameToPrefabGuidDictionary.Count);
			}
			log.LogDebug(val);
			Enumerator<string, PrefabGUID> enumerator = spawnableNameToPrefabGuidDictionary.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<string, PrefabGUID> current = enumerator.Current;
				if (!NameToGuid.TryAdd(current.Key.ToLowerInvariant(), (current.Key, current.Value)))
				{
					ManualLogSource log2 = Core.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(25, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(current.Key);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" exist already, skipping.");
					}
					log2.LogDebug(val);
				}
			}
		}

		internal bool TryGetItem(string input, out PrefabGUID prefab)
		{
			//IL_0036: 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)
			string text = input.ToLowerInvariant();
			(string, PrefabGUID) value;
			bool result = NameToGuid.TryGetValue(text, out value) || NameToGuid.TryGetValue("item_" + text, out value);
			prefab = value.Item2;
			return result;
		}

		internal PrefabGUID GetGUIDByName(string value)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return NameToGuid[value.ToLowerInvariant()].Prefab;
		}

		public static string GetPrefabName(PrefabGUID hashCode)
		{
			//IL_0012: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			PrefabCollectionSystem existingSystem = VWorld.Server.GetExistingSystem<PrefabCollectionSystem>();
			string result = "Nonexistent";
			if (hashCode.GuidHash == 0)
			{
				return result;
			}
			try
			{
				PrefabLookupMap prefabLookupMap = ((PrefabCollectionSystem_Base)existingSystem).PrefabLookupMap;
				Entity val = ((PrefabLookupMap)(ref prefabLookupMap))[hashCode];
				result = ((object)(Entity)(ref val)).ToString();
			}
			catch
			{
				result = "NoPrefabName";
			}
			return result;
		}
	}
	internal class UnitSpawnerService
	{
		[HarmonyPatch(typeof(UnitSpawnerReactSystem), "OnUpdate")]
		public static class UnitSpawnerReactSystem_Patch
		{
			public static bool Enabled { get; set; }

			public static void Prefix(UnitSpawnerReactSystem __instance)
			{
				//IL_0013: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				//IL_006d: 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_007b: 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_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Expected O, but got Unknown
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: 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_00f4: 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)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Expected O, but got Unknown
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Expected O, but got Unknown
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				//IL_021a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0232: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: 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_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				if (!Enabled)
				{
					return;
				}
				EntityQuery _OnUpdate_LambdaJob0_entityQuery = __instance.__OnUpdate_LambdaJob0_entityQuery;
				NativeArray<Entity> val = ((EntityQuery)(ref _OnUpdate_LambdaJob0_entityQuery)).ToEntityArray((Allocator)2);
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Processing ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(val.Length);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" in UnitSpawnerReactionSystem");
				}
				log.LogDebug(val2);
				Enumerator<Entity> enumerator = val.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					ManualLogSource log2 = Core.Log;
					val2 = new BepInExDebugLogInterpolatedStringHandler(27, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Checking if ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(current.Index);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" has lifetime..");
					}
					log2.LogDebug(val2);
					EntityManager entityManager = Core.EntityManager;
					if (!((EntityManager)(ref entityManager)).HasComponent<LifeTime>(current))
					{
						break;
					}
					entityManager = Core.EntityManager;
					LifeTime componentData = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(current);
					long num = (long)Mathf.Round(componentData.Duration);
					ManualLogSource log3 = Core.Log;
					val2 = new BepInExDebugLogInterpolatedStringHandler(34, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Found durationKey ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<long>(num);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from LifeTime(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(componentData.Duration);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")");
					}
					log3.LogDebug(val2);
					if (Core.UnitSpawner.PostActions.TryGetValue(num, out (float, Action<Entity>) value))
					{
						(float, Action<Entity>) tuple = value;
						float item = tuple.Item1;
						Action<Entity> item2 = tuple.Item2;
						ManualLogSource log4 = Core.Log;
						val2 = new BepInExDebugLogInterpolatedStringHandler(38, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Found post actions for ");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<long>(num);
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" with ");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(item);
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" duration");
						}
						log4.LogDebug(val2);
						Core.UnitSpawner.PostActions.Remove(num);
						LifeTimeEndAction endAction = (LifeTimeEndAction)((!(item < 0f)) ? 2 : 0);
						LifeTime val3 = default(LifeTime);
						val3.Duration = item;
						val3.EndAction = endAction;
						LifeTime val4 = val3;
						entityManager = Core.EntityManager;
						((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(current, val4);
						item2(current);
					}
				}
			}
		}

		private static Entity empty_entity = default(Entity);

		internal const int DEFAULT_MINRANGE = 1;

		internal const int DEFAULT_MAXRANGE = 1;

		internal Dictionary<long, (float actualDuration, Action<Entity> Actions)> PostActions = new Dictionary<long, (float, Action<Entity>)>();

		public void Spawn(Entity user, PrefabGUID unit, int count, float2 position, float minRange = 1f, float maxRange = 2f, float duration = -1f)
		{
			//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_0009: 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_000f: 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_0019: 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_0024: 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_0041: 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)
			EntityManager entityManager = Core.EntityManager;
			Translation componentData = ((EntityManager)(ref entityManager)).GetComponentData<Translation>(user);
			float3 val = default(float3);
			((float3)(ref val))..ctor(position.x, componentData.Value.y, position.y);
			UnitSpawnerUpdateSystem existingSystem = Core.Server.GetExistingSystem<UnitSpawnerUpdateSystem>();
			existingSystem.SpawnUnit(empty_entity, unit, val, count, minRange, maxRange, duration);
		}

		public void SpawnWithCallback(Entity user, PrefabGUID unit, float2 position, float duration, Action<Entity> postActions)
		{
			//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_000a: 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_0013: 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_001a: 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_0049: 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)
			EntityManager entityManager = Core.EntityManager;
			Translation componentData = ((EntityManager)(ref entityManager)).GetComponentData<Translation>(user);
			float3 val = default(float3);
			((float3)(ref val))..ctor(position.x, componentData.Value.y, position.y);
			UnitSpawnerUpdateSystem existingSystem = Core.Server.GetExistingSystem<UnitSpawnerUpdateSystem>();
			UnitSpawnerReactSystem_Patch.Enabled = true;
			long num = NextKey();
			existingSystem.SpawnUnit(empty_entity, unit, val, 1, 1f, 1f, (float)num);
			PostActions.Add(num, (duration, postActions));
		}

		internal long NextKey()
		{
			Random random = new Random();
			int num = 5;
			long num2;
			do
			{
				num2 = random.NextInt64(10000L) * 3;
				num--;
				if (num < 0)
				{
					throw new Exception("Failed to generate a unique key for UnitSpawnerService");
				}
			}
			while (PostActions.ContainsKey(num2));
			return num2;
		}
	}
}
namespace BloodyNotify.Structs
{
	public struct KillEvent
	{
		public DateTime Executed { get; set; }

		public string VBlood { get; set; }

		public List<string> Killers { get; set; }

		public KillEvent(DateTime _executed, string _vblood)
		{
			Killers = new List<string>();
			Executed = _executed;
			VBlood = _vblood;
		}
	}
	public struct PlayerData
	{
		public FixedString64 CharacterName { get; set; }

		public ulong SteamID { get; set; }

		public bool IsOnline { get; set; }

		public Entity UserEntity { get; set; }

		public Entity CharEntity { get; set; }

		public PlayerData(FixedString64 _characterName = default(FixedString64), ulong _steamID = 0uL, bool _isOnline = false, Entity _userEntity = default(Entity), Entity _charEntity = default(Entity))
		{
			//IL_0002: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			CharacterName = _characterName;
			SteamID = _steamID;
			IsOnline = _isOnline;
			UserEntity = _userEntity;
			CharEntity = _charEntity;
		}
	}
	public class Player
	{
		public string Name { get; set; }

		public ulong SteamID { get; set; }

		public bool IsOnline { get; set; }

		public bool IsAdmin { get; set; }

		public Entity User { get; set; }

		public Entity Character { get; set; }

		public Player(Entity userEntity = default(Entity), Entity charEntity = default(Entity))
		{
			//IL_0009: 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_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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0055: 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)
			User = userEntity;
			User val = User.Read<User>();
			Character = val.LocalCharacter._Entity;
			Name = ((object)(FixedString64)(ref val.CharacterName)).ToString();
			IsOnline = val.IsConnected;
			IsAdmin = val.IsAdmin;
			SteamID = val.PlatformId;
		}
	}
	public readonly struct Settings
	{
		private readonly ConfigFile CONFIG;

		private readonly ConfigEntry<bool> ENABLE_MOD;

		private readonly ConfigEntry<bool> PVP_KILLS;

		private readonly ConfigEntry<bool> NEW_PLAYER;

		private readonly ConfigEntry<bool> ADMIN_ONLINE;

		private readonly ConfigEntry<bool> VBLOOD_KILLS;

		private static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "BloodyNotify");

		private static readonly string MESSAGES_PATH = Path.Combine(CONFIG_PATH, "messages.json");

		private static readonly string VBLOOD_PATH = Path.Combine(CONFIG_PATH, "vbloods.json");

		private static readonly string ADMIN_PATH = Path.Combine(CONFIG_PATH, "admins.json");

		private static readonly Dictionary<string, string> ANNOUNCEMENTS = new Dictionary<string, string>
		{
			{ "NewUser", "A new vampire has reached Bloody Mary!" },
			{ "VBlood", "{vblood} was killed by {user}." },
			{ "PlayerKilled", "{target} was killed by {killer}!" },
			{ "StaffOnline", "{role} {user} is now online!" },
			{ "StaffOffline", "{role} {user} is now offline!" },
			{ "append", "and" },
			{ "comma", "," }
		};

		private static readonly Dictionary<string, string> STAFF = new Dictionary<string, string>
		{
			{ "123", "Role" },
			{ "1234", "Role" }
		};

		private static readonly Dictionary<string, string> VBLOODS = new Dictionary<string, string>
		{
			{ "CHAR_Wildlife_Wolf_VBlood", "Alpha Wolf" },
			{ "CHAR_Bandit_Deadeye_Frostarrow_VBlood", "Keely the Frost Archer" },
			{ "CHAR_Bandit_Foreman_VBlood", "Rufus the Foreman" },
			{ "CHAR_Bandit_StoneBreaker_VBlood", "Errol the Stonebreaker" },
			{ "CHAR_Bandit_Deadeye_Chaosarrow_VBlood", "Lidia the Chaos Archer" },
			{ "CHAR_Undead_BishopOfDeath_VBlood", "Goreswine the Ravager" },
			{ "CHAR_Bandit_Stalker_VBlood", "Grayson the Armourer" },
			{ "CHAR_Vermin_DireRat_VBlood", "Putrid Rat" },
			{ "CHAR_Bandit_Bomber_VBlood", "Clive the Firestarter" },
			{ "CHAR_Wildlife_Poloma_VBlood", "Polora the Feywalker" },
			{ "CHAR_Wildlife_Bear_Dire_Vblood", "Ferocious Bear" },
			{ "CHAR_Undead_Priest_VBlood", "Nicholaus the Fallen" },
			{ "CHAR_Bandit_Tourok_VBlood", "Quincey the Bandit King" },
			{ "CHAR_Villager_Tailor_VBlood", "Beatrice the Tailor" },
			{ "CHAR_Militia_Guard_VBlood", "Vincent the Frostbringer" },
			{ "CHAR_Farmlands_Nun_VBlood", "Christina the Sun Priestess" },
			{ "CHAR_VHunter_Leader_VBlood", "Tristan the Vampire Hunter" },
			{ "CHAR_Undead_BishopOfShadows_VBlood", "Leandra the Shadow Priestess" },
			{ "CHAR_Geomancer_Human_VBlood", "Terah the Geomancer" },
			{ "CHAR_Militia_Longbowman_LightArrow_Vblood", "Meredith the Bright Archer" },
			{ "CHAR_Wendigo_VBlood", "Frostmaw the Mountain Terror" },
			{ "CHAR_Militia_Leader_VBlood", "Octavian the Militia Captain" },
			{ "CHAR_Militia_BishopOfDunley_VBlood", "Raziel the Shepherd" },
			{ "CHAR_Spider_Queen_VBlood", "Ungora the Spider Queen" },
			{ "CHAR_Cursed_ToadKing_VBlood", "The Duke of Balaton" },
			{ "CHAR_VHunter_Jade_VBlood", "Jade the Vampire Hunter" },
			{ "CHAR_Undead_ZealousCultist_VBlood", "Foulrot the Soultaker" },
			{ "CHAR_WerewolfChieftain_VBlood", "Willfred the Werewolf Chief" },
			{ "CHAR_ArchMage_VBlood", "Mairwyn the Elementalist" },
			{ "CHAR_Town_Cardinal_VBlood", "Azariel the Sunbringer" },
			{ "CHAR_Winter_Yeti_VBlood", "Terrorclaw the Ogre" },
			{ "CHAR_Harpy_Matriarch_VBlood", "Morian the Stormwing Matriarch" },
			{ "CHAR_Cursed_Witch_VBlood", "Matka the Curse Weaver" },
			{ "CHAR_BatVampire_VBlood", "Nightmarshal Styx the Sunderer" },
			{ "CHAR_Cursed_MountainBeast_VBlood", "Gorecrusher the Behemoth" },
			{ "CHAR_Manticore_VBlood", "The Winged Horror" },
			{ "CHAR_Paladin_VBlood", "Solarus the Immaculate" },
			{ "CHAR_Bandit_GraveDigger_VBlood_UNUSED", "CHAR_Bandit_GraveDigger_VBlood_UNUSED" },
			{ "CHAR_Bandit_Leader_VBlood_UNUSED", "CHAR_Bandit_Leader_VBlood_UNUSED" },
			{ "CHAR_Bandit_Miner_VBlood_UNUSED", "CHAR_Bandit_Miner_VBlood_UNUSED" },
			{ "CHAR_Bandit_Thief_VBlood_UNUSED", "CHAR_Bandit_Thief_VBlood_UNUSED" },
			{ "CHAR_ChurchOfLight_Cardinal_VBlood", "Azariel the Sunbringer" },
			{ "CHAR_ChurchOfLight_Overseer_VBlood", "Sir Magnus the Overseer" },
			{ "CHAR_ChurchOfLight_Paladin_VBlood", "Solarus the Immaculate" },
			{ "CHAR_ChurchOfLight_Sommelier_VBlood", "Baron du Bouchon the Sommelier" },
			{ "CHAR_Forest_Bear_Dire_Vblood", "Ferocious Bear" },
			{ "CHAR_Forest_Wolf_VBlood", "Alpha Wolf" },
			{ "CHAR_Geomancer_Golem_VBlood", "CHAR_Geomancer_Golem_VBlood" },
			{ "CHAR_Gloomrot_Iva_VBlood", "Ziva the Engineer" },
			{ "CHAR_Gloomrot_Monster_VBlood", "Adam the Firstborn" },
			{ "CHAR_Gloomrot_Purifier_VBlood", "Angram the Purifier" },
			{ "CHAR_Gloomrot_RailgunSergeant_VBlood", "Voltatia the Power Master" },
			{ "CHAR_Gloomrot_TheProfessor_VBlood", "Henry Blackbrew the Doctor" },
			{ "CHAR_Gloomrot_Voltage_VBlood", "Domina the Blade Dancer" },
			{ "CHAR_Militia_Glassblower_VBlood", "Grethel the Glassblower" },
			{ "CHAR_Militia_Hound_VBlood", "CHAR_Militia_Hound_VBlood" },
			{ "CHAR_Militia_HoundMaster_VBlood", "CHAR_Militia_HoundMaster_VBlood" },
			{ "CHAR_Militia_Nun_VBlood", "Christina the Sun Priestess" },
			{ "CHAR_Militia_Scribe_VBlood", "Maja the Dark Savant" },
			{ "CHAR_Poloma_VBlood", "Polora the Feywalker" },
			{ "CHAR_Undead_CursedSmith_VBlood", "Cyril the Cursed Smith" },
			{ "CHAR_Undead_Infiltrator_VBlood", "Bane the Shadowblade" },
			{ "CHAR_Undead_Leader_Vblood", "Kriig the Undead General" },
			{ "CHAR_Villager_CursedWanderer_VBlood", "The Old Wanderer" },
			{ "NoPrefabName", "VBlood Boss" }
		};

		public Settings(ConfigFile config)
		{
			CONFIG = config;
			ENABLE_MOD = CONFIG.Bind<bool>("Config", "EnableMod", true, "Enable or disable notifications");
			PVP_KILLS = CONFIG.Bind<bool>("Config", "PVPKills", true, "Enable pvp kill notifications");
			NEW_PLAYER = CONFIG.Bind<bool>("Config", "NewPlayer", true, "Enable new player notifications");
			ADMIN_ONLINE = CONFIG.Bind<bool>("Config", "AdminOnline", true, "Enable admin notifications");
			VBLOOD_KILLS = CONFIG.Bind<bool>("Config", "VBloodKills", true, "Enable vblood kill notifications");
		}

		public void InitConfig()
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Expected O, but got Unknown
			WriteConfig(MESSAGES_PATH, ANNOUNCEMENTS);
			WriteConfig(VBLOOD_PATH, VBLOODS);
			WriteConfig(ADMIN_PATH, STAFF);
			ANNOUNCEMENTS.Clear();
			VBLOODS.Clear();
			STAFF.Clear();
			string json = File.ReadAllText(MESSAGES_PATH);
			Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
			foreach (KeyValuePair<string, string> item in dictionary)
			{
				ANNOUNCEMENTS.Add(item.Key, item.Value);
			}
			json = File.ReadAllText(VBLOOD_PATH);
			dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
			foreach (KeyValuePair<string, string> item2 in dictionary)
			{
				VBLOODS.Add(item2.Key, item2.Value);
			}
			json = File.ReadAllText(ADMIN_PATH);
			dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
			foreach (KeyValuePair<string, string> item3 in dictionary)
			{
				STAFF.Add(item3.Key, item3.Value);
			}
			ManualLogSource logInstance = Plugin.LogInstance;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mod enabled: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(ENABLE_MOD.Value);
			}
			logInstance.LogInfo(val);
			ManualLogSource logInstance2 = Plugin.LogInstance;
			val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("PVP kills enabled: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(PVP_KILLS.Value);
			}
			logInstance2.LogInfo(val);
			ManualLogSource logInstance3 = Plugin.LogInstance;
			val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("New players enabled: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(NEW_PLAYER.Value);
			}
			logInstance3.LogInfo(val);
			ManualLogSource logInstance4 = Plugin.LogInstance;
			val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Admins enabled: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(ADMIN_ONLINE.Value);
			}
			logInstance4.LogInfo(val);
			ManualLogSource logInstance5 = Plugin.LogInstance;
			val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("VBloods enabled: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(VBLOOD_KILLS.Value);
			}
			logInstance5.LogInfo(val);
		}

		public static void WriteConfig(string path, Dictionary<string, string> dic)
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			if (!File.Exists(path))
			{
				string contents = JsonSerializer.Serialize(dic, new JsonSerializerOptions
				{
					WriteIndented = true
				});
				File.WriteAllText(path, contents);
			}
		}

		public bool GetActiveSystem(Systems type)
		{
			if (1 == 0)
			{
			}
			bool result = type switch
			{
				Systems.ENABLE => ENABLE_MOD.Value, 
				Systems.VBLOOD => VBLOOD_KILLS.Value, 
				Systems.PVP => PVP_KILLS.Value, 
				Systems.PLAYERS => NEW_PLAYER.Value, 
				Systems.ADMIN => ADMIN_ONLINE.Value, 
				_ => false, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static string GetVBlood(string key)
		{
			return (key == null || !VBLOODS.ContainsKey(key)) ? VBLOODS["NoPrefabName"] : VBLOODS[key];
		}

		public static string GetMessageTemplate(string key)
		{
			return (key == null || !ANNOUNCEMENTS.ContainsKey(key)) ? key : ANNOUNCEMENTS[key];
		}

		public static string GetStaff(Entity user)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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)
			Player player = new Player(user);
			return (player == null || !STAFF.ContainsKey(player.SteamID.ToString())) ? null : STAFF[player.SteamID.ToString()];
		}

		public static Dictionary<string, string> GetStaff()
		{
			return STAFF;
		}
	}
	public enum Systems
	{
		ENABLE,
		VBLOOD,
		PLAYERS,
		PVP,
		ADMIN
	}
}
namespace BloodyNotify.Hooks
{
	internal class ActionScheduler
	{
		public static readonly List<KillEvent> ACTIONS = new List<KillEvent>();

		public static void HandleNotifyFrame()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			for (int num = ACTIONS.Count - 1; num >= 0; num--)
			{
				if (DateTime.Now - ACTIONS[num].Executed > TimeSpan.FromSeconds(1.0))
				{
					string announcement = VBlood_Hook.GetAnnouncement(ACTIONS[num].VBlood, ACTIONS[num].Killers);
					if (announcement != null && !(announcement == ""))
					{
						ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, announcement);
						ACTIONS.RemoveAt(num);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	internal class GameFrame_Hook
	{
		[HarmonyPatch("ProjectM.GameBootstrap", "Start")]
		[HarmonyPostfix]
		public static void ServerDetours()
		{
			Plugin.LogInstance.LogInfo((object)"Game has bootstrapped. Worlds and systems now exist.");
			GameFrame.Initialize();
		}
	}
	[HarmonyPatch]
	internal class PlayerKilled_Hook
	{
		[HarmonyPatch(typeof(DeathEventListenerSystem), "OnUpdate")]
		[HarmonyPostfix]
		public static void OnUpdate(DeathEventListenerSystem __instance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Settings.GetActiveSystem(Systems.PVP))
			{
				return;
			}
			EntityQuery deathEventQuery = __instance._DeathEventQuery;
			NativeArray<DeathEvent> val = ((EntityQuery)(ref deathEventQuery)).ToComponentDataArray<DeathEvent>((Allocator)2);
			EntityManager entityManager = VWorld.Server.EntityManager;
			Enumerator<DeathEvent> enumerator = val.GetEnumerator();
			PlayerCharacter val2 = default(PlayerCharacter);
			PlayerCharacter val3 = default(PlayerCharacter);
			while (enumerator.MoveNext())
			{
				DeathEvent current = enumerator.Current;
				if (((EntityManager)(ref entityManager)).TryGetComponentData<PlayerCharacter>(current.Died, ref val2) && ((EntityManager)(ref entityManager)).TryGetComponentData<PlayerCharacter>(current.Killer, ref val3))
				{
					Player player = new Player(val2.UserEntity);
					Player player2 = new Player(val3.UserEntity);
					if (player.SteamID != player2.SteamID)
					{
						string text = Settings.GetMessageTemplate("PlayerKilled").Replace("{killer}", player2.Name).Replace("{target}", player.Name);
						ServerChatUtils.SendSystemMessageToAllClients(entityManager, text);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	internal class UserConnected_Hook
	{
		[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")]
		[HarmonyPrefix]
		public static void OnUpdate(ServerBootstrapSystem __instance, NetConnectionId netConnectionId)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId];
			ServerClient val = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num];
			Entity userEntity = val.UserEntity;
			AnnounceNewUser(userEntity);
			AnnounceAdmin(userEntity);
		}

		private static void AnnounceNewUser(Entity user)
		{
			//IL_0018: 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)
			if (Plugin.Settings.GetActiveSystem(Systems.PLAYERS) && PlayerService.IsNewUser(user))
			{
				string messageTemplate = Settings.GetMessageTemplate("NewUser");
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, messageTemplate);
			}
		}

		private static void AnnounceAdmin(Entity user)
		{
			//IL_0019: 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_0022: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.Settings.GetActiveSystem(Systems.ADMIN))
			{
				Player player = new Player(user);
				string staff = Settings.GetStaff(user);
				if (staff != null && !(staff == ""))
				{
					string text = Settings.GetMessageTemplate("StaffOnline").Replace("{role}", staff).Replace("{user}", player.Name);
					ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, text);
				}
			}
		}
	}
	[HarmonyPatch]
	internal class UserDisconnected_Hook
	{
		[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserDisconnected")]
		[HarmonyPrefix]
		public static void OnUpdate(ServerBootstrapSystem __instance, NetConnectionId netConnectionId, ConnectionStatusChangeReason connectionStatusReason)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0049: 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_0052: 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_0060: 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)
			if (Plugin.Settings.GetActiveSystem(Systems.ADMIN) && (int)connectionStatusReason != 17)
			{
				int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId];
				ServerClient val = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num];
				Entity userEntity = val.UserEntity;
				Player player = new Player(userEntity);
				string staff = Settings.GetStaff(userEntity);
				if (staff != null && !(staff == ""))
				{
					string text = Settings.GetMessageTemplate("StaffOffline").Replace("{role}", staff).Replace("{user}", player.Name);
					ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, text);
				}
			}
		}
	}
	[HarmonyPatch]
	internal class VBlood_Hook
	{
		[HarmonyPatch(typeof(VBloodSystem), "OnUpdate")]
		[HarmonyPrefix]
		public static void OnUpdate(VBloodSystem __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0035: 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_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_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_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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0085: 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_008f: 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_0096: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Settings.GetActiveSystem(Systems.VBLOOD) || __instance.EventList.IsEmpty)
			{
				return;
			}
			Enumerator<VBloodConsumed> enumerator = __instance.EventList.GetEnumerator();
			PlayerCharacter val = default(PlayerCharacter);
			while (enumerator.MoveNext())
			{
				VBloodConsumed current = enumerator.Current;
				EntityManager entityManager = VWorld.Server.EntityManager;
				if (!((EntityManager)(ref entityManager)).TryGetComponentData<PlayerCharacter>(current.Target, ref val))
				{
					continue;
				}
				FixedString128 assetName = ((PrefabCollectionSystem_Base)__instance._PrefabCollectionSystem).PrefabDataLookup[current.Source].AssetName;
				Player player = new Player(val.UserEntity);
				bool flag = false;
				foreach (KillEvent aCTION in ActionScheduler.ACTIONS)
				{
					if (aCTION.VBlood == ((object)(FixedString128)(ref assetName)).ToString())
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					KillEvent item = new KillEvent(DateTime.Now, ((object)(FixedString128)(ref assetName)).ToString());
					ActionScheduler.ACTIONS.Add(item);
				}
				for (int i = 0; i < ActionScheduler.ACTIONS.Count; i++)
				{
					if (ActionScheduler.ACTIONS[i].VBlood == ((object)(FixedString128)(ref assetName)).ToString() && !ActionScheduler.ACTIONS[i].Killers.Contains(player.Name))
					{
						ActionScheduler.ACTIONS[i].Killers.Add(player.Name);
					}
				}
			}
		}

		public static string GetAnnouncement(string vblood, List<string> killers)
		{
			string vBlood = Settings.GetVBlood(vblood);
			StringBuilder stringBuilder = new StringBuilder();
			if (killers.Count == 0)
			{
				return "";
			}
			for (int i = 0; i < killers.Count; i++)
			{
				stringBuilder.Append(killers[i]);
				if (i < killers.Count - 2)
				{
					StringBuilder stringBuilder2 = stringBuilder;
					StringBuilder stringBuilder3 = stringBuilder2;
					StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(1, 1, stringBuilder2);
					handler.AppendFormatted(Settings.GetMessageTemplate("comma"));
					handler.AppendLiteral(" ");
					stringBuilder3.Append(ref handler);
				}
				else if (i < killers.Count - 1)
				{
					StringBuilder stringBuilder2 = stringBuilder;
					StringBuilder stringBuilder4 = stringBuilder2;
					StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(2, 1, stringBuilder2);
					handler.AppendLiteral(" ");
					handler.AppendFormatted(Settings.GetMessageTemplate("append"));
					handler.AppendLiteral(" ");
					stringBuilder4.Append(ref handler);
				}
			}
			return Settings.GetMessageTemplate("VBlood").Replace("{user}", stringBuilder.ToString()).Replace("{vblood}", vBlood);
		}
	}
}
namespace BloodyNotify.Commands
{
	internal class AdminsCmd
	{
		[Command("admins", "a", null, "Shows online Staff members.", null, false)]
		public static void WhoIsOnline(ChatCommandContext ctx)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			IEnumerable<Entity> usersOnline = PlayerService.GetUsersOnline();
			Dictionary<string, string> staff = Settings.GetStaff();
			StringBuilder stringBuilder = new StringBuilder();
			foreach (Entity item in usersOnline)
			{
				Player player = new Player(item);
				foreach (KeyValuePair<string, string> item2 in staff)
				{
					if (player.SteamID.ToString() == item2.Key)
					{
						string value = item2.Value.Replace("</color>", "");
						stringBuilder.Append(value).Append(player.Name).Append("</color>");
						stringBuilder.Append(' ');
					}
				}
			}
			if (stringBuilder.Length == 0)
			{
				ctx.Reply("There is no staff online.");
			}
			else
			{
				ctx.Reply("Active staff: " + stringBuilder.ToString());
			}
		}
	}
	[CommandGroup("notify", null)]
	internal class ReloadCmd
	{
		[Command("reload", "rl", null, "Reloads the config of BloodyNotify.", null, true)]
		public static void ReloadNotify(ChatCommandContext ctx)
		{
			Plugin.Settings.InitConfig();
			ctx.Reply("BloodyNotify config reloaded!");
		}
	}
}