Decompiled source of BetterMissions v2.2.0

BetterMissions.dll

Decompiled a week ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BetterMissions.Database;
using BetterMissions.Hooks.Client;
using BetterMissions.Models;
using BetterMissions.Settings;
using BetterMissions.Systems;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Concurrent;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared.Systems;
using ProjectM.UI;
using Stunlock.Core;
using Stunlock.Localization;
using Stunlock.Network;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using Utils.Database;
using Utils.Logger;
using Utils.Settings;
using Utils.VRising;
using Utils.VRising.Data;
using Utils.VRising.Entities;
using Utils.VRising.Systems;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Utils.VRising
{
	internal static class Extensions
	{
		private static EntityManager EntityManager => Utils.VRising.Entities.EntityManager.Get();

		public static void Destroy(this Entity entity)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			((EntityManager)(ref entityManager)).DestroyEntity(entity);
		}

		public static bool Has<T>(this Entity entity)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
		}

		public unsafe static T Read<T>(this Entity entity) where T : struct
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001a: Unknown result type (might be due to invalid IL or missing references)
			TypeIndex typeIndex = new ComponentType(Il2CppType.Of<T>(), (AccessMode)0).TypeIndex;
			EntityManager entityManager = EntityManager;
			return Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex)));
		}

		public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			TypeIndex typeIndex = new ComponentType(Il2CppType.Of<T>(), (AccessMode)0).TypeIndex;
			byte[] array = StructureToByteArray(componentData);
			int num = Marshal.SizeOf<T>();
			fixed (byte* ptr = array)
			{
				EntityManager entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, typeIndex, (void*)ptr, num);
			}
		}

		private 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;
		}
	}
}
namespace Utils.VRising.Systems
{
	public class AssetGuid
	{
		public static AssetGuid GetAssetGuid(string textString)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			using SHA256 sHA = SHA256.Create();
			byte[] array = sHA.ComputeHash(Encoding.UTF8.GetBytes(textString));
			return AssetGuid.FromGuid(new Guid(Il2CppStructArray<byte>.op_Implicit(array[..16])));
		}

		private static AssetGuid FromGuid(Guid uniqueGuid)
		{
			throw new NotImplementedException();
		}

		public static LocalizationKey LocalizeString(string text)
		{
			//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_0022: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			AssetGuid assetGuid = GetAssetGuid(text);
			if (Localization.Initialized)
			{
				Localization._LocalizedStrings.TryAdd(assetGuid, text);
				return new LocalizationKey(assetGuid);
			}
			return LocalizationKey.Empty;
		}
	}
	public static class Chat
	{
		private static readonly ComponentType[] _networkChatMessageServerEventComponents = (ComponentType[])(object)new ComponentType[3]
		{
			ComponentType.ReadOnly(Il2CppType.Of<NetworkEventType>()),
			ComponentType.ReadOnly<SendEventToUser>(),
			ComponentType.ReadOnly(Il2CppType.Of<ChatMessageServerEvent>())
		};

		private static readonly ComponentType[] _networkChatMessageEventComponents = (ComponentType[])(object)new ComponentType[3]
		{
			ComponentType.ReadOnly(Il2CppType.Of<FromCharacter>()),
			ComponentType.ReadOnly(Il2CppType.Of<NetworkEventType>()),
			ComponentType.ReadOnly(Il2CppType.Of<ChatMessageEvent>())
		};

		private static readonly NetworkEventType _networkChatMessageServerEventType = new NetworkEventType
		{
			IsAdminEvent = false,
			EventId = NetworkEvents.EventId_ChatMessageServerEvent,
			IsDebugEvent = false
		};

		private static readonly NetworkEventType _networkChatMessageEventType = new NetworkEventType
		{
			IsAdminEvent = false,
			EventId = NetworkEvents.EventId_ChatMessageEvent,
			IsDebugEvent = false
		};

		public static void SendServerMessage(string message, Entity userEntity, ServerChatMessageType messageType = 6)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			User val = userEntity.Read<User>();
			ChatMessageServerEvent val2 = default(ChatMessageServerEvent);
			val2.MessageText = new FixedString512Bytes(message);
			val2.MessageType = messageType;
			val2.FromUser = userEntity.Read<NetworkId>();
			val2.FromCharacter = ((NetworkedEntity)(ref val.LocalCharacter)).GetEntityOnServer().Read<NetworkId>();
			val2.TimeUTC = DateTime.UtcNow.Ticks;
			ChatMessageServerEvent componentData = val2;
			Log.Trace($"Sending server chat message '{message}' to user({val.CharacterName}:{val.Index})");
			EntityManager val3 = EntityManager.Get();
			Entity entity = ((EntityManager)(ref val3)).CreateEntity(_networkChatMessageServerEventComponents);
			entity.Write<SendEventToUser>(new SendEventToUser
			{
				UserIndex = val.Index
			});
			entity.Write<NetworkEventType>(_networkChatMessageServerEventType);
			entity.Write<ChatMessageServerEvent>(componentData);
		}

		public static void SendMessage(string message, Entity userEntity, Entity characterEntity, ChatMessageType messageType = 4)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a0: 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_00ae: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			User val = userEntity.Read<User>();
			ChatMessageEvent val2 = default(ChatMessageEvent);
			val2.MessageText = new FixedString512Bytes(message);
			val2.MessageType = messageType;
			val2.ReceiverEntity = userEntity.Read<NetworkId>();
			ChatMessageEvent componentData = val2;
			Log.Trace($"Sending chat message '{message}' to user({val.CharacterName}:{val.Index})");
			EntityManager val3 = EntityManager.Get();
			Entity entity = ((EntityManager)(ref val3)).CreateEntity(_networkChatMessageEventComponents);
			entity.Write<FromCharacter>(new FromCharacter
			{
				User = userEntity,
				Character = characterEntity
			});
			entity.Write<NetworkEventType>(_networkChatMessageEventType);
			entity.Write<ChatMessageEvent>(componentData);
		}
	}
	public static class PrefabCollectionSystem
	{
		public static PrefabCollectionSystem Get()
		{
			return World.world.GetExistingSystemManaged<PrefabCollectionSystem>();
		}

		public static string GetPrefabName(PrefabGUID hashCode)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			PrefabCollectionSystem val = Get();
			string result = "Nonexistent";
			if (((PrefabGUID)(ref hashCode)).GuidHash == 0)
			{
				return result;
			}
			try
			{
				Entity val2 = ((PrefabLookupMap)(ref ((PrefabCollectionSystem_Base)val).PrefabLookupMap))[hashCode];
				return ((object)(Entity)(ref val2)).ToString();
			}
			catch
			{
				return "NoPrefabName";
			}
		}
	}
	public static class ServerScriptMapper
	{
		public static ServerScriptMapper Get()
		{
			return World.world.GetExistingSystemManaged<ServerScriptMapper>();
		}
	}
}
namespace Utils.VRising.Logger
{
	public static class PrettyLog
	{
	}
}
namespace Utils.VRising.Entities
{
	public static class ActiveServantMission
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<ActiveServantMission>() });
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static DynamicBuffer<ActiveServantMission> GetBuffer(Entity mission)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			return ((EntityManager)(ref entityManager)).GetBuffer<ActiveServantMission>(mission, false);
		}

		public static List<DynamicBuffer<ActiveServantMission>> GetAllBuffers()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			List<DynamicBuffer<ActiveServantMission>> list = new List<DynamicBuffer<ActiveServantMission>>();
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				list.Add(GetBuffer(current));
			}
			return list;
		}

		public static List<string> GetAllBuffersMissionUIDs()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			foreach (DynamicBuffer<ActiveServantMission> allBuffer in GetAllBuffers())
			{
				Enumerator<ActiveServantMission> enumerator2 = allBuffer.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					ActiveServantMission current = enumerator2.Current;
					list.Add(GetMissionUID(current));
				}
			}
			return list;
		}

		public static List<string> GetBufferMissionUIDs(Entity mission)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			List<string> list = new List<string>();
			Enumerator<ActiveServantMission> enumerator = GetBuffer(mission).GetEnumerator();
			while (enumerator.MoveNext())
			{
				ActiveServantMission current = enumerator.Current;
				list.Add(GetMissionUID(current));
			}
			return list;
		}

		public static string GetMissionUID(ActiveServantMission mission)
		{
			//IL_0010: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			return Convert.ToBase64String(Encoding.UTF8.GetBytes($"{GetMissiontDataId(mission)}-{GetMissionStartTime(mission)}-{GetMissionName(mission)}"));
		}

		public static string GetMissionName(ActiveServantMission mission)
		{
			//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)
			return PrefabCollectionSystem.GetPrefabName(mission.MissionID);
		}

		public static float GetMissionLength(ActiveServantMission mission)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return mission.MissionLengthSeconds;
		}

		public static long GetMissionLengthTimestamp(ActiveServantMission mission)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return DateTimeOffset.Now.AddSeconds(GetMissionLength(mission)).ToUnixTimeSeconds();
		}

		public static void SetMissionLength(ref ActiveServantMission mission, float seconds)
		{
			mission.MissionLengthSeconds = seconds;
		}

		public static double GetMissionStartTime(ActiveServantMission mission)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return mission.MissionLengthSeconds;
		}

		public static int GetMissiontDataId(ActiveServantMission mission)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return mission.MissiontDataId;
		}
	}
	public static class DayNightCycle
	{
		public static DayNightCycle GetSingleton()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return ServerScriptMapper.Get()._ServerGameManager.DayNightCycle;
		}

		public static TimeOfDay GetTimeOfDay(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return ((DayNightCycle)(ref dnc)).TimeOfDay;
		}

		public static double GetTime(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return dnc.Time;
		}

		public static TimeScale GetTimeScale(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return DayNightCycleExtensions.GetTimeScale(ref dnc);
		}

		public static float GetTimeSinceDayStart(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return ((DayNightCycle)(ref dnc)).TimeSinceDayStart;
		}

		public static float GetDayTimeStartInSeconds(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return dnc.DayTimeStartInSeconds;
		}

		public static float GetDayTimeDurationInSeconds(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return dnc.DayTimeDurationInSeconds;
		}

		public static float GetDayDurationInSeconds(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return dnc.DayDurationInSeconds;
		}

		public static bool IsDay(DayNightCycle dnc = default(DayNightCycle))
		{
			//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_0007: Invalid comparison between Unknown and I4
			return (int)GetTimeOfDay(dnc) == 1;
		}

		public static bool IsBloodMoonDay(DayNightCycle dnc = default(DayNightCycle))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (emptyDNC(dnc))
			{
				dnc = GetSingleton();
			}
			return ((DayNightCycle)(ref dnc)).IsBloodMoonDay();
		}

		private static bool emptyDNC(DayNightCycle dnc)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return EqualityComparer<DayNightCycle>.Default.Equals(dnc, default(DayNightCycle));
		}
	}
	public static class EntityManager
	{
		public static EntityManager Get()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return World.EntityManager;
		}
	}
	public static class PlayerCharacter
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<PlayerCharacter>() });
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static bool IsOnline(Entity playerCharacter)
		{
			//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_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)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//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)
			EntityManager entityManager = World.EntityManager;
			PlayerCharacter componentData = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(playerCharacter);
			entityManager = World.EntityManager;
			return ((EntityManager)(ref entityManager)).GetComponentData<User>(componentData.UserEntity).IsConnected;
		}

		public static Entity GetCharacterByUserEntity(Entity userEntity)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<PlayerCharacter>() });
			((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			return Entity.Null;
		}

		public static Entity GetLocalCharacter()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<LocalCharacter>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			if (val2.Length <= 0)
			{
				return Entity.Null;
			}
			return val2[0];
		}

		public static bool IsAllOnlinePlayersSleeping()
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			NativeArray<Entity> all = Sleeping.GetAll();
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (IsOnline(current) && !Sleeping.HasTarget(all, current))
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class ServantCoffinstation
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<ServantCoffinstation>() });
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static ServantCoffinstation GetComponentData(Entity servantCoffinStation)
		{
			//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_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)
			EntityManager entityManager = World.EntityManager;
			return ((EntityManager)(ref entityManager)).GetComponentData<ServantCoffinstation>(servantCoffinStation);
		}

		public static Dictionary<Entity, ServantCoffinstation> GetAllComponentData()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<Entity, ServantCoffinstation> dictionary = new Dictionary<Entity, ServantCoffinstation>();
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				dictionary.Add(current, GetComponentData(current));
			}
			return dictionary;
		}

		public static bool IsConverting(ServantCoffinstation servantCoffinStation)
		{
			//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_0007: Invalid comparison between Unknown and I4
			return (int)servantCoffinStation.State == 3;
		}

		public static float GetConvertionProgress(ServantCoffinstation servantCoffinStation)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return servantCoffinStation.ConvertionProgress;
		}

		public static void SetConvertionProgress(ref ServantCoffinstation servantCoffinStation, float seconds)
		{
			servantCoffinStation.ConvertionProgress = seconds;
		}

		public static void SetComponentData(Entity coffinStationEntity, ServantCoffinstation coffinStation)
		{
			//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_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)
			EntityManager entityManager = World.EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<ServantCoffinstation>(coffinStationEntity, coffinStation);
		}
	}
	public static class ServantMissionSetting
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<ServantMissionSetting>() });
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static DynamicBuffer<ServantMissionSetting> GetBuffer()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: 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_0033: 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)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			if (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				EntityManager entityManager = World.EntityManager;
				return ((EntityManager)(ref entityManager)).GetBuffer<ServantMissionSetting>(current, false);
			}
			return default(DynamicBuffer<ServantMissionSetting>);
		}
	}
	public static class SetTimeOfDayEvent
	{
		public static void Add(int hour = 0, int day = 0)
		{
			create(hour, day, (SetTimeType)1);
		}

		public static void Set(int hour = 0, int day = 0)
		{
			create(hour, day, (SetTimeType)0);
		}

		private static void create(int hour, int day, SetTimeType type)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			Entity val = ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<SetTimeOfDayEvent>() });
			entityManager = World.EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<SetTimeOfDayEvent>(val, new SetTimeOfDayEvent
			{
				Hour = hour,
				Day = day,
				Type = type
			});
		}
	}
	public static class Sleeping
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_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)
			//IL_0021: 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_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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.ReadOnly<Buff>(),
				ComponentType.ReadOnly<SpawnSleepingBuff>(),
				ComponentType.ReadOnly<InsideBuff>()
			});
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static bool HasTarget(NativeArray<Entity> sleepingEntities, Entity target)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			Enumerator<Entity> enumerator = sleepingEntities.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				EntityManager entityManager = World.EntityManager;
				if (((EntityManager)(ref entityManager)).GetComponentData<Buff>(current).Target == target)
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class User
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			return ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static Entity GetFirstOnlinePlayer()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: 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_0038: 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)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				EntityManager entityManager = World.EntityManager;
				if (((EntityManager)(ref entityManager)).GetComponentData<User>(current).IsConnected)
				{
					return current;
				}
			}
			return Entity.Null;
		}

		public static Entity GetLocalUser()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			EntityManager entityManager = World.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<LocalUser>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			if (val2.Length <= 0)
			{
				return Entity.Null;
			}
			return val2[0];
		}

		public static bool IsAllOffline()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: 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)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				EntityManager entityManager = World.EntityManager;
				if (((EntityManager)(ref entityManager)).GetComponentData<User>(current).IsConnected)
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class World
	{
		internal static World? _world;

		public static EntityManager EntityManager => world.EntityManager;

		public static World world
		{
			get
			{
				if (_world != null)
				{
					return _world;
				}
				_world = Server ?? Client;
				if (_world != null)
				{
					return _world;
				}
				throw new Exception("No Server or Client world found.");
			}
		}

		public static bool IsServer => Application.productName == "VRisingServer";

		public static bool IsClient => Application.productName == "VRising";

		public static World? Client => GetWorld("Client_0") ?? null;

		public static World? Server => GetWorld("Server") ?? null;

		public static void UnPatch()
		{
			_world = null;
		}

		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;
		}
	}
}
namespace Utils.VRising.Data
{
	public static class Prefabs
	{
		public static readonly PrefabGUID AB_Interact_Throne_Buff_Sit = new PrefabGUID(211319841);
	}
}
namespace Utils.Settings
{
	public class Config
	{
		public static string PluginGUID;

		public static string PluginFolderPath;

		internal static ConfigFile cfg;

		private static List<Action> configActions = new List<Action>();

		public static ConfigElement<T> Bind<T>(string section, string key, T defaultValue, string description)
		{
			return new ConfigElement<T>(cfg.Bind<T>(section, key, defaultValue, description), section, key, defaultValue, description);
		}

		public static void Save()
		{
			cfg.Save();
		}

		public static void Setup(string pluginGUID, ConfigFile config, int skipCaller = 4, params Action[] actions)
		{
			PluginGUID = pluginGUID;
			cfg = config;
			PluginFolderPath = Paths.ConfigPath + "\\" + PluginGUID;
			if (!Directory.Exists(PluginFolderPath))
			{
				Directory.CreateDirectory(PluginFolderPath);
			}
			ENV.Debug.Setup(skipCaller);
			AddConfigActions(actions);
		}

		public static void Load()
		{
			if (configActions == null || configActions.Count == 0)
			{
				return;
			}
			foreach (Action configAction in configActions)
			{
				configAction();
			}
		}

		public static void AddConfigActions(params Action[] actions)
		{
			configActions.AddRange(actions);
		}
	}
	public class ConfigElement<T>
	{
		public List<Action<T>> OnValueChanged = new List<Action<T>>();

		private ConfigEntry<T> OriginalConfig;

		public string Section { get; }

		public string Key { get; }

		public string Description { get; }

		public Type ElementType => typeof(T);

		public T Value
		{
			get
			{
				return GetValue();
			}
			set
			{
				SetValue(value);
			}
		}

		public T DefaultValue { get; }

		private T GetValue()
		{
			return OriginalConfig.Value;
		}

		public ConfigElement(ConfigEntry<T> original, string section, string key, T defaultValue, string description)
		{
			OriginalConfig = original;
			Section = section;
			Key = key;
			DefaultValue = defaultValue;
			Description = description;
		}

		private void SetValue(T value)
		{
			if ((Value == null && value == null) || (Value != null && Value.Equals(value)))
			{
				return;
			}
			OriginalConfig.Value = value;
			foreach (Action<T> item in OnValueChanged)
			{
				item?.Invoke(value);
			}
		}
	}
	public static class ENV
	{
		public class Debug
		{
			private static string debugSection = "\ud83e\udeb2Debug";

			private static ConfigElement<bool> DebugLogOnTempFile;

			private static ConfigElement<bool> DebugEnableTraceLogs;

			public static void Setup(int skipCaller)
			{
				Config.AddConfigActions(delegate
				{
					load(skipCaller);
				});
			}

			private static void load(int skipCaller)
			{
				if (enableDebugConfigs(skipCaller))
				{
					DebugLogOnTempFile = Config.Bind(debugSection, "LogOnTempFile", defaultValue: false, "Enabled, will log every plugin log on a temp file");
					DebugEnableTraceLogs = Config.Bind(debugSection, "EnableTraceLogs", defaultValue: false, "Enabled, will print Trace logs (Debug output in BepInEx)");
				}
				validateValues();
			}

			private static void validateValues()
			{
				if (DebugLogOnTempFile != null)
				{
					LogOnTempFile = DebugLogOnTempFile.Value;
				}
				if (DebugEnableTraceLogs != null)
				{
					EnableTraceLogs = DebugEnableTraceLogs.Value;
				}
				Config.cfg.Save();
			}

			private static bool enableDebugConfigs(int skipCaller)
			{
				return new StackTrace().GetFrame(skipCaller).GetMethod().DeclaringType.Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>()?.Configuration != "Release";
			}
		}

		public static bool LogOnTempFile;

		public static bool EnableTraceLogs;
	}
}
namespace Utils.Logger
{
	public class Config
	{
		internal static ManualLogSource logger;

		private static string tempLogFile;

		public static void Setup(ManualLogSource logger, string worldType = "")
		{
			Config.logger = logger;
			string value = "";
			if (worldType != "")
			{
				value = "-" + worldType;
			}
			tempLogFile = $"{Utils.Settings.Config.PluginFolderPath}\\{Utils.Settings.Config.PluginGUID}{value}.txt";
			Log.Start("Using \"" + tempLogFile + "\" to save logs.");
		}

		public static void TestSetup()
		{
		}

		internal static void logFile(object data, string level, string prefix = "")
		{
			if (Utils.Settings.ENV.LogOnTempFile)
			{
				using (StreamWriter streamWriter = File.AppendText(tempLogFile))
				{
					string value = $"{prefix}{DateTime.Now.ToString("hh:mm:ss")} [{level} {Utils.Settings.Config.PluginGUID}]: {data}";
					streamWriter.WriteLine(value);
				}
			}
		}
	}
	public class Log
	{
		private static ConcurrentDictionary<string, long> timedLog = new ConcurrentDictionary<string, long>();

		private static List<string> firstLog = new List<string>();

		public static void Info(object data)
		{
			Config.logger.LogInfo(data);
			Config.logFile(data, "Info:   ");
		}

		public static void Error(object data)
		{
			Config.logger.LogError(data);
			Config.logFile(data, "Error:  ");
		}

		public static void Debug(object data)
		{
			Config.logger.LogDebug(data);
			Config.logFile(data, "Debug:  ");
		}

		public static void Fatal(object data)
		{
			Config.logger.LogFatal(data);
			Config.logFile(data, "Fatal:  ");
		}

		public static void Warning(object data)
		{
			Config.logger.LogWarning(data);
			Config.logFile(data, "Warning:");
		}

		public static void Message(object data)
		{
			Config.logger.LogMessage(data);
			Config.logFile(data, "Message:");
		}

		public static void Start(object data)
		{
			Config.logger.LogMessage(data);
			Config.logFile(data, "Start:  ", "\n");
		}

		public static void Trace(object data)
		{
			if (Utils.Settings.ENV.EnableTraceLogs)
			{
				Config.logger.LogDebug(data);
				Config.logFile(data, "Trace:  ");
			}
		}

		public static void Struct<T>(T data)
		{
			if (Utils.Settings.ENV.EnableTraceLogs)
			{
				string text = structToString(data);
				Config.logger.LogDebug((object)text);
				Config.logFile(text, "Struct: ");
			}
		}

		public static void Timed(Action action, int ms, string id = "")
		{
			if (!blocked(ms, id))
			{
				action();
			}
		}

		public static void First(Action action, string id = "")
		{
			if (first(id))
			{
				action();
			}
		}

		private static string structToString<T>(T data)
		{
			Type type = data.GetType();
			FieldInfo[] fields = type.GetFields();
			PropertyInfo[] properties = type.GetProperties();
			Dictionary<string, object> values = new Dictionary<string, object>();
			Array.ForEach(properties, delegate(PropertyInfo property)
			{
				values.TryAdd(property.Name, property.GetValue(data));
			});
			Array.ForEach(fields, delegate(FieldInfo field)
			{
				values.TryAdd(field.Name, field.GetValue(data));
			});
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, object> item in values)
			{
				list.Add($"\"{item.Key}\":\"{item.Value}\"");
			}
			return "\"" + type.ToString() + "\": {" + string.Join(",", list) + "}";
		}

		private static bool first(string id)
		{
			if (firstLog.Contains(id))
			{
				return false;
			}
			firstLog.Add(id);
			return true;
		}

		private static bool blocked(int ms, string id)
		{
			long num = DateTimeOffset.Now.ToUnixTimeMilliseconds();
			if (!timedLog.TryGetValue(id, out var value))
			{
				long newTimestamp = DateTimeOffset.Now.AddMilliseconds(ms).ToUnixTimeMilliseconds();
				timedLog.AddOrUpdate(id, newTimestamp, (string key, long oldValue) => newTimestamp);
				return true;
			}
			if (num < value)
			{
				return true;
			}
			timedLog.TryRemove(id, out var _);
			return false;
		}
	}
}
namespace Utils.Database
{
	public static class Cache
	{
		public static ConcurrentDictionary<string, long> LastUpdate = new ConcurrentDictionary<string, long>();

		public static ConcurrentDictionary<string, bool> Cached = new ConcurrentDictionary<string, bool>();

		public static bool IsBlocked(string key, long blockedDuration)
		{
			long now = DateTimeOffset.Now.ToUnixTimeMilliseconds();
			if (LastUpdate.TryGetValue(key, out var value) && now - value < blockedDuration)
			{
				return true;
			}
			LastUpdate.AddOrUpdate(key, now, (string _, long _) => now);
			return false;
		}

		public static bool Key(string key, bool cache = true)
		{
			if (!cache)
			{
				return false;
			}
			return Cached.AddOrUpdate(key, addValue: true, (string _, bool _) => true);
		}

		public static bool Exists(string key)
		{
			if (Cached.TryGetValue(key, out var value) && value)
			{
				return true;
			}
			return false;
		}

		public static bool RemoveKey(string key)
		{
			bool value;
			return Cached.TryRemove(key, out value);
		}

		public static void Clear()
		{
			Cached.Clear();
			LastUpdate.Clear();
		}
	}
	public static class DB
	{
		private static JsonSerializerOptions JSONOptions = new JsonSerializerOptions
		{
			WriteIndented = false,
			IncludeFields = false
		};

		private static JsonSerializerOptions Pretty_JSON_options = new JsonSerializerOptions
		{
			WriteIndented = true,
			IncludeFields = true
		};

		private static List<Action> loadActions = new List<Action>();

		private static List<Action> saveActions = new List<Action>();

		private static List<Action> cleanActions = new List<Action>();

		public static void Setup(List<Action> load, List<Action> save, List<Action> clean)
		{
			if (load != null)
			{
				loadActions.AddRange(load);
			}
			if (save != null)
			{
				saveActions.AddRange(save);
			}
			if (clean != null)
			{
				cleanActions.AddRange(clean);
			}
		}

		public static void Load()
		{
			if (loadActions == null)
			{
				return;
			}
			foreach (Action loadAction in loadActions)
			{
				loadAction();
			}
			Log.Info($"All({loadActions.Count}) database actions loaded.");
		}

		public static void Save()
		{
			if (saveActions == null)
			{
				return;
			}
			foreach (Action saveAction in saveActions)
			{
				saveAction();
			}
			Log.Info($"All({saveActions.Count}) database actions saved.");
		}

		public static void Clean()
		{
			if (cleanActions == null)
			{
				return;
			}
			foreach (Action cleanAction in cleanActions)
			{
				cleanAction();
			}
			Log.Info($"All({cleanActions.Count}) database actions cleaned.");
		}

		public static void AddLoadActions(params Action[] actions)
		{
			loadActions.AddRange(actions);
		}

		public static void AddSaveActions(params Action[] actions)
		{
			saveActions.AddRange(actions);
		}

		public static void AddCleanActions(params Action[] actions)
		{
			cleanActions.AddRange(actions);
		}

		public static void saveFile<T>(string fileName, T data, bool pretty = false, string extension = ".json")
		{
			JsonSerializerOptions options = JSONOptions;
			if (pretty)
			{
				options = Pretty_JSON_options;
			}
			File.WriteAllText(Utils.Settings.Config.PluginFolderPath + "\\" + fileName + extension, JsonSerializer.Serialize(data, options));
		}

		public static void loadFile<T>(string fileName, ref T data, string extension = ".json") where T : new()
		{
			string path = Utils.Settings.Config.PluginFolderPath + "\\" + fileName + extension;
			if (!File.Exists(path))
			{
				File.Create(path).Dispose();
			}
			string json = File.ReadAllText(path);
			try
			{
				data = JsonSerializer.Deserialize<T>(json);
				Log.Trace(fileName + " DB Populated");
			}
			catch
			{
				data = new T();
				Log.Trace(fileName + " DB Created");
			}
		}
	}
}
namespace BetterMissions
{
	[BepInPlugin("BetterMissions", "BetterMissions", "2.2.0")]
	public class Plugin : BasePlugin
	{
		public override void Load()
		{
			if (World.IsServer)
			{
				Server.Load(((BasePlugin)this).Config, ((BasePlugin)this).Log);
			}
			if (World.IsClient)
			{
				Client.Load(((BasePlugin)this).Config, ((BasePlugin)this).Log);
			}
		}

		public override bool Unload()
		{
			if (World.IsServer)
			{
				Server.Unload();
			}
			if (World.IsClient)
			{
				Client.Unload();
			}
			return false;
		}
	}
	public static class Server
	{
		public static Harmony harmony;

		internal static void Load(ConfigFile config, ManualLogSource logger)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			BetterMissions.Settings.Config.Load(config, logger, "Server");
			harmony = new Harmony("BetterMissions");
			Log.Trace("Patching harmony");
			harmony.PatchAll();
			Log.Info("Plugin BetterMissions v2.2.0 server side is loaded!");
		}

		internal static bool Unload()
		{
			harmony.UnpatchSelf();
			Log.Info("Plugin BetterMissions v2.2.0 server side is unloaded!");
			return true;
		}
	}
	internal static class Client
	{
		public static Harmony harmony;

		internal static void Load(ConfigFile config, ManualLogSource logger)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			BetterMissions.Settings.Config.Load(config, logger, "Client");
			harmony = new Harmony("BetterMissions");
			Log.Trace("Patching harmony");
			harmony.CreateClassProcessor(typeof(ClientBootstrapSystemPatch.OnDestroy)).Patch();
			harmony.CreateClassProcessor(typeof(ClientChatSystemPatch.OnUpdate)).Patch();
			Log.Info("Plugin BetterMissions v2.2.0 client side is loaded!");
		}

		internal static void Unload()
		{
			harmony.UnpatchSelf();
			Log.Info("Plugin BetterMissions v2.2.0 client side is unloaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterMissions";

		public const string PLUGIN_NAME = "BetterMissions";

		public const string PLUGIN_VERSION = "2.2.0";
	}
}
namespace BetterMissions.Systems
{
	public class Mission
	{
		private static readonly ConcurrentDictionary<ulong, bool> _disabledPlayers = new ConcurrentDictionary<ulong, bool>();

		public static void Setup()
		{
			DB.AddCleanActions();
		}

		public static void UpdateUserDataUI(User user)
		{
			//IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			if (!(_disabledPlayers.TryGetValue(user.PlatformId, ref flag) && flag))
			{
				DynamicBuffer<ServantMissionSetting> buffer = Utils.VRising.Entities.ServantMissionSetting.GetBuffer();
				if (!buffer.IsCreated || buffer.Length != 5)
				{
					Log.Error("ServantMissionSetting buffer is not created");
					return;
				}
				string message = JsonSerializer.Serialize(MissionSettingBufferToArray(buffer));
				string message2 = CustomNetwork.WrapMessage(CustomNetwork.MessageType.UpdateClientMissionData, message);
				CustomNetwork.SendSystemMessageToClient(user, message2);
			}
		}

		public static bool IsUserUIDisabled(User user)
		{
			//IL_0005: 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)
			bool flag = default(bool);
			if (_disabledPlayers.TryGetValue(user.PlatformId, ref flag) && flag)
			{
				CustomNetwork.SendSystemMessageToClient(user, "You have disabled the BetterMissions UI sync. Type 'bm.ui.enable' to re-enable it.");
				return true;
			}
			return false;
		}

		public static void DisableUserUISync(User user)
		{
			//IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!_disabledPlayers.TryAdd(user.PlatformId, true))
			{
				CustomNetwork.SendSystemMessageToClient(user, "Failed to disable the BetterMissions UI sync. Try again later or contact admin.");
			}
			else
			{
				CustomNetwork.SendSystemMessageToClient(user, "You disabled the BetterMissions UI sync. Type 'bm.ui.enable' to re-enable it.");
			}
		}

		public static void EnableUserUISync(User user)
		{
			//IL_0005: 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_003d: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			if (_disabledPlayers.ContainsKey(user.PlatformId) && !_disabledPlayers.TryRemove(user.PlatformId, ref flag))
			{
				CustomNetwork.SendSystemMessageToClient(user, "Failed to enable the BetterMissions UI sync. Try again later or contact admin.");
				return;
			}
			CustomNetwork.SendSystemMessageToClient(user, "You enabled the BetterMissions UI sync. Type 'bm.ui.disable' to disable it.");
			UpdateUserDataUI(user);
		}

		private static void MissionSettingArrayToBuffer(BetterMissions.Models.ServantMissionSetting[] missionSettingArray, ref DynamicBuffer<ServantMissionSetting> missionSettingBuffer)
		{
			//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_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_0059: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < missionSettingArray.Length; i++)
			{
				ServantMissionSetting val = missionSettingBuffer[i];
				val.RaidStability = missionSettingArray[i].RaidStability;
				val.MissionLength = missionSettingArray[i].MissionLength;
				val.SuccessRateBonus = missionSettingArray[i].SuccessRateBonus;
				val.InjuryChance = missionSettingArray[i].InjuryChance;
				val.LootFactor = missionSettingArray[i].LootFactor;
				missionSettingBuffer[i] = val;
			}
		}

		public static void HandleUpdateMissionDataMessage(string message)
		{
			//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_001d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				DynamicBuffer<ServantMissionSetting> missionSettingBuffer = Utils.VRising.Entities.ServantMissionSetting.GetBuffer();
				if (missionSettingBuffer.IsCreated)
				{
					MissionSettingArrayToBuffer(JsonSerializer.Deserialize<BetterMissions.Models.ServantMissionSetting[]>(message), ref missionSettingBuffer);
					JsonSerializer.Serialize(MissionSettingBufferToArray(missionSettingBuffer));
				}
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
		}

		public static bool ApplyModifiers()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			DynamicBuffer<ServantMissionSetting> buffer = Utils.VRising.Entities.ServantMissionSetting.GetBuffer();
			if (!buffer.IsCreated)
			{
				return false;
			}
			for (int i = 0; i < buffer.Length; i++)
			{
				ServantMissionSetting val = buffer[i];
				string missionSettingsKey = GetMissionSettingsKey(val, i, buffer.Length);
				if (BetterMissions.Database.Mission.Settings.TryGetValue(missionSettingsKey, out var value))
				{
					val.RaidStability = value.RaidStability;
					val.MissionLength = value.MissionLength;
					val.SuccessRateBonus = value.SuccessRateBonus;
					val.InjuryChance = value.InjuryChance;
					val.LootFactor = value.LootFactor;
				}
				else
				{
					if (BetterMissions.Settings.ENV.EnableMissionRaidStability.Value)
					{
						val.RaidStability = BetterMissions.Settings.ENV.MissionRaidStability.Value;
					}
					val.MissionLength /= BetterMissions.Settings.ENV.MissionLengthModifier.Value;
					val.SuccessRateBonus /= BetterMissions.Settings.ENV.MissionSuccessRateBonusModifier.Value;
					val.InjuryChance /= BetterMissions.Settings.ENV.MissionInjuryChanceModifier.Value;
					val.LootFactor /= BetterMissions.Settings.ENV.MissionLootFactorModifier.Value;
				}
				buffer[i] = val;
			}
			Log.Trace("Mission modifiers applied");
			return true;
		}

		private static BetterMissions.Models.ServantMissionSetting[] MissionSettingBufferToArray(DynamicBuffer<ServantMissionSetting> missionSettingBuffer)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			BetterMissions.Models.ServantMissionSetting[] array = new BetterMissions.Models.ServantMissionSetting[missionSettingBuffer.Length];
			for (int i = 0; i < missionSettingBuffer.Length; i++)
			{
				array[i] = new BetterMissions.Models.ServantMissionSetting
				{
					MissionLength = missionSettingBuffer[i].MissionLength,
					InjuryChance = missionSettingBuffer[i].InjuryChance,
					SuccessRateBonus = missionSettingBuffer[i].SuccessRateBonus,
					RaidStability = missionSettingBuffer[i].RaidStability,
					LootFactor = missionSettingBuffer[i].LootFactor
				};
			}
			return array;
		}

		private static string GetMissionSettingsKey(ServantMissionSetting missionSetting, int index = -1, int size = -1)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (index == -1 || size != 5)
			{
				float missionLength = missionSetting.MissionLength;
				if (missionLength != 7200f)
				{
					if (missionLength != 14400f)
					{
						if (missionLength != 23400f)
						{
							if (missionLength != 36000f)
							{
								if (missionLength == 57600f)
								{
									return "Prepared_2";
								}
								return "";
							}
							return "Prepared_1";
						}
						return "Normal_1";
					}
					return "Reckless_2";
				}
				return "Reckless_1";
			}
			return index switch
			{
				0 => "Reckless_1", 
				1 => "Reckless_2", 
				2 => "Normal_1", 
				3 => "Prepared_1", 
				4 => "Prepared_2", 
				_ => "", 
			};
		}
	}
	public static class CustomNetwork
	{
		private enum MessageParts
		{
			Prefix,
			Warning,
			Version,
			MessageType,
			Message
		}

		public enum MessageType
		{
			InvalidMessage,
			UpdateClientMissionData
		}

		private const string _messagePrefix = "[BetterMissions]";

		private const string _commandPrefix = "bm.";

		public const string _disableMessage = "bm.ui.disable";

		public const string _enableCommand = "bm.ui.enable";

		private const string _messageWarn = "If you see this, you need to install BetterMissions v2.2.0 on client side or type 'bm.ui.disable'!";

		private const string _pluginVersion = "2.2.0";

		private const string _separator = ":";

		private static readonly string[] _commandList = new string[2] { "bm.ui.disable", "bm.ui.enable" };

		public static void SendSystemMessageToClient(User user, string message)
		{
			//IL_0034: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			FixedString512Bytes val = default(FixedString512Bytes);
			((FixedString512Bytes)(ref val))..ctor(message);
			Log.Trace($"Sending system message '{message}' to user({user.CharacterName}:{user.Index})");
			ServerChatUtils.SendSystemMessageToClient(EntityManager.Get(), user, ref val);
		}

		public static void SendLocalMessage(string message, ServerChatMessageType messageType = 8)
		{
			//IL_0015: 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)
			Log.Trace("Sending local message '" + message + "'");
			ClientSystemChatUtils.AddLocalMessage(EntityManager.Get(), message, messageType);
		}

		public static void ProcessMessage(MessageType messageType, string message)
		{
			if (messageType == MessageType.UpdateClientMissionData)
			{
				Mission.HandleUpdateMissionDataMessage(message);
				return;
			}
			Log.Error($"Unknown message type: {messageType}");
		}

		public static void ProcessCommand(string message, Entity userEntity)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			User val = userEntity.Read<User>();
			Log.Trace($"Message from {val.CharacterName}:{val.Index} (Steam ID: {val.PlatformId}) content: {message}");
			if (!(message == "bm.ui.disable"))
			{
				if (message == "bm.ui.enable")
				{
					Mission.EnableUserUISync(val);
					return;
				}
				string text = FindClosestCommand(message);
				string text2 = (string.IsNullOrEmpty(text) ? "" : (" Did you mean '" + text + "'?"));
				SendSystemMessageToClient(val, "Invalid command: '" + message + "'." + text2);
			}
			else
			{
				Mission.DisableUserUISync(val);
			}
		}

		public static MessageType CheckMessage(string message, out string rawMessage)
		{
			return UnwrapMessage(message, out rawMessage);
		}

		public static string WrapMessage(MessageType messageType, string message)
		{
			return $"{"[BetterMissions]"}{":"}{"If you see this, you need to install BetterMissions v2.2.0 on client side or type 'bm.ui.disable'!"}{":"}{"2.2.0"}{":"}{messageType}{":"}{EncodeMessage(message)}";
		}

		public static MessageType UnwrapMessage(string message, out string rawMessage)
		{
			rawMessage = message;
			try
			{
				if (IsPluginMessage(message))
				{
					string[] array = message.Split(":");
					if (array.Length != 5)
					{
						return MessageType.InvalidMessage;
					}
					if (array[2] != "2.2.0")
					{
						return MessageType.InvalidMessage;
					}
					if (Enum.TryParse<MessageType>(array[3], out var result))
					{
						rawMessage = DecodeMessage(array[4]);
						return result;
					}
				}
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
			return MessageType.InvalidMessage;
		}

		public static bool IsPluginMessage(string message)
		{
			if (!message.StartsWith("[BetterMissions]"))
			{
				return false;
			}
			return true;
		}

		public static bool IsCommandMessage(string message)
		{
			if (!message.StartsWith("bm."))
			{
				return false;
			}
			if (message == "bm.")
			{
				return false;
			}
			return true;
		}

		private static string EncodeMessage(string message)
		{
			using MemoryStream memoryStream = new MemoryStream();
			using (GZipStream gZipStream = new GZipStream(memoryStream, CompressionLevel.Fastest, leaveOpen: true))
			{
				byte[] bytes = Encoding.UTF8.GetBytes(message);
				gZipStream.Write(bytes, 0, bytes.Length);
			}
			return Convert.ToBase64String(memoryStream.ToArray());
		}

		private static string DecodeMessage(string encodedMessage)
		{
			using MemoryStream stream = new MemoryStream(Convert.FromBase64String(encodedMessage));
			using GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress);
			using MemoryStream memoryStream = new MemoryStream();
			gZipStream.CopyTo(memoryStream);
			return Encoding.UTF8.GetString(memoryStream.ToArray());
		}

		private static string FindClosestCommand(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return null;
			}
			string result = null;
			int num = int.MaxValue;
			string[] commandList = _commandList;
			foreach (string text in commandList)
			{
				int num2 = LevenshteinDistance(input.ToLower(), text.ToLower());
				if (num2 < num)
				{
					num = num2;
					result = text;
				}
			}
			if (num > 5)
			{
				return null;
			}
			return result;
		}

		private static int LevenshteinDistance(string s, string t)
		{
			int length = s.Length;
			int length2 = t.Length;
			int[,] array = new int[length + 1, length2 + 1];
			if (length == 0)
			{
				return length2;
			}
			if (length2 == 0)
			{
				return length;
			}
			for (int i = 0; i <= length; i++)
			{
				array[i, 0] = i;
			}
			for (int j = 0; j <= length2; j++)
			{
				array[0, j] = j;
			}
			for (int k = 1; k <= length2; k++)
			{
				for (int l = 1; l <= length; l++)
				{
					int num = ((s[l - 1] != t[k - 1]) ? 1 : 0);
					array[l, k] = Math.Min(Math.Min(array[l - 1, k] + 1, array[l, k - 1] + 1), array[l - 1, k - 1] + num);
				}
			}
			return array[length, length2];
		}
	}
}
namespace BetterMissions.Settings
{
	public class Config
	{
		public static void Load(ConfigFile configFile, ManualLogSource logger, string worldType)
		{
			ENV.Mission.Setup();
			Utils.Settings.Config.Setup("BetterMissions", configFile, 4);
			Utils.Settings.Config.Load();
			Utils.Logger.Config.Setup(logger, worldType);
		}
	}
	public static class ENV
	{
		public static class Mission
		{
			public static void Setup()
			{
				Utils.Settings.Config.AddConfigActions(load);
			}

			private static void load()
			{
				MissionLengthModifier = Utils.Settings.Config.Bind(missionGeneral, "MissionLengthModifier", 2f, "Define the mission length modifier. (MissionLength / modifier)");
				EnableMissionRaidStability = Utils.Settings.Config.Bind(missionGeneral, "EnableMissionRaidStability", defaultValue: false, "Disabled, will use the default mission raid stability settings, if enabled, will use the MissionRaidStability type to all missions type.");
				MissionRaidStability = Utils.Settings.Config.Bind<RaidStability>(missionGeneral, "MissionRaidStability", (RaidStability)2, "Define the mission raid stability type. Only used if EnableMissionRaidStability is enabled.");
				MissionSuccessRateBonusModifier = Utils.Settings.Config.Bind(missionGeneral, "MissionSuccessRateBonusModifier", 1f, "Define the mission success rate bonus modifier. (MissionSuccessRateBonus / modifier)");
				MissionInjuryChanceModifier = Utils.Settings.Config.Bind(missionGeneral, "MissionInjuryChanceModifier", 1f, "Define the mission injury chance bonus modifier. (MissionInjuryChance / modifier)");
				MissionLootFactorModifier = Utils.Settings.Config.Bind(missionGeneral, "MissionLootFactorModifier", 1f, "Define the mission loot factor bonus modifier. (MissionLootFactor / modifier)");
				EnableReckless1Settings = Utils.Settings.Config.Bind(missionReckless1, "EnableReckless1Settings", defaultValue: false, "Enabled, will use the specific mission level settings");
				Reckless1MissionLength = Utils.Settings.Config.Bind(missionReckless1, "Reckless1MissionLength", 7200, "Define the Reckless1 mission length in seconds.");
				Reckless1RaidStability = Utils.Settings.Config.Bind<RaidStability>(missionReckless1, "Reckless1RaidStability", (RaidStability)0, "Define the Reckless1 raid stability.");
				Reckless1MissionSuccessRateBonus = Utils.Settings.Config.Bind(missionReckless1, "Reckless1MissionSuccessRateBonus", 0f, "Define the Reckless1 mission success rate bonus.");
				Reckless1MissionInjuryChance = Utils.Settings.Config.Bind(missionReckless1, "Reckless1MissionInjuryChance", 0.25f, "Define the Reckless1 mission injury chance bonus.");
				Reckless1MissionLootFactor = Utils.Settings.Config.Bind(missionReckless1, "Reckless1MissionLootFactor", 0.5f, "Define the Reckless1 mission loot factor bonus.");
				EnableReckless2Settings = Utils.Settings.Config.Bind(missionReckless2, "EnableReckless2Settings", defaultValue: false, "Enabled, will use the specific mission level settings");
				Reckless2MissionLength = Utils.Settings.Config.Bind(missionReckless2, "Reckless2MissionLength", 14400, "Define the Reckless2 mission length in seconds.");
				Reckless2RaidStability = Utils.Settings.Config.Bind<RaidStability>(missionReckless2, "Reckless2RaidStability", (RaidStability)0, "Define the Reckless2 raid stability.");
				Reckless2MissionSuccessRateBonus = Utils.Settings.Config.Bind(missionReckless2, "Reckless2MissionSuccessRateBonus", 0.05f, "Define the Reckless2 mission success rate bonus.");
				Reckless2MissionInjuryChance = Utils.Settings.Config.Bind(missionReckless2, "Reckless2MissionInjuryChance", 0.25f, "Define the Reckless2 mission injury chance bonus.");
				Reckless2MissionLootFactor = Utils.Settings.Config.Bind(missionReckless2, "Reckless2MissionLootFactor", 0.75f, "Define the Reckless2 mission loot factor bonus.");
				EnableNormal1Settings = Utils.Settings.Config.Bind(missionNormal1, "EnableNormal1Settings", defaultValue: false, "Enabled, will use the specific mission level settings");
				Normal1MissionLength = Utils.Settings.Config.Bind(missionNormal1, "Normal1MissionLength", 23400, "Define the Normal1 mission length in seconds.");
				Normal1RaidStability = Utils.Settings.Config.Bind<RaidStability>(missionNormal1, "Normal1RaidStability", (RaidStability)2, "Define the Normal1 raid stability.");
				Normal1MissionSuccessRateBonus = Utils.Settings.Config.Bind(missionNormal1, "Normal1MissionSuccessRateBonus", 0.1f, "Define the Normal1 mission success rate bonus.");
				Normal1MissionInjuryChance = Utils.Settings.Config.Bind(missionNormal1, "Normal1MissionInjuryChance", 0.2f, "Define the Normal1 mission injury chance bonus.");
				Normal1MissionLootFactor = Utils.Settings.Config.Bind(missionNormal1, "Normal1MissionLootFactor", 1f, "Define the Normal1 mission loot factor bonus.");
				EnablePrepared1Settings = Utils.Settings.Config.Bind(missionPrepared1, "EnablePrepared1Settings", defaultValue: false, "Enabled, will use the specific mission level settings");
				Prepared1MissionLength = Utils.Settings.Config.Bind(missionPrepared1, "Prepared1MissionLength", 36000, "Define the Prepared1 mission length in seconds.");
				Prepared1RaidStability = Utils.Settings.Config.Bind<RaidStability>(missionPrepared1, "Prepared1RaidStability", (RaidStability)1, "Define the Prepared1 raid stability.");
				Prepared1MissionSuccessRateBonus = Utils.Settings.Config.Bind(missionPrepared1, "Prepared1MissionSuccessRateBonus", 0.15f, "Define the Prepared1 mission success rate bonus.");
				Prepared1MissionInjuryChance = Utils.Settings.Config.Bind(missionPrepared1, "Prepared1MissionInjuryChance", 0.15f, "Define the Prepared1 mission injury chance bonus.");
				Prepared1MissionLootFactor = Utils.Settings.Config.Bind(missionPrepared1, "Prepared1MissionLootFactor", 1.25f, "Define the Prepared1 mission loot factor bonus.");
				EnablePrepared2Settings = Utils.Settings.Config.Bind(missionPrepared2, "EnablePrepared2Settings", defaultValue: false, "Enabled, will use the specific mission level settings");
				Prepared2MissionLength = Utils.Settings.Config.Bind(missionPrepared2, "Prepared2MissionLength", 57600, "Define the Prepared2 mission length in seconds.");
				Prepared2RaidStability = Utils.Settings.Config.Bind<RaidStability>(missionPrepared2, "Prepared2RaidStability", (RaidStability)1, "Define the Prepared2 raid stability.");
				Prepared2MissionSuccessRateBonus = Utils.Settings.Config.Bind(missionPrepared2, "Prepared2MissionSuccessRateBonus", 0.2f, "Define the Prepared2 mission success rate bonus.");
				Prepared2MissionInjuryChance = Utils.Settings.Config.Bind(missionPrepared2, "Prepared2MissionInjuryChance", 0.15f, "Define the Prepared2 mission injury chance bonus.");
				Prepared2MissionLootFactor = Utils.Settings.Config.Bind(missionPrepared2, "Prepared2MissionLootFactor", 1.5f, "Define the Prepared2 mission loot factor bonus.");
				validateValues();
			}

			private static void validateValues()
			{
				//IL_0025: 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_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Unknown result type (might be due to invalid IL or missing references)
				//IL_0211: Unknown result type (might be due to invalid IL or missing references)
				if (EnableReckless1Settings.Value)
				{
					BetterMissions.Database.Mission.Settings.TryAdd("Reckless_1", new BetterMissions.Database.Mission.Setting
					{
						RaidStability = Reckless1RaidStability.Value,
						InjuryChance = Reckless1MissionInjuryChance.Value,
						LootFactor = Reckless1MissionLootFactor.Value,
						MissionLength = Reckless1MissionLength.Value,
						SuccessRateBonus = Reckless1MissionSuccessRateBonus.Value
					});
				}
				if (EnableReckless2Settings.Value)
				{
					BetterMissions.Database.Mission.Settings.TryAdd("Reckless_2", new BetterMissions.Database.Mission.Setting
					{
						RaidStability = Reckless2RaidStability.Value,
						InjuryChance = Reckless2MissionInjuryChance.Value,
						LootFactor = Reckless2MissionLootFactor.Value,
						MissionLength = Reckless2MissionLength.Value,
						SuccessRateBonus = Reckless2MissionSuccessRateBonus.Value
					});
				}
				if (EnableNormal1Settings.Value)
				{
					BetterMissions.Database.Mission.Settings.TryAdd("Normal_1", new BetterMissions.Database.Mission.Setting
					{
						RaidStability = Normal1RaidStability.Value,
						InjuryChance = Normal1MissionInjuryChance.Value,
						LootFactor = Normal1MissionLootFactor.Value,
						MissionLength = Normal1MissionLength.Value,
						SuccessRateBonus = Normal1MissionSuccessRateBonus.Value
					});
				}
				if (EnablePrepared1Settings.Value)
				{
					BetterMissions.Database.Mission.Settings.TryAdd("Prepared_1", new BetterMissions.Database.Mission.Setting
					{
						RaidStability = Prepared1RaidStability.Value,
						InjuryChance = Prepared1MissionInjuryChance.Value,
						LootFactor = Prepared1MissionLootFactor.Value,
						MissionLength = Prepared1MissionLength.Value,
						SuccessRateBonus = Prepared1MissionSuccessRateBonus.Value
					});
				}
				if (EnablePrepared2Settings.Value)
				{
					BetterMissions.Database.Mission.Settings.TryAdd("Prepared_2", new BetterMissions.Database.Mission.Setting
					{
						RaidStability = Prepared2RaidStability.Value,
						InjuryChance = Prepared2MissionInjuryChance.Value,
						LootFactor = Prepared2MissionLootFactor.Value,
						MissionLength = Prepared2MissionLength.Value,
						SuccessRateBonus = Prepared2MissionSuccessRateBonus.Value
					});
				}
				Utils.Settings.Config.Save();
			}
		}

		private static string missionGeneral = "0.\ud83d\udea9 Mission";

		public static ConfigElement<bool> EnableMissionRaidStability;

		public static ConfigElement<RaidStability> MissionRaidStability;

		public static ConfigElement<float> MissionLengthModifier;

		public static ConfigElement<float> MissionSuccessRateBonusModifier;

		public static ConfigElement<float> MissionInjuryChanceModifier;

		public static ConfigElement<float> MissionLootFactorModifier;

		private static string missionReckless1 = "1.\ud83d\udea9 Mission-Reckless-1";

		private static ConfigElement<bool> EnableReckless1Settings;

		private static ConfigElement<int> Reckless1MissionLength;

		private static ConfigElement<RaidStability> Reckless1RaidStability;

		private static ConfigElement<float> Reckless1MissionSuccessRateBonus;

		private static ConfigElement<float> Reckless1MissionInjuryChance;

		private static ConfigElement<float> Reckless1MissionLootFactor;

		private static string missionReckless2 = "2.\ud83d\udea9 Mission-Reckless-2";

		private static ConfigElement<bool> EnableReckless2Settings;

		private static ConfigElement<int> Reckless2MissionLength;

		private static ConfigElement<RaidStability> Reckless2RaidStability;

		private static ConfigElement<float> Reckless2MissionSuccessRateBonus;

		private static ConfigElement<float> Reckless2MissionInjuryChance;

		private static ConfigElement<float> Reckless2MissionLootFactor;

		private static string missionNormal1 = "3.\ud83d\udea9 Mission-Normal";

		private static ConfigElement<bool> EnableNormal1Settings;

		private static ConfigElement<int> Normal1MissionLength;

		private static ConfigElement<RaidStability> Normal1RaidStability;

		private static ConfigElement<float> Normal1MissionSuccessRateBonus;

		private static ConfigElement<float> Normal1MissionInjuryChance;

		private static ConfigElement<float> Normal1MissionLootFactor;

		private static string missionPrepared1 = "4.\ud83d\udea9 Mission-Prepared-1";

		private static ConfigElement<bool> EnablePrepared1Settings;

		private static ConfigElement<int> Prepared1MissionLength;

		private static ConfigElement<RaidStability> Prepared1RaidStability;

		private static ConfigElement<float> Prepared1MissionSuccessRateBonus;

		private static ConfigElement<float> Prepared1MissionInjuryChance;

		private static ConfigElement<float> Prepared1MissionLootFactor;

		private static string missionPrepared2 = "5.\ud83d\udea9 Mission-Prepared-2";

		private static ConfigElement<bool> EnablePrepared2Settings;

		private static ConfigElement<int> Prepared2MissionLength;

		private static ConfigElement<RaidStability> Prepared2RaidStability;

		private static ConfigElement<float> Prepared2MissionSuccessRateBonus;

		private static ConfigElement<float> Prepared2MissionInjuryChance;

		private static ConfigElement<float> Prepared2MissionLootFactor;
	}
}
namespace BetterMissions.Models
{
	public class ServantMissionSetting
	{
		public float InjuryChance { get; set; }

		public float LootFactor { get; set; }

		public float MissionLength { get; set; }

		public RaidStability RaidStability { get; set; }

		public float SuccessRateBonus { get; set; }
	}
}
namespace BetterMissions.Hooks.Server
{
	[HarmonyPatch]
	public class BuffSystem_Spawn_ServerPatch
	{
		[HarmonyPatch(typeof(BuffSystem_Spawn_Server), "OnUpdate")]
		public class OnUpdate
		{
			public static void Prefix(BuffSystem_Spawn_Server __instance)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_0091: 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_00c3: 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)
				EntityQuery query = __instance._Query;
				NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				try
				{
					Enumerator<Entity> enumerator = val.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						try
						{
							PrefabGUID val2 = current.Read<PrefabGUID>();
							Entity owner = current.Read<EntityOwner>().Owner;
							if (owner.Has<PlayerCharacter>())
							{
								PlayerCharacter val3 = owner.Read<PlayerCharacter>();
								if (!(val2 != Prefabs.AB_Interact_Throne_Buff_Sit))
								{
									User val4 = val3.UserEntity.Read<User>();
									Log.Trace($"User: {val4.CharacterName}:{val4.Index} is sitting on the throne: {val2}");
									BetterMissions.Systems.Mission.UpdateUserDataUI(val4);
								}
							}
						}
						catch (Exception value)
						{
							Log.Warning($"Failed to process buffEntity: {value}");
						}
					}
				}
				finally
				{
					val.Dispose();
				}
			}
		}
	}
	[HarmonyPatch]
	public class ChatMessageSystemPatch
	{
		[HarmonyPatch(typeof(ChatMessageSystem), "OnUpdate")]
		public class OnUpdate
		{
			public static void Prefix(ChatMessageSystem __instance)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				EntityQuery val = ((Il2CppArrayBase<EntityQuery>)(object)((ComponentSystemBase)__instance).EntityQueries)[0];
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				try
				{
					for (int i = 0; i < val2.Length; i++)
					{
						try
						{