Decompiled source of KindredArenas v1.4.0

KindredArenas.dll

Decompiled a week ago
using System;
using System.Collections;
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 System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using KindredArenas.Data;
using KindredArenas.Services;
using KindredArenass.Commands.Converters;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Shared;
using ProjectM.Terrain;
using Stunlock.Core;
using Stunlock.Network;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("KindredArenas")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("PvP protection everywhere but specified areas")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+8fb443d3ce0188c91214ca45aeb3768189b4fba8")]
[assembly: AssemblyProduct("KindredArenas")]
[assembly: AssemblyTitle("KindredArenas")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class Float2Converter : JsonConverter<float2>
{
	public override float2 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if (reader.TokenType != JsonTokenType.StartArray)
		{
			throw new JsonException();
		}
		reader.Read();
		float single = reader.GetSingle();
		reader.Read();
		float single2 = reader.GetSingle();
		reader.Read();
		return new float2(single, single2);
	}

	public override void Write(Utf8JsonWriter writer, float2 value, JsonSerializerOptions options)
	{
		//IL_0007: 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)
		writer.WriteStartArray();
		writer.WriteNumberValue(value.x);
		writer.WriteNumberValue(value.y);
		writer.WriteEndArray();
	}
}
namespace KindredArenass.Commands.Converters
{
	public record struct FoundRegion(WorldRegionType Value, string Name)
	{
		[CompilerGenerated]
		private readonly bool PrintMembers(StringBuilder builder)
		{
			//IL_000e: 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)
			builder.Append("Value = ");
			WorldRegionType value = Value;
			builder.Append(((object)(WorldRegionType)(ref value)).ToString());
			builder.Append(", Name = ");
			builder.Append((object?)Name);
			return true;
		}

		[CompilerGenerated]
		public readonly void Deconstruct(out WorldRegionType Value, out string Name)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected I4, but got Unknown
			Value = (WorldRegionType)(int)this.Value;
			Name = this.Name;
		}
	}
	public class FoundRegionConverter : CommandArgumentConverter<FoundRegion>
	{
		public override FoundRegion Parse(ICommandContext ctx, string input)
		{
			//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_0033: 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)
			WorldRegionType val = Enum.GetValues(typeof(WorldRegionType)).Cast<WorldRegionType>().FirstOrDefault((Func<WorldRegionType, bool>)((WorldRegionType x) => ((object)(WorldRegionType)(ref x)).ToString().Equals(input, StringComparison.OrdinalIgnoreCase)));
			if ((int)val != 0)
			{
				return new FoundRegion(val, ((object)(WorldRegionType)(ref val)).ToString());
			}
			input = input.ToLowerInvariant();
			switch (input)
			{
			case "start":
				return new FoundRegion((WorldRegionType)2, "StartCave");
			case "woods":
			case "farbane":
				return new FoundRegion((WorldRegionType)3, "FarbaneWoods");
			case "dunley":
			case "farmlands":
				return new FoundRegion((WorldRegionType)4, "DunleyFarmlands");
			case "cursed":
			case "forest":
				return new FoundRegion((WorldRegionType)5, "CursedForest");
			case "mountains":
			case "hallowed":
			case "mountain":
				return new FoundRegion((WorldRegionType)6, "HallowedMountain");
			case "hills":
			case "silverlight":
				return new FoundRegion((WorldRegionType)7, "SilverlightHills");
			case "south":
			case "gloomrotsouth":
			case "gloomrot south":
				return new FoundRegion((WorldRegionType)8, "Gloomrot_South");
			case "north":
			case "gloomrotnorth":
			case "gloomrot north":
				return new FoundRegion((WorldRegionType)9, "Gloomrot_North");
			case "ruins":
			case "mortium":
			case "ruinsofmortium":
				return new FoundRegion((WorldRegionType)10, "RuinsOfMortium");
			case "oakveil":
			case "oakveil woodlands":
			case "oakveilwoodlands":
				return new FoundRegion((WorldRegionType)11, "Strongblade (Oakveil)");
			case "none":
				return new FoundRegion((WorldRegionType)0, "None");
			default:
				throw ctx.Error("Could not find region");
			}
		}
	}
}
namespace KindredArenas
{
	internal class Buffs
	{
		public static bool AddBuff(Entity User, Entity Character, PrefabGUID buffPrefab, int duration = 0, bool immortal = true)
		{
			//IL_000d: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_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)
			//IL_0038: 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_0044: 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_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_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0091: 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_00a1: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_00ea: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>();
			ApplyBuffDebugEvent val = default(ApplyBuffDebugEvent);
			val.BuffPrefabGUID = buffPrefab;
			ApplyBuffDebugEvent val2 = val;
			FromCharacter val3 = default(FromCharacter);
			val3.User = User;
			val3.Character = Character;
			FromCharacter val4 = val3;
			Entity entity = default(Entity);
			if (!BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity))
			{
				existingSystemManaged.ApplyBuff(val4, val2);
				if (BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity))
				{
					if (entity.Has<CreateGameplayEventsOnSpawn>())
					{
						entity.Remove<CreateGameplayEventsOnSpawn>();
					}
					if (entity.Has<GameplayEventListeners>())
					{
						entity.Remove<GameplayEventListeners>();
					}
					if (immortal)
					{
						entity.Add<Buff_Persists_Through_Death>();
						if (entity.Has<RemoveBuffOnGameplayEvent>())
						{
							entity.Remove<RemoveBuffOnGameplayEvent>();
						}
						if (entity.Has<RemoveBuffOnGameplayEventEntry>())
						{
							entity.Remove<RemoveBuffOnGameplayEventEntry>();
						}
					}
					if (duration > -1 && duration != 0)
					{
						if (!entity.Has<LifeTime>())
						{
							entity.Add<LifeTime>();
							entity.Write<LifeTime>(new LifeTime
							{
								EndAction = (LifeTimeEndAction)2
							});
						}
						LifeTime componentData = entity.Read<LifeTime>();
						componentData.Duration = duration;
						entity.Write<LifeTime>(componentData);
					}
					else if (duration == -1)
					{
						if (entity.Has<LifeTime>())
						{
							LifeTime componentData2 = entity.Read<LifeTime>();
							componentData2.Duration = -1f;
							componentData2.EndAction = (LifeTimeEndAction)0;
							entity.Write<LifeTime>(componentData2);
						}
						if (entity.Has<RemoveBuffOnGameplayEvent>())
						{
							entity.Remove<RemoveBuffOnGameplayEvent>();
						}
						if (entity.Has<RemoveBuffOnGameplayEventEntry>())
						{
							entity.Remove<RemoveBuffOnGameplayEventEntry>();
						}
					}
					return true;
				}
				return false;
			}
			return false;
		}

		public static void RemoveBuff(Entity Character, PrefabGUID buffPrefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Entity val = default(Entity);
			if (BuffUtility.TryGetBuff<EntityManager>(Core.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref val))
			{
				DestroyUtility.Destroy(Core.EntityManager, val, (DestroyDebugReason)13, (string)null, 0);
			}
		}

		public static bool HasBuff(Entity Character, PrefabGUID buffPrefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Entity val = default(Entity);
			return BuffUtility.TryGetBuff<EntityManager>(Core.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref val);
		}

		public static float GetBuffDuration(Entity Character, PrefabGUID buffPrefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			Entity entity = default(Entity);
			if (!BuffUtility.TryGetBuff<EntityManager>(Core.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity))
			{
				return 0f;
			}
			if (entity.Has<LifeTime>())
			{
				return entity.Read<LifeTime>().Duration;
			}
			return -1f;
		}
	}
	[CommandGroup("arena", null)]
	internal class ArenaCommands
	{
		[Command("on", null, null, "Turns on PvP arenas", null, true)]
		public static void PvPArenaOn(ChatCommandContext ctx)
		{
			Core.PvpArenaService.EnablePvpArenas();
			ctx.Reply("PvP arena turned on");
		}

		[Command("off", null, null, "Turns off PvP arenas", null, true)]
		public static void PvPArenaOff(ChatCommandContext ctx)
		{
			Core.PvpArenaService.DisablePvpArenas();
			ctx.Reply("PvP arena turned off");
		}

		[Command("create", "add", null, "Creates a PvP arena centered at your current location", null, true)]
		public static void CreatePvPArena(ChatCommandContext ctx, string name, float radius)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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)
			Translation val = ctx.Event.SenderCharacterEntity.Read<Translation>();
			float2 xz = ((float3)(ref val.Value)).xz;
			if (Core.PvpArenaService.CreateZone(name, xz, radius))
			{
				ctx.Reply($"PvP arena '{name}' created at ({xz.x}, {xz.y}) with a radius of {radius}");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' already exists");
			}
		}

		[Command("remove", "delete", null, "Removes a PvP arena", null, true)]
		public static void RemovePvPArena(ChatCommandContext ctx, string name)
		{
			if (Core.PvpArenaService.RemoveZone(name))
			{
				ctx.Reply("PvP arena '" + name + "' removed");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' not found");
			}
		}

		[Command("list", null, null, "Lists all PvP arenas", null, true)]
		public static void ListPvPArenas(ChatCommandContext ctx)
		{
			//IL_005f: 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)
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("PvP Arenas");
			int num = 0;
			foreach (BaseZoneService.Zone zone in Core.PvpArenaService.GetZones())
			{
				StringBuilder stringBuilder2 = stringBuilder;
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(36, 5, stringBuilder2);
				handler.AppendFormatted(zone.Name);
				handler.AppendLiteral(" - Location: (");
				handler.AppendFormatted(zone.Location.x);
				handler.AppendLiteral(", ");
				handler.AppendFormatted(zone.Location.y);
				handler.AppendLiteral(") Radius: ");
				handler.AppendFormatted(zone.Radius);
				handler.AppendLiteral(" Enabled: ");
				handler.AppendFormatted(zone.Enabled);
				stringBuilder2.AppendLine(ref handler);
				num++;
				if (num % 7 == 0)
				{
					ctx.Reply(stringBuilder.ToString());
					stringBuilder.Clear();
				}
			}
			if (stringBuilder.Length > 0)
			{
				ctx.Reply(stringBuilder.ToString());
			}
		}

		[Command("center", null, null, "Changes the center of a PvP arena", null, true)]
		public static void ChangePvPArenaCenter(ChatCommandContext ctx, string name)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			Translation val = ctx.Event.SenderCharacterEntity.Read<Translation>();
			float2 xz = ((float3)(ref val.Value)).xz;
			if (Core.PvpArenaService.ChangeZoneCenter(name, xz))
			{
				ctx.Reply($"PvP arena '{name}' center changed to ({xz.x}, {xz.y})");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' not found");
			}
		}

		[Command("radius", null, null, "Changes the radius of a PvP arena", null, true)]
		public static void ChangePvPArenaRadius(ChatCommandContext ctx, string name, float? radius = null)
		{
			//IL_0069: 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)
			//IL_0073: 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 (radius.HasValue && Core.PvpArenaService.ChangeZoneRadius(name, radius.Value))
			{
				ctx.Reply($"PvP arena '{name}' radius changed to {radius}");
				return;
			}
			PvpArenaService pvpArenaService = Core.PvpArenaService;
			Translation val = ctx.Event.SenderCharacterEntity.Read<Translation>();
			if (pvpArenaService.ChangeZoneRadius(name, ((float3)(ref val.Value)).xz, out var newRadius))
			{
				ctx.Reply($"PvP arena '{name}' radius changed to {newRadius}");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' not found");
			}
		}

		[Command("enable", null, null, "Enables a PvP arena", null, true)]
		public static void EnablePvPArena(ChatCommandContext ctx, string name)
		{
			if (Core.PvpArenaService.EnableZone(name))
			{
				ctx.Reply("PvP arena '" + name + "' enabled");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' not found");
			}
		}

		[Command("disable", null, null, "Disables a PvP arena", null, true)]
		public static void DisablePvPArena(ChatCommandContext ctx, string name)
		{
			if (Core.PvpArenaService.DisableZone(name))
			{
				ctx.Reply("PvP arena '" + name + "' disabled");
			}
			else
			{
				ctx.Reply("PvP arena '" + name + "' not found");
			}
		}

		[Command("teleport", "tp", null, "Teleports you to the named PvP arena", null, true)]
		public static void TeleportToPvPArena(ChatCommandContext ctx, string name)
		{
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0083: 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_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00d0: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			string nameLower = name.ToLowerInvariant();
			if (!Core.PvpArenaService.GetZones().Any((BaseZoneService.Zone x) => x.Name.ToLowerInvariant() == nameLower))
			{
				ctx.Reply("No PvP arena found matching '" + name + "'");
				return;
			}
			float2 location = Core.PvpArenaService.GetZones().First((BaseZoneService.Zone x) => x.Name.ToLowerInvariant() == nameLower).Location;
			EntityManager entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).GetComponentData<Translation>(ctx.Event.SenderCharacterEntity);
			entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<LastTranslation>(ctx.Event.SenderCharacterEntity, new LastTranslation
			{
				Value = new float3(location.x, 0f, location.y)
			});
			entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<Translation>(ctx.Event.SenderCharacterEntity, new Translation
			{
				Value = new float3(location.x, 0f, location.y)
			});
			ctx.Reply("Teleported to PvP arena");
		}
	}
	internal static class Core
	{
		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 ServerGameSettingsSystem ServerGameSettingsSystem { get; private set; }

		public static ManualLogSource Log { get; } = Plugin.PluginLog;


		public static PvpService PvpService { get; internal set; }

		public static PvpArenaService PvpArenaService { get; internal set; }

		public static PvpRegionsService PvpRegionsService { get; internal set; }

		public static ElysiumService ElysiumService { get; internal set; }

		public static bool HasInitialized => _hasInitialized;

		public static void LogException(Exception e, [CallerMemberName] string caller = null)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if (!_hasInitialized)
			{
				ServerGameSettingsSystem = Server.GetExistingSystemManaged<ServerGameSettingsSystem>();
				PvpService = new PvpService();
				PvpArenaService = new PvpArenaService();
				PvpRegionsService = new PvpRegionsService();
				ElysiumService = new ElysiumService();
				_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 class Float2Converter : JsonConverter<float2>
	{
		public override float2 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (reader.TokenType != JsonTokenType.StartArray)
			{
				throw new JsonException();
			}
			reader.Read();
			float single = reader.GetSingle();
			reader.Read();
			float single2 = reader.GetSingle();
			reader.Read();
			return new float2(single, single2);
		}

		public override void Write(Utf8JsonWriter writer, float2 value, JsonSerializerOptions options)
		{
			//IL_0007: 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)
			writer.WriteStartArray();
			writer.WriteNumberValue(value.x);
			writer.WriteNumberValue(value.y);
			writer.WriteEndArray();
		}
	}
	public static class ECSExtensions
	{
		public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
		{
			//IL_0030: 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_0039: 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_003b: 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 = Core.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_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_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_0017: 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 = Core.EntityManager;
			return Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex)));
		}

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

		public static string LookupName(this PrefabGUID prefabGuid)
		{
			//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_0016: 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_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_0030: Unknown result type (might be due to invalid IL or missing references)
			PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>();
			NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = existingSystemManaged._PrefabLookupMap.GuidToEntityMap;
			if (!guidToEntityMap.ContainsKey(prefabGuid))
			{
				return "GUID Not Found";
			}
			PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap;
			return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid) + " PrefabGuid(" + ((PrefabGUID)(ref prefabGuid)).GuidHash + ")";
		}

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

		public static void Remove<T>(this Entity entity)
		{
			//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_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)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
		}
	}
	internal class Helper
	{
		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0010: 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_0013: 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)
			//IL_001b: 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_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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0044: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0073: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0027: 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_002e: 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[2]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0),
				new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0)
			});
			val2.Options = val;
			EntityQueryDesc val3 = val2;
			EntityManager entityManager = Core.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 NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0010: 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_0013: 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)
			//IL_001b: 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_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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0044: 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_0059: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0082: 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_002d: 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)
			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 = Core.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 void SendSystemMessageToClient(EntityManager entityManager, User user, string message)
		{
			//IL_0008: 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)
			FixedString512Bytes val = default(FixedString512Bytes);
			((FixedString512Bytes)(ref val))..ctor(message);
			ServerChatUtils.SendSystemMessageToClient(entityManager, user, ref val);
		}
	}
	[BepInPlugin("KindredArenas", "KindredArenas", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		private static Harmony _harmony;

		internal static ManualLogSource PluginLog;

		public static Harmony Harmony => _harmony;

		public static ManualLogSource LogInstance { get; private set; }

		public override void Load()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			PluginLog = ((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>("KindredArenas");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.4.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			_harmony = new Harmony("KindredArenas");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			CommandRegistry.RegisterAll();
		}

		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 = "KindredArenas";

		public const string PLUGIN_NAME = "KindredArenas";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace KindredArenas.Services
{
	internal abstract class BaseZoneService
	{
		public struct Zone
		{
			public string Name { get; set; }

			public float2 Location { get; set; }

			public float Radius { get; set; }

			public bool Enabled { get; set; }
		}

		protected static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "KindredArenas");

		private readonly List<Zone> zones;

		protected abstract string ZONES_PATH { get; }

		protected abstract string ZONE_SERVICE_NAME { get; }

		public BaseZoneService()
		{
			zones = GetDefaultZones();
			LoadZones();
		}

		protected virtual List<Zone> GetDefaultZones()
		{
			return new List<Zone>();
		}

		public IEnumerable<Zone> GetZones()
		{
			return zones;
		}

		private void LoadZones()
		{
			if (File.Exists(ZONES_PATH))
			{
				string json = File.ReadAllText(ZONES_PATH);
				zones.Clear();
				zones.AddRange(JsonSerializer.Deserialize<Zone[]>(json, new JsonSerializerOptions
				{
					Converters = { (JsonConverter)new Float2Converter() }
				}));
			}
			else
			{
				SaveZones();
			}
		}

		private void SaveZones()
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			JsonSerializerOptions options = new JsonSerializerOptions
			{
				Converters = { (JsonConverter)new Float2Converter() },
				WriteIndented = true
			};
			string contents = JsonSerializer.Serialize(zones, options);
			File.WriteAllText(ZONES_PATH, contents);
		}

		private bool RetrieveZone(string name, out Zone zone, out int zoneIndex)
		{
			name = name.ToLowerInvariant();
			zone = zones.Find((Zone z) => z.Name.ToLowerInvariant() == name);
			zoneIndex = zones.IndexOf(zone);
			return zoneIndex != -1;
		}

		public bool CreateZone(string name, float2 location, float radius)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			if (RetrieveZone(name, out var zone, out var _))
			{
				return false;
			}
			zone = default(Zone);
			zone.Name = name;
			zone.Location = ((float2)(ref location)).xy;
			zone.Radius = radius;
			zone.Enabled = true;
			Zone item = zone;
			zones.Add(item);
			SaveZones();
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' created at ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float2>(location);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with a radius of ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(radius);
			}
			log.LogInfo(val);
			return true;
		}

		public bool RemoveZone(string name)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			string nameLower = name.ToLowerInvariant();
			int num = zones.RemoveAll((Zone z) => z.Name.ToLowerInvariant() == nameLower);
			if (num > 0)
			{
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' removed");
				}
				log.LogInfo(val);
			}
			SaveZones();
			return num > 0;
		}

		public bool ChangeZoneCenter(string name, float2 location)
		{
			//IL_0011: 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
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!RetrieveZone(name, out var zone, out var zoneIndex))
			{
				return false;
			}
			zone.Location = location;
			zones[zoneIndex] = zone;
			SaveZones();
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' center changed to ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float2>(location);
			}
			log.LogInfo(val);
			return true;
		}

		public bool ChangeZoneRadius(string name, float radius)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!RetrieveZone(name, out var zone, out var zoneIndex))
			{
				return false;
			}
			zone.Radius = radius;
			zones[zoneIndex] = zone;
			SaveZones();
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' radius changed to ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(radius);
			}
			log.LogInfo(val);
			return true;
		}

		public bool ChangeZoneRadius(string name, float2 location, out float newRadius)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			if (!RetrieveZone(name, out var zone, out var zoneIndex))
			{
				newRadius = 0f;
				return false;
			}
			zone.Radius = Vector2.Distance(float2.op_Implicit(location), float2.op_Implicit(zone.Location));
			zones[zoneIndex] = zone;
			SaveZones();
			newRadius = zone.Radius;
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' radius changed to ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(newRadius);
			}
			log.LogInfo(val);
			return true;
		}

		public bool EnableZone(string name)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!RetrieveZone(name, out var zone, out var zoneIndex))
			{
				return false;
			}
			zone.Enabled = true;
			zones[zoneIndex] = zone;
			SaveZones();
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' enabled");
			}
			log.LogInfo(val);
			return true;
		}

		public bool DisableZone(string name)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!RetrieveZone(name, out var zone, out var zoneIndex))
			{
				return false;
			}
			zone.Enabled = false;
			zones[zoneIndex] = zone;
			SaveZones();
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ZONE_SERVICE_NAME);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zone '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' disabled");
			}
			log.LogInfo(val);
			return true;
		}

		public bool IsInZone(float2 pos)
		{
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			foreach (Zone zone in zones)
			{
				if (zone.Enabled && Vector2.Distance(float2.op_Implicit(zone.Location), float2.op_Implicit(pos)) < zone.Radius)
				{
					return true;
				}
			}
			return false;
		}
	}
	internal class ElysiumService : BaseZoneService
	{
		protected override string ZONES_PATH => Path.Combine(BaseZoneService.CONFIG_PATH, "elysium.json");

		protected override string ZONE_SERVICE_NAME => "ElysiumService";

		public bool PvpElysiumOn { get; private set; }

		public ElysiumService()
		{
			PvpElysiumOn = true;
		}

		public void EnableElysiums()
		{
			PvpElysiumOn = true;
			Core.Log.LogInfo((object)"Elysiums enabled");
		}

		public void DisableElysiums()
		{
			PvpElysiumOn = false;
			Core.Log.LogInfo((object)"Elysiums disabled");
		}
	}
	internal class PrefabService
	{
		private readonly PrefabCollectionSystem collectionSystem;

		public PrefabCollectionSystem CollectionSystem => collectionSystem;

		internal Dictionary<string, (string Name, PrefabGUID Prefab)> AllNameToGuid { get; init; } = new Dictionary<string, (string, PrefabGUID)>();


		internal Dictionary<string, (string Name, PrefabGUID Prefab)> SpawnableNameToGuid { get; init; } = new Dictionary<string, (string, PrefabGUID)>();


		internal PrefabService()
		{
			//IL_0032: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//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_0057: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			collectionSystem = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>();
			NativeParallelHashMap<PrefabGUID, Entity> prefabGuidToEntityMap = collectionSystem._PrefabGuidToEntityMap;
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(13, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("All prefabs: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Func<int>>((Func<int>)((NativeParallelHashMap<PrefabGUID, Entity>)prefabGuidToEntityMap).Count);
			}
			log.LogDebug(val);
			Enumerator<PrefabGUID, Entity> enumerator = prefabGuidToEntityMap.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValue<PrefabGUID, Entity> current = enumerator.Current;
				string text = current.Key.LookupName();
				if (!AllNameToGuid.TryAdd(text.ToLowerInvariant(), (text, current.Key)))
				{
					ManualLogSource log2 = Core.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(25, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<PrefabGUID>(current.Key);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" exist already, skipping.");
					}
					log2.LogDebug(val);
				}
			}
			Dictionary<string, PrefabGUID> spawnableNameToPrefabGuidDictionary = collectionSystem.SpawnableNameToPrefabGuidDictionary;
			ManualLogSource log3 = Core.Log;
			val = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Spawnable prefabs: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(spawnableNameToPrefabGuidDictionary.Count);
			}
			log3.LogDebug(val);
			Enumerator<string, PrefabGUID> enumerator2 = spawnableNameToPrefabGuidDictionary.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				KeyValuePair<string, PrefabGUID> current2 = enumerator2.Current;
				if (!SpawnableNameToGuid.TryAdd(current2.Key.ToLowerInvariant(), (current2.Key, current2.Value)))
				{
					ManualLogSource log4 = Core.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(25, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(current2.Key);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" exist already, skipping.");
					}
					log4.LogDebug(val);
				}
			}
		}

		internal bool TryGetBuff(string input, out PrefabGUID prefab)
		{
			//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)
			string text = input.ToLowerInvariant();
			(string, PrefabGUID) value;
			bool num = AllNameToGuid.TryGetValue(text, out value) || AllNameToGuid.TryGetValue("buff_" + text, out value) || AllNameToGuid.TryGetValue("equipbuff_" + text, out value);
			prefab = value.Item2;
			if (num)
			{
				return value.Item1.ToLowerInvariant().Contains("buff");
			}
			return false;
		}

		internal bool TryGetItem(string input, out PrefabGUID prefab)
		{
			//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)
			string text = input.ToLowerInvariant();
			(string, PrefabGUID) value;
			bool result = SpawnableNameToGuid.TryGetValue(text, out value) || SpawnableNameToGuid.TryGetValue("item_" + text, out value);
			prefab = value.Item2;
			return result;
		}
	}
	internal class PvpArenaService : BaseZoneService
	{
		protected override string ZONES_PATH => Path.Combine(BaseZoneService.CONFIG_PATH, "arenas.json");

		protected override string ZONE_SERVICE_NAME => "PvpArenaService";

		public bool PvpArenasOn { get; private set; }

		public PvpArenaService()
		{
			PvpArenasOn = true;
		}

		protected override List<Zone> GetDefaultZones()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return new List<Zone>(1)
			{
				new Zone
				{
					Name = "Colliseum",
					Location = new float2(-1002.2413f, -514.1175f),
					Radius = 18f,
					Enabled = true
				}
			};
		}

		public void EnablePvpArenas()
		{
			PvpArenasOn = true;
			Core.Log.LogInfo((object)"PvP arenas enabled");
		}

		public void DisablePvpArenas()
		{
			PvpArenasOn = false;
			Core.Log.LogInfo((object)"PvP arenas disabled");
		}
	}
	internal class PvpRegionsService
	{
		public enum PvpRegionType
		{
			BasedOnCurrentPvPState,
			AlwaysPvP,
			AlwaysPvE
		}

		public class PvpRegionTypeConverter : JsonConverter<PvpRegionType>
		{
			public override PvpRegionType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
			{
				if (reader.TokenType != JsonTokenType.String)
				{
					throw new JsonException($"Expected String Type not {reader.TokenType} for PvpRegionType");
				}
				string @string = reader.GetString();
				if (!Enum.TryParse<PvpRegionType>(@string, out var result))
				{
					throw new JsonException("Invalid PvpRegionType: " + @string);
				}
				return result;
			}

			public override void Write(Utf8JsonWriter writer, PvpRegionType value, JsonSerializerOptions options)
			{
				writer.WriteStringValue(value.ToString());
			}
		}

		[CompilerGenerated]
		private sealed class <GetRegionStates>d__7 : IEnumerable<(WorldRegionType region, PvpRegionType state)>, IEnumerable, IEnumerator<(WorldRegionType region, PvpRegionType state)>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private (WorldRegionType region, PvpRegionType state) <>2__current;

			private int <>l__initialThreadId;

			public PvpRegionsService <>4__this;

			private Dictionary<WorldRegionType, PvpRegionType>.Enumerator <>7__wrap1;

			(WorldRegionType, PvpRegionType) IEnumerator<(WorldRegionType, PvpRegionType)>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

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

			[DebuggerHidden]
			public <GetRegionStates>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = default(Dictionary<WorldRegionType, PvpRegionType>.Enumerator);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					int num = <>1__state;
					PvpRegionsService pvpRegionsService = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = pvpRegionsService.regionPvpSetting.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						KeyValuePair<WorldRegionType, PvpRegionType> current = <>7__wrap1.Current;
						<>2__current = (current.Key, current.Value);
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = default(Dictionary<WorldRegionType, PvpRegionType>.Enumerator);
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>7__wrap1).Dispose();
			}

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

			[DebuggerHidden]
			IEnumerator<(WorldRegionType region, PvpRegionType state)> IEnumerable<(WorldRegionType, PvpRegionType)>.GetEnumerator()
			{
				<GetRegionStates>d__7 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <GetRegionStates>d__7(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<(WorldRegionType, PvpRegionType)>)this).GetEnumerator();
			}
		}

		protected static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "KindredArenas");

		protected static readonly string REGIONS_PATH = Path.Combine(CONFIG_PATH, "pvpRegions.json");

		private Dictionary<WorldRegionType, PvpRegionType> regionPvpSetting = new Dictionary<WorldRegionType, PvpRegionType>();

		public PvpRegionsService()
		{
			LoadPvpRegions();
		}

		private void LoadPvpRegions()
		{
			if (File.Exists(REGIONS_PATH))
			{
				string json = File.ReadAllText(REGIONS_PATH);
				regionPvpSetting = JsonSerializer.Deserialize<Dictionary<WorldRegionType, PvpRegionType>>(json, new JsonSerializerOptions
				{
					Converters = { (JsonConverter)new PvpRegionTypeConverter() }
				});
			}
			else
			{
				SavePvpRegions();
			}
		}

		private void SavePvpRegions()
		{
			string contents = JsonSerializer.Serialize(regionPvpSetting, new JsonSerializerOptions
			{
				WriteIndented = true,
				Converters = { (JsonConverter)new PvpRegionTypeConverter() }
			});
			File.WriteAllText(REGIONS_PATH, contents);
		}

		[IteratorStateMachine(typeof(<GetRegionStates>d__7))]
		public IEnumerable<(WorldRegionType region, PvpRegionType state)> GetRegionStates()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetRegionStates>d__7(-2)
			{
				<>4__this = this
			};
		}

		public PvpRegionType GetPlayerRegionPvpState(Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_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_001c: Unknown result type (might be due to invalid IL or missing references)
			WorldRegionType currentRegion = entity.Read<PlayerCharacter>().UserEntity.Read<CurrentWorldRegion>().CurrentRegion;
			if (!regionPvpSetting.TryGetValue(currentRegion, out var value))
			{
				return PvpRegionType.BasedOnCurrentPvPState;
			}
			return value;
		}

		public void SetRegionPvpState(WorldRegionType region, PvpRegionType pvpSetting)
		{
			//IL_0018: 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)
			if (pvpSetting == PvpRegionType.BasedOnCurrentPvPState)
			{
				regionPvpSetting.Remove(region);
			}
			else
			{
				regionPvpSetting[region] = pvpSetting;
			}
			SavePvpRegions();
		}
	}
	public enum DaysOfTheWeek
	{
		Sunday = 1,
		Monday = 2,
		Tuesday = 4,
		Wednesday = 8,
		Thursday = 0x10,
		Friday = 0x20,
		Saturday = 0x40
	}
	internal class PvpService
	{
		public struct PvpTime
		{
			public DaysOfTheWeek DaysOfTheWeek { get; set; }

			public int StartHour { get; set; }

			public int StartMinute { get; set; }

			public int EndHour { get; set; }

			public int EndMinute { get; set; }
		}

		protected static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "KindredArenas");

		protected static readonly string PVP_TIMES_PATH = Path.Combine(CONFIG_PATH, "pvpTimes.json");

		private static readonly Dictionary<DaysOfTheWeek, DaysOfTheWeek> PREVIOUS_DAY = new Dictionary<DaysOfTheWeek, DaysOfTheWeek>
		{
			{
				DaysOfTheWeek.Sunday,
				DaysOfTheWeek.Saturday
			},
			{
				DaysOfTheWeek.Monday,
				DaysOfTheWeek.Sunday
			},
			{
				DaysOfTheWeek.Tuesday,
				DaysOfTheWeek.Monday
			},
			{
				DaysOfTheWeek.Wednesday,
				DaysOfTheWeek.Tuesday
			},
			{
				DaysOfTheWeek.Thursday,
				DaysOfTheWeek.Wednesday
			},
			{
				DaysOfTheWeek.Friday,
				DaysOfTheWeek.Thursday
			},
			{
				DaysOfTheWeek.Saturday,
				DaysOfTheWeek.Friday
			}
		};

		private readonly List<Entity> users = new List<Entity>();

		private readonly List<PvpTime> pvpTimes = new List<PvpTime>();

		private bool isPvpActive;

		private const float ALERT_COOLDOWN = 2.5f;

		private readonly Dictionary<Entity, float> lastAlertedPlayer = new Dictionary<Entity, float>();

		private readonly HashSet<Entity> messagedHasBuffFromZone = new HashSet<Entity>();

		private readonly HashSet<Entity> inPveRegion = new HashSet<Entity>();

		private readonly HashSet<Entity> inPvpRegion = new HashSet<Entity>();

		public PvpService()
		{
			//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_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_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_0066: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<Entity> enumerator = Helper.GetEntitiesByComponentType<User>().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				AddUser(current);
			}
			LoadPvpTimes();
		}

		public IEnumerable<PvpTime> GetPvpTimes()
		{
			return pvpTimes;
		}

		private void LoadPvpTimes()
		{
			if (File.Exists(PVP_TIMES_PATH))
			{
				string json = File.ReadAllText(PVP_TIMES_PATH);
				pvpTimes.Clear();
				pvpTimes.AddRange(JsonSerializer.Deserialize<PvpTime[]>(json, new JsonSerializerOptions
				{
					Converters = { (JsonConverter)new DaysOfTheWeekConverter() }
				}));
			}
			else
			{
				SavePvpTimes();
			}
		}

		private void SavePvpTimes()
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			JsonSerializerOptions options = new JsonSerializerOptions
			{
				Converters = { (JsonConverter)new DaysOfTheWeekConverter() },
				WriteIndented = true
			};
			string contents = JsonSerializer.Serialize(pvpTimes, options);
			File.WriteAllText(PVP_TIMES_PATH, contents);
		}

		public void AddPvpTime(PvpTime pvpTime)
		{
			pvpTimes.Add(pvpTime);
			pvpTimes.Sort(delegate(PvpTime a, PvpTime b)
			{
				DaysOfTheWeek daysOfTheWeek2 = FirstDay(a.DaysOfTheWeek);
				DaysOfTheWeek daysOfTheWeek3 = FirstDay(b.DaysOfTheWeek);
				if (daysOfTheWeek2 != daysOfTheWeek3)
				{
					return daysOfTheWeek2.CompareTo(daysOfTheWeek3);
				}
				return (a.StartHour != b.StartHour) ? a.StartHour.CompareTo(b.StartHour) : a.StartMinute.CompareTo(b.StartMinute);
			});
			SavePvpTimes();
			static DaysOfTheWeek FirstDay(DaysOfTheWeek days)
			{
				for (int i = 0; i < 7; i++)
				{
					DaysOfTheWeek daysOfTheWeek = (DaysOfTheWeek)(1 << i);
					if (days.HasFlag(daysOfTheWeek))
					{
						return daysOfTheWeek;
					}
				}
				return (DaysOfTheWeek)0;
			}
		}

		public bool RemovePvpTime(int pvpTimeIndex)
		{
			if (pvpTimeIndex < 0 || pvpTimeIndex >= pvpTimes.Count)
			{
				return false;
			}
			pvpTimes.RemoveAt(pvpTimeIndex);
			SavePvpTimes();
			return true;
		}

		public void AddUser(Entity userEntity)
		{
			//IL_0006: 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)
			if (!users.Contains(userEntity))
			{
				users.Add(userEntity);
			}
		}

		public bool IsPvpActive()
		{
			DateTime now = DateTime.Now;
			foreach (PvpTime pvpTime in pvpTimes)
			{
				if (IsPvpActiveDuringTime(pvpTime, now))
				{
					return true;
				}
			}
			return false;
		}

		public static bool IsPvpActiveDuringTime(PvpTime pvpTime, DateTime timeToCheck)
		{
			DaysOfTheWeek daysOfTheWeek = (DaysOfTheWeek)(1 << (int)timeToCheck.DayOfWeek);
			bool flag = pvpTime.DaysOfTheWeek.HasFlag(daysOfTheWeek);
			bool flag2 = pvpTime.DaysOfTheWeek.HasFlag(PREVIOUS_DAY[daysOfTheWeek]);
			if (!flag && !flag2)
			{
				return false;
			}
			DateTime dateTime = new DateTime(timeToCheck.Year, timeToCheck.Month, timeToCheck.Day, pvpTime.StartHour, pvpTime.StartMinute, 0);
			DateTime dateTime2 = new DateTime(timeToCheck.Year, timeToCheck.Month, timeToCheck.Day, pvpTime.EndHour, pvpTime.EndMinute, 0);
			bool flag3 = dateTime2 <= dateTime;
			if (flag3)
			{
				if (flag)
				{
					dateTime2 = dateTime2.AddDays(1.0);
				}
				else if (flag2)
				{
					dateTime = dateTime.AddDays(-1.0);
				}
			}
			if (timeToCheck >= dateTime && timeToCheck <= dateTime2)
			{
				return true;
			}
			if (flag3 && flag && flag2)
			{
				dateTime = dateTime.AddDays(-1.0);
				dateTime2 = dateTime2.AddDays(-1.0);
				if (timeToCheck >= dateTime && timeToCheck <= dateTime2)
				{
					return true;
				}
			}
			return false;
		}

		public void Update()
		{
			UpdatePvpStatuses();
		}

		private void UpdatePvpStatuses()
		{
			//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_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d6: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: 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_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: 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_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			FixedString512Bytes val2 = default(FixedString512Bytes);
			foreach (Entity user7 in users)
			{
				User val = user7.Read<User>();
				Entity entityOnServer = ((NetworkedEntity)(ref val.LocalCharacter)).GetEntityOnServer();
				if (entityOnServer == Entity.Null || Buffs.GetBuffDuration(entityOnServer, Prefabs.Buff_General_PvPProtected) > 0f)
				{
					continue;
				}
				if (IsPvpActive() != isPvpActive)
				{
					messagedHasBuffFromZone.Clear();
					isPvpActive = !isPvpActive;
					((FixedString512Bytes)(ref val2))..ctor("Vampire PvP is now " + (isPvpActive ? "<color=red>active</color>" : "<color=green>inactive</color>"));
					ServerChatUtils.SendSystemMessageToAllClients(Core.EntityManager, ref val2);
					Core.Log.LogInfo((object)val2);
					inPveRegion.Clear();
					inPvpRegion.Clear();
				}
				PvpRegionsService.PvpRegionType playerRegionPvpState = Core.PvpRegionsService.GetPlayerRegionPvpState(entityOnServer);
				bool flag = Buffs.HasBuff(entityOnServer, Prefabs.Buff_General_PvPProtected);
				PlayerCharacter val3 = entityOnServer.Read<PlayerCharacter>();
				float3 value = entityOnServer.Read<Translation>().Value;
				if (isPvpActive)
				{
					if (playerRegionPvpState == PvpRegionsService.PvpRegionType.AlwaysPvE)
					{
						if (!flag)
						{
							if (!messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value2) || Time.time - value2 > 2.5f))
							{
								messagedHasBuffFromZone.Add(entityOnServer);
								lastAlertedPlayer[entityOnServer] = Time.time;
								User user = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
								Helper.SendSystemMessageToClient(Core.EntityManager, user, "You have entered a region that is always <color=green>PvE</color>");
							}
							Buffs.AddBuff(val3.UserEntity, entityOnServer, Prefabs.Buff_General_PvPProtected, -1);
						}
						inPveRegion.Add(entityOnServer);
					}
					else if (Core.ElysiumService.PvpElysiumOn && Core.ElysiumService.IsInZone(((float3)(ref value)).xz))
					{
						if (!messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value3) || Time.time - value3 > 2.5f))
						{
							messagedHasBuffFromZone.Add(entityOnServer);
							lastAlertedPlayer[entityOnServer] = Time.time;
							User user2 = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
							Helper.SendSystemMessageToClient(Core.EntityManager, user2, "You have entered an Elysium and are <color=green>safe</color> from PvP combat");
						}
						Buffs.AddBuff(val3.UserEntity, entityOnServer, Prefabs.Buff_General_PvPProtected, -1);
					}
					else
					{
						if (!flag)
						{
							continue;
						}
						if (messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value4) || Time.time - value4 > 2.5f))
						{
							messagedHasBuffFromZone.Remove(entityOnServer);
							lastAlertedPlayer[entityOnServer] = Time.time;
							User user3 = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
							if (inPveRegion.Contains(entityOnServer))
							{
								inPveRegion.Remove(entityOnServer);
								Helper.SendSystemMessageToClient(Core.EntityManager, user3, "You have left a PvE region and can engage in <color=red>PvP</color> combat");
							}
							else
							{
								Helper.SendSystemMessageToClient(Core.EntityManager, user3, "You have left an Elysium and can engage in <color=red>PvP</color> combat");
							}
						}
						Buffs.RemoveBuff(entityOnServer, Prefabs.Buff_General_PvPProtected);
					}
				}
				else if (playerRegionPvpState == PvpRegionsService.PvpRegionType.AlwaysPvP)
				{
					if (flag)
					{
						if (messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value5) || Time.time - value5 > 2.5f))
						{
							messagedHasBuffFromZone.Remove(entityOnServer);
							lastAlertedPlayer[entityOnServer] = Time.time;
							User user4 = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
							Helper.SendSystemMessageToClient(Core.EntityManager, user4, "You have entered a region that is always <color=red>PvP</color>");
						}
						Buffs.RemoveBuff(entityOnServer, Prefabs.Buff_General_PvPProtected);
					}
					inPvpRegion.Add(entityOnServer);
				}
				else if (Core.PvpArenaService.PvpArenasOn && Core.PvpArenaService.IsInZone(((float3)(ref value)).xz))
				{
					if (messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value6) || Time.time - value6 > 2.5f))
					{
						messagedHasBuffFromZone.Remove(entityOnServer);
						lastAlertedPlayer[entityOnServer] = Time.time;
						User user5 = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
						Helper.SendSystemMessageToClient(Core.EntityManager, user5, "You have entered an Arena and can engage in <color=red>PvP</color> combat");
					}
					Buffs.RemoveBuff(entityOnServer, Prefabs.Buff_General_PvPProtected);
				}
				else
				{
					if (flag)
					{
						continue;
					}
					if (!messagedHasBuffFromZone.Contains(entityOnServer) && (!lastAlertedPlayer.TryGetValue(entityOnServer, out var value7) || Time.time - value7 > 2.5f))
					{
						lastAlertedPlayer[entityOnServer] = Time.time;
						User user6 = entityOnServer.Read<PlayerCharacter>().UserEntity.Read<User>();
						if (inPvpRegion.Contains(entityOnServer))
						{
							inPvpRegion.Remove(entityOnServer);
							Helper.SendSystemMessageToClient(Core.EntityManager, user6, "You have left a PvP region and are <color=green>safe</color> from PvP combat");
						}
						else
						{
							Helper.SendSystemMessageToClient(Core.EntityManager, user6, "You have left an Arena and are <color=green>safe</color> from PvP combat");
						}
					}
					messagedHasBuffFromZone.Add(entityOnServer);
					Buffs.AddBuff(val3.UserEntity, entityOnServer, Prefabs.Buff_General_PvPProtected, -1);
				}
			}
		}
	}
	internal class DaysOfTheWeekConverter : JsonConverter<DaysOfTheWeek>
	{
		public override DaysOfTheWeek Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
		{
			if (reader.TokenType != JsonTokenType.StartArray)
			{
				throw new JsonException();
			}
			reader.Read();
			DaysOfTheWeek daysOfTheWeek = (DaysOfTheWeek)0;
			while (reader.TokenType != JsonTokenType.EndArray)
			{
				if (reader.TokenType != JsonTokenType.String)
				{
					throw new JsonException();
				}
				DaysOfTheWeek daysOfTheWeek2 = daysOfTheWeek;
				daysOfTheWeek = daysOfTheWeek2 | (reader.GetString() switch
				{
					"Sunday" => DaysOfTheWeek.Sunday, 
					"Monday" => DaysOfTheWeek.Monday, 
					"Tuesday" => DaysOfTheWeek.Tuesday, 
					"Wednesday" => DaysOfTheWeek.Wednesday, 
					"Thursday" => DaysOfTheWeek.Thursday, 
					"Friday" => DaysOfTheWeek.Friday, 
					"Saturday" => DaysOfTheWeek.Saturday, 
					_ => throw new JsonException(), 
				});
				reader.Read();
			}
			return daysOfTheWeek;
		}

		public override void Write(Utf8JsonWriter writer, DaysOfTheWeek value, JsonSerializerOptions options)
		{
			writer.WriteStartArray();
			if (value.HasFlag(DaysOfTheWeek.Sunday))
			{
				writer.WriteStringValue("Sunday");
			}
			if (value.HasFlag(DaysOfTheWeek.Monday))
			{
				writer.WriteStringValue("Monday");
			}
			if (value.HasFlag(DaysOfTheWeek.Tuesday))
			{
				writer.WriteStringValue("Tuesday");
			}
			if (value.HasFlag(DaysOfTheWeek.Wednesday))
			{
				writer.WriteStringValue("Wednesday");
			}
			if (value.HasFlag(DaysOfTheWeek.Thursday))
			{
				writer.WriteStringValue("Thursday");
			}
			if (value.HasFlag(DaysOfTheWeek.Friday))
			{
				writer.WriteStringValue("Friday");
			}
			if (value.HasFlag(DaysOfTheWeek.Saturday))
			{
				writer.WriteStringValue("Saturday");
			}
			writer.WriteEndArray();
		}
	}
}
namespace KindredArenas.Patches
{
	[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")]
	public static class OnUserConnected_Patch
	{
		public static void Postfix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId)
		{
			//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_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId];
				Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity;
				EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
				User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
				if (((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
				{
					if (!PvpUpdater.Initialized)
					{
						Core.InitializeAfterLoaded();
						PvpUpdater.Initialized = true;
					}
					Core.PvpService.AddUser(userEntity);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 5, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("OnUserConnected");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner:");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.InnerException?.Message);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.StackTrace);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.InnerException?.StackTrace);
				}
				log.LogError(val);
			}
		}
	}
	[HarmonyPatch(typeof(PlaceTileModelSystem), "OnUpdate")]
	public static class PvpUpdater
	{
		public static bool Initialized;

		[HarmonyPostfix]
		public static void Update()
		{
			if (Initialized)
			{
				Core.PvpService.Update();
			}
		}
	}
	[HarmonyPatch(typeof(SpawnTeamSystem_OnPersistenceLoad), "OnUpdate")]
	public static class InitializationPatch
	{
		[HarmonyPostfix]
		public static void OneShot_AfterLoad_InitializationPatch()
		{
			Core.InitializeAfterLoaded();
			PvpUpdater.Initialized = true;
			Plugin.Harmony.Unpatch((MethodBase)typeof(SpawnTeamSystem_OnPersistenceLoad).GetMethod("OnUpdate"), typeof(InitializationPatch).GetMethod("OneShot_AfterLoad_InitializationPatch"));
		}
	}
}
namespace KindredArenas.Data
{
	public static class Prefabs
	{
		public static readonly PrefabGUID _VM_VBlood_TEMPLATE = new PrefabGUID(2075390218);

		public static readonly PrefabGUID AB_AmbientLightning_Light = new PrefabGUID(589474506);

		public static readonly PrefabGUID AB_AmbientLightning_Light_GameplayStrike = new PrefabGUID(-2094079027);

		public static readonly PrefabGUID AB_Archer_Projectile_Cast = new PrefabGUID(1106195644);

		public static readonly PrefabGUID AB_Archer_Projectile_Group = new PrefabGUID(-751119210);

		public static readonly PrefabGUID AB_Archer_Projectile01 = new PrefabGUID(-1423243724);

		public static readonly PrefabGUID AB_ArchMage_ArcaneImprisonment_AbilityGroup = new PrefabGUID(91941562);

		public static readonly PrefabGUID AB_ArchMage_ArcaneImprisonment_Cast = new PrefabGUID(1965996833);

		public static readonly PrefabGUID AB_ArchMage_ArcaneImprisonment_ImprisonBuff = new PrefabGUID(2007858431);

		public static readonly PrefabGUID AB_ArchMage_ArcaneImprisonment_MoveBehaviourBuff = new PrefabGUID(1099681289);

		public static readonly PrefabGUID AB_ArchMage_ArcaneImprisonment_RingArea = new PrefabGUID(-1952370580);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_AbilityGroup = new PrefabGUID(1520734123);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_AggroBuff = new PrefabGUID(-967628321);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Cast_01 = new PrefabGUID(-88630604);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Cast_02 = new PrefabGUID(1895752824);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Cast_03 = new PrefabGUID(-518248879);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Charged_AbilityGroup = new PrefabGUID(1187623532);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Charged_Cast = new PrefabGUID(-1536831420);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Charged_HitBuff = new PrefabGUID(1237316881);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Charged_Projectile = new PrefabGUID(-1385969356);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Charged_SplinterProjectile = new PrefabGUID(-485680280);

		public static readonly PrefabGUID AB_ArchMage_CrystalLance_Projectile = new PrefabGUID(826214455);

		public static readonly PrefabGUID AB_ArchMage_Emote_Aggro_AbilityGroup = new PrefabGUID(-139137314);

		public static readonly PrefabGUID AB_ArchMage_Emote_Aggro_Buff = new PrefabGUID(-1748472670);

		public static readonly PrefabGUID AB_ArchMage_Emote_Aggro_Buff_ALREADY_EXISTS_2 = new PrefabGUID(-1161618215);

		public static readonly PrefabGUID AB_ArchMage_Emote_Aggro_Cast = new PrefabGUID(-2059383344);

		public static readonly PrefabGUID AB_ArchMage_FireSpinner_AbilityGroup = new PrefabGUID(1217615468);

		public static readonly PrefabGUID AB_ArchMage_FireSpinner_Cast = new PrefabGUID(-1997201513);

		public static readonly PrefabGUID AB_ArchMage_FireSpinner_Projectile = new PrefabGUID(612861780);

		public static readonly PrefabGUID AB_ArchMage_FireSpinner_Spinner = new PrefabGUID(-1672727739);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_AggroBuff = new PrefabGUID(-240922728);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_AreaDamageBuff = new PrefabGUID(-1640482518);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_AreaEffectBuff = new PrefabGUID(-139562596);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_AreaInitBuff = new PrefabGUID(451676082);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_Dash_AbilityGroup = new PrefabGUID(-1754787506);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_Dash_Cast = new PrefabGUID(2138663579);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_Dash_Trigger = new PrefabGUID(1679920133);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_Projectile = new PrefabGUID(269193311);

		public static readonly PrefabGUID AB_ArchMage_FlameSphere_ShouldDestroyBuff = new PrefabGUID(299001257);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_AbilityGroup = new PrefabGUID(-2025881745);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_Area = new PrefabGUID(379217467);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_Cast = new PrefabGUID(1890249378);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_Channel = new PrefabGUID(-920928426);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_FreezeBuff = new PrefabGUID(821255111);

		public static readonly PrefabGUID AB_ArchMage_FlamingIce_Trigger = new PrefabGUID(-1488767962);

		public static readonly PrefabGUID AB_ArchMage_LightningArc_AbilityGroup = new PrefabGUID(-1232816408);

		public static readonly PrefabGUID AB_ArchMage_LightningArc_Cast = new PrefabGUID(-1524769526);

		public static readonly PrefabGUID AB_ArchMage_LightningArc_Projectile = new PrefabGUID(1211897000);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_AbilityGroup = new PrefabGUID(1365358996);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_Cast = new PrefabGUID(1142315183);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_Projectile = new PrefabGUID(-1317668918);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_ProjectileSpawnerBuff = new PrefabGUID(2089605812);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_ProjectileTrigger = new PrefabGUID(390853496);

		public static readonly PrefabGUID AB_ArchMage_LightningCurse_Trigger = new PrefabGUID(-988990419);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_AbilityGroup = new PrefabGUID(-1897317770);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_Cast = new PrefabGUID(-1714013936);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_EndPhase = new PrefabGUID(262354515);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_MoveBehaviourBuff = new PrefabGUID(-1099792891);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_Phase = new PrefabGUID(30325069);

		public static readonly PrefabGUID AB_ArchMage_MirrorImage_Trigger = new PrefabGUID(292114817);

		public static readonly PrefabGUID AB_ArchMage_Teleport_AbilityGroup = new PrefabGUID(886063983);

		public static readonly PrefabGUID AB_ArchMage_Teleport_Cast = new PrefabGUID(484270946);

		public static readonly PrefabGUID AB_ArchMage_Teleport_EndPhase = new PrefabGUID(56049482);

		public static readonly PrefabGUID AB_ArchMage_Teleport_Phase = new PrefabGUID(-723899936);

		public static readonly PrefabGUID AB_Bandit_Ambush_Buff = new PrefabGUI