Decompiled source of CoffinSleep v2.0.2

CoffinSleep.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bloodstone.API;
using CoffinSleep.Settings;
using CoffinSleep.Systems;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.Network;
using ProjectM.Scripting;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Utils.Database;
using Utils.Logger;
using Utils.Settings;
using Utils.VRising.Entities;
using Utils.VRising.Systems;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CoffinSleep")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A VRising mod that speeds up time while you sleep in your coffin.")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[assembly: AssemblyInformationalVersion("2.0.2+3.Branch.main.Sha.fe3bdb3003f252b6ace5e599a2ecc9a6f63cb8bc")]
[assembly: AssemblyProduct("CoffinSleep")]
[assembly: AssemblyTitle("CoffinSleep")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.2.0")]
[module: UnverifiableCode]
namespace Utils.VRising.Systems
{
	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_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_001c: 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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_0005: 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)
			return ((EntityManager)(ref World.em)).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 PlayerCharacter
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_001c: 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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_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_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)
			PlayerCharacter componentData = ((EntityManager)(ref World.em)).GetComponentData<PlayerCharacter>(playerCharacter);
			return ((EntityManager)(ref World.em)).GetComponentData<User>(componentData.UserEntity).IsConnected;
		}

		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_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_001c: 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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_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)
			return ((EntityManager)(ref World.em)).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_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)
			((EntityManager)(ref World.em)).SetComponentData<ServantCoffinstation>(coffinStationEntity, coffinStation);
		}
	}
	public static class ServantMissionSetting
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_001c: 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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			if (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				return ((EntityManager)(ref World.em)).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_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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Entity val = ((EntityManager)(ref World.em)).CreateEntity((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<SetTimeOfDayEvent>() });
			((EntityManager)(ref World.em)).SetComponentData<SetTimeOfDayEvent>(val, new SetTimeOfDayEvent
			{
				Hour = hour,
				Day = day,
				Type = type
			});
		}
	}
	public static class Sleeping
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_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_0022: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<Entity> enumerator = sleepingEntities.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (((EntityManager)(ref World.em)).GetComponentData<Buff>(current).Target == target)
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class User
	{
		public static NativeArray<Entity> GetAll()
		{
			//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_001c: 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)
			EntityQuery val = ((EntityManager)(ref World.em)).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_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_0035: 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)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (((EntityManager)(ref World.em)).GetComponentData<User>(current).IsConnected)
				{
					return current;
				}
			}
			return Entity.Null;
		}

		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_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)
			Enumerator<Entity> enumerator = GetAll().GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				if (((EntityManager)(ref World.em)).GetComponentData<User>(current).IsConnected)
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class World
	{
		internal static World _world;

		internal static EntityManager em = world.EntityManager;

		public static World world
		{
			get
			{
				if (_world != null)
				{
					return _world;
				}
				Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
				while (enumerator.MoveNext())
				{
					World current = enumerator.Current;
					if (current.Name == "Server" || current.Name == "Client")
					{
						_world = current;
					}
				}
				return _world;
			}
		}

		public static void Set(World world)
		{
			_world = world;
		}
	}
}
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 ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
		{
			return cfg.Bind<T>(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 static class ENV
	{
		public class Debug
		{
			private static string debugSection = "\ud83e\udeb2Debug";

			private static ConfigEntry<bool> DebugLogOnTempFile;

			private static ConfigEntry<bool> DebugEnableTraceLogs;

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

			private static void load(int skipCaller)
			{
				if (enableDebugConfigs(skipCaller))
				{
					DebugLogOnTempFile = Config.cfg.Bind<bool>(debugSection, "LogOnTempFile", false, "Enabled, will log every plugin log on a temp file");
					DebugEnableTraceLogs = Config.cfg.Bind<bool>(debugSection, "EnableTraceLogs", 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 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 CoffinSleep
{
	[BepInPlugin("CoffinSleep", "CoffinSleep", "2.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		public override void Load()
		{
			if (VWorld.IsServer)
			{
				Server.Load(((BasePlugin)this).Config, ((BasePlugin)this).Log);
			}
			if (VWorld.IsClient)
			{
				Client.Load(((BasePlugin)this).Config, ((BasePlugin)this).Log);
			}
		}

		public override bool Unload()
		{
			if (VWorld.IsServer)
			{
				Server.Unload();
			}
			if (VWorld.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
			CoffinSleep.Settings.Config.Load(config, logger, "Server");
			harmony = new Harmony("CoffinSleep");
			Log.Trace("Patching harmony");
			harmony.PatchAll();
			Log.Info("Plugin CoffinSleep v2.0.2 server side is loaded!");
		}

		internal static bool Unload()
		{
			harmony.UnpatchSelf();
			Log.Info("Plugin CoffinSleep v2.0.2 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
			CoffinSleep.Settings.Config.Load(config, logger, "Client");
			harmony = new Harmony("CoffinSleep");
			Log.Trace("Patching harmony");
			harmony.PatchAll();
			Log.Info("Plugin CoffinSleep v2.0.2 client side is loaded!");
		}

		internal static bool Unload()
		{
			harmony.UnpatchSelf();
			Log.Info("Plugin CoffinSleep v2.0.2 client side is unloaded!");
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CoffinSleep";

		public const string PLUGIN_NAME = "CoffinSleep";

		public const string PLUGIN_VERSION = "2.0.2";
	}
}
namespace CoffinSleep.Systems
{
	public static class RotationCycle
	{
		private static int transitionControl = 3;

		public static void IncreaseTime(params Action<int>[] actions)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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)
			DayNightCycle singleton = DayNightCycle.GetSingleton();
			if ((CoffinSleep.Settings.ENV.OnlyDayTimeSleep.Value && !DayNightCycle.IsDay(singleton)) || (CoffinSleep.Settings.ENV.SleepBloodMoon.Value && DayNightCycle.IsBloodMoonDay(singleton) && !DayNightCycle.IsDay(singleton)) || User.IsAllOffline() || (CoffinSleep.Settings.ENV.OnlyAllPlayersSleeping.Value && !PlayerCharacter.IsAllOnlinePlayersSleeping()) || Cache.IsBlocked("speed", 1000L))
			{
				return;
			}
			int modifier = CoffinSleep.Settings.ENV.IncreasedTime.Value;
			if (CoffinSleep.Settings.ENV.PauseDuringTransitions.Value && !CoffinSleep.Settings.ENV.OnlyDayTimeSleep.Value)
			{
				handleModifier(ref modifier, singleton);
			}
			if (modifier != 0)
			{
				for (int i = 0; i < actions.Length; i++)
				{
					actions[i](modifier);
				}
				SetTimeOfDayEvent.Add(modifier);
			}
		}

		private static void handleModifier(ref int modifier, DayNightCycle dnc)
		{
			//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_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			float timeSinceDayStart = DayNightCycle.GetTimeSinceDayStart(dnc);
			if (inTransition(timeSinceDayStart, dnc))
			{
				modifier = 0;
				return;
			}
			int num = transitionControl * 2;
			float dayDurationInSeconds = DayNightCycle.GetDayDurationInSeconds(dnc);
			float dayTimeDurationInSeconds = DayNightCycle.GetDayTimeDurationInSeconds(dnc);
			float num2 = (float)modifier * DayNightCycle.GetTimeScale(dnc).TimePerMinute;
			if (num2 > dayDurationInSeconds)
			{
				num2 = dayDurationInSeconds;
			}
			float num3 = timeSinceDayStart + num2;
			if (num3 > dayDurationInSeconds && !DayNightCycle.IsDay(dnc))
			{
				num2 = dayDurationInSeconds - timeSinceDayStart - (float)num;
			}
			else if (num3 > dayDurationInSeconds && DayNightCycle.IsDay(dnc))
			{
				num2 = dayTimeDurationInSeconds - timeSinceDayStart - (float)num;
			}
			else if (num3 > dayTimeDurationInSeconds && DayNightCycle.IsDay(dnc))
			{
				num2 = dayTimeDurationInSeconds - timeSinceDayStart - (float)num;
			}
			modifier = (int)(num2 / DayNightCycle.GetTimeScale(dnc).TimePerMinute);
			if (modifier < 0)
			{
				modifier = 0;
			}
		}

		private static bool inTransition(float gameDayTime, DayNightCycle dnc)
		{
			//IL_0001: 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)
			if (inNightToDayTransition(gameDayTime, dnc))
			{
				return true;
			}
			if (inDayToNightTransition(gameDayTime, dnc))
			{
				return true;
			}
			return false;
		}

		private static bool inNightToDayTransition(float gameDayTime, DayNightCycle dnc)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			float dayDurationInSeconds = DayNightCycle.GetDayDurationInSeconds(dnc);
			if (gameDayTime >= dayDurationInSeconds - (float)transitionControl && gameDayTime <= (float)transitionControl)
			{
				return true;
			}
			return false;
		}

		private static bool inDayToNightTransition(float gameDayTime, DayNightCycle dnc)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			float dayTimeDurationInSeconds = DayNightCycle.GetDayTimeDurationInSeconds(dnc);
			if (gameDayTime >= dayTimeDurationInSeconds - (float)transitionControl && gameDayTime <= dayTimeDurationInSeconds + (float)transitionControl)
			{
				return true;
			}
			return false;
		}
	}
}
namespace CoffinSleep.Settings
{
	public class Config
	{
		public static void Load(ConfigFile configFile, ManualLogSource logger, string worldType)
		{
			ENV.Server.Setup();
			Utils.Settings.Config.Setup("CoffinSleep", configFile, 4);
			Utils.Settings.Config.Load();
			Utils.Logger.Config.Setup(logger, worldType);
		}
	}
	public class ENV
	{
		public class Server
		{
			private static string serverSection = "\ud83d\udd27Server";

			public static void Setup()
			{
				Utils.Settings.Config.AddConfigActions(load);
			}

			public static void load()
			{
				IncreasedTime = Utils.Settings.Config.Bind(serverSection, "IncreasedTime", 1, "Change the increased game time in hours per real time second");
				OnlyDayTimeSleep = Utils.Settings.Config.Bind(serverSection, "OnlyDayTimeSleep", defaultValue: true, "Enabled, sleep just speeds the time when it's daytime");
				OnlyAllPlayersSleeping = Utils.Settings.Config.Bind(serverSection, "OnlyAllPlayersSleeping", defaultValue: true, "Enabled, sleep just speeds the time if all players of the server are sleeping");
				PauseDuringTransitions = Utils.Settings.Config.Bind(serverSection, "PauseDuringTransitions", defaultValue: true, "Enabled, will stop time speed during the day and night transitions");
				SleepBloodMoon = Utils.Settings.Config.Bind(serverSection, "SleepBloodMoon", defaultValue: false, "Enabled, will stop time speed during blood moon nights");
			}
		}

		public static ConfigEntry<int> IncreasedTime;

		public static ConfigEntry<bool> OnlyDayTimeSleep;

		public static ConfigEntry<bool> OnlyAllPlayersSleeping;

		public static ConfigEntry<bool> PauseDuringTransitions;

		public static ConfigEntry<bool> SleepBloodMoon;
	}
}
namespace CoffinSleep.Hooks
{
	[HarmonyPatch]
	public class SleepInsideSystemPatch
	{
		[HarmonyPatch(typeof(SleepInsideSystem), "OnCreate")]
		public static class OnCreate
		{
			private static void Prefix(SleepInsideSystem __instance)
			{
				try
				{
					if (VWorld.IsClient)
					{
						World.Set(VWorld.Client);
					}
					if (VWorld.IsServer)
					{
						World.Set(VWorld.Server);
					}
				}
				catch (Exception data)
				{
					Log.Fatal(data);
				}
			}
		}

		[HarmonyPatch(typeof(SleepInsideSystem), "OnUpdate")]
		public static class OnUpdate
		{
			private static void Prefix(SleepInsideSystem __instance)
			{
				try
				{
					RotationCycle.IncreaseTime();
				}
				catch (Exception data)
				{
					Log.Fatal(data);
				}
			}
		}
	}
}