Decompiled source of DailyQuest v1.1.0

DailyQuest.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using DailyQuest.Models;
using DailyQuest.Services;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Scenes;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DailyQuest")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A daily quest system for V Rising featuring three rotating quest tiers, customizable quest rewards, optional gear repair, reward buffs, and Discord webhook notifications")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("DailyQuest")]
[assembly: AssemblyTitle("DailyQuest")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 DailyQuest
{
	public static class Buffs
	{
		public static bool AddBuff(Entity User, Entity Character, PrefabGUID buffPrefab, int duration = 0, bool immortal = true)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0021: 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_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_0039: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>();
			ApplyBuffDebugEvent val = default(ApplyBuffDebugEvent);
			val.BuffPrefabGUID = buffPrefab;
			ApplyBuffDebugEvent val2 = val;
			FromCharacter val3 = default(FromCharacter);
			val3.User = User;
			val3.Character = Character;
			FromCharacter val4 = val3;
			Entity entity = default(Entity);
			if (!BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity))
			{
				existingSystemManaged.ApplyBuff(val4, val2);
				if (BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity))
				{
					if (entity.Has<CreateGameplayEventsOnSpawn>())
					{
						entity.Remove<CreateGameplayEventsOnSpawn>();
					}
					if (entity.Has<GameplayEventListeners>())
					{
						entity.Remove<GameplayEventListeners>();
					}
					if (immortal)
					{
						entity.Add<Buff_Persists_Through_Death>();
						if (entity.Has<RemoveBuffOnGameplayEvent>())
						{
							entity.Remove<RemoveBuffOnGameplayEvent>();
						}
						if (entity.Has<RemoveBuffOnGameplayEventEntry>())
						{
							entity.Remove<RemoveBuffOnGameplayEventEntry>();
						}
					}
					if (duration > -1 && duration != 0)
					{
						if (!entity.Has<LifeTime>())
						{
							entity.Add<LifeTime>();
							entity.Write<LifeTime>(new LifeTime
							{
								EndAction = (LifeTimeEndAction)2
							});
						}
						LifeTime componentData = entity.Read<LifeTime>();
						componentData.Duration = duration;
						entity.Write<LifeTime>(componentData);
					}
					else if (duration == -1)
					{
						if (entity.Has<LifeTime>())
						{
							LifeTime componentData2 = entity.Read<LifeTime>();
							componentData2.EndAction = (LifeTimeEndAction)0;
							entity.Write<LifeTime>(componentData2);
						}
						if (entity.Has<RemoveBuffOnGameplayEvent>())
						{
							entity.Remove<RemoveBuffOnGameplayEvent>();
						}
						if (entity.Has<RemoveBuffOnGameplayEventEntry>())
						{
							entity.Remove<RemoveBuffOnGameplayEventEntry>();
						}
					}
					return true;
				}
				return false;
			}
			return false;
		}

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

		private static bool _hasInitialized;

		public const int MAX_REPLY_LENGTH = 509;

		public static World Server
		{
			get
			{
				if (_server == null)
				{
					_server = GetWorld("Server");
				}
				return _server;
			}
		}

		public static EntityManager EntityManager => Server.EntityManager;

		public static GameDataSystem GameDataSystem => Server.GetExistingSystemManaged<GameDataSystem>();

		public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; }

		public static PrefabCollectionSystem PrefabCollection => Server.GetExistingSystemManaged<PrefabCollectionSystem>();

		public static ServerScriptMapper ServerScriptMapper { get; internal set; }

		public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager();

		public static ManualLogSource Log => Plugin.PluginLog;

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

		internal static bool IsServerReady()
		{
			if (_server == null)
			{
				_server = GetWorld("Server");
			}
			if (_server == null)
			{
				return false;
			}
			PrefabCollectionSystem existingSystemManaged = _server.GetExistingSystemManaged<PrefabCollectionSystem>();
			return existingSystemManaged != null;
		}

		internal static void InitializeAfterLoaded()
		{
			if (!_hasInitialized)
			{
				if (!IsServerReady())
				{
					Log.LogWarning((object)"Server world is not ready yet.");
					return;
				}
				PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>();
				ServerScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>();
				QuestService.Initialize();
				_hasInitialized = true;
			}
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}
	}
	public static class ECSExtensions
	{
		public delegate void ActionRef<T>(ref T item);

		public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
		{
			//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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			byte[] array = StructureToByteArray(componentData);
			int num = Marshal.SizeOf<T>();
			fixed (byte* ptr = array)
			{
				EntityManager entityManager = Core.EntityManager;
				((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num);
			}
		}

		public static void With<T>(this Entity entity, ActionRef<T> action) where T : struct
		{
			//IL_0001: 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)
			T item = entity.ReadRW<T>();
			action(ref item);
			EntityManager entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
		}

		public unsafe static T ReadRW<T>(this Entity entity) where T : struct
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = Core.EntityManager;
			void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, val.TypeIndex);
			return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRW));
		}

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

		public unsafe static T Read<T>(this Entity entity) where T : struct
		{
			//IL_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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = Core.EntityManager;
			void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex);
			return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO));
		}

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

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

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

		public static string PrefabName(this PrefabGUID prefabGuid)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return prefabGuid.LookupName();
		}

		public static string EntityName(this Entity entity)
		{
			//IL_0007: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			string text = string.Empty;
			if (entity.Has<NameableInteractable>())
			{
				NameableInteractable val = entity.Read<NameableInteractable>();
				text = ((object)(FixedString64Bytes)(ref val.Name)).ToString();
			}
			if (string.IsNullOrEmpty(text) && entity.Has<PrefabGUID>())
			{
				text = entity.Read<PrefabGUID>().PrefabName();
			}
			if (string.IsNullOrEmpty(text))
			{
				text = ((object)(Entity)(ref entity)).ToString();
			}
			return text;
		}

		public static void Add<T>(this Entity entity)
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).AddComponent(entity, val);
		}

		public static void Remove<T>(this Entity entity)
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			EntityManager entityManager = Core.EntityManager;
			((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
		}
	}
	internal static class Helper
	{
		private static readonly HashSet<int> SoulShards = new HashSet<int> { 666638454, -1581189572, -1260254082, -21943750, 1286615355 };

		public static PrefabGUID GetPrefabGUID(Entity entity)
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Core.EntityManager;
			try
			{
				return ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
			}
			catch
			{
				return new PrefabGUID(0);
			}
		}

		public static NativeArray<Entity> GetEntitiesByComponentType<T>()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<T>() });
			NativeArray<Entity> result = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			((EntityQuery)(ref val)).Dispose();
			return result;
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>()
		{
			//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_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_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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<T1>(),
				ComponentType.ReadOnly<T2>()
			});
			NativeArray<Entity> result = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			((EntityQuery)(ref val)).Dispose();
			return result;
		}

		public static Entity AddItemToInventory(Entity recipient, PrefabGUID guid, int amount)
		{
			//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_0014: 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_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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0041: 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)
			try
			{
				ServerGameManager serverGameManager = Core.Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager;
				AddItemResponse val = ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(recipient, guid, amount);
				return val.NewEntity;
			}
			catch (Exception e)
			{
				Core.LogException(e, "AddItemToInventory");
			}
			return default(Entity);
		}

		private static void HandleEquipment(Entity itemEntity, bool repair)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!(itemEntity == Entity.Null) && itemEntity.Has<Durability>())
			{
				Durability val = itemEntity.Read<Durability>();
				val.Value = (repair ? val.MaxDurability : 0f);
				itemEntity.Write<Durability>(val);
			}
		}

		public static void RepairArmor(Entity character, bool repair = true)
		{
			//IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (character.Has<Equipment>())
				{
					Equipment val = character.Read<Equipment>();
					HandleEquipment(((NetworkedEntity)(ref val.ArmorChestSlot.SlotEntity)).GetEntityOnServer(), repair);
					HandleEquipment(((NetworkedEntity)(ref val.ArmorGlovesSlot.SlotEntity)).GetEntityOnServer(), repair);
					HandleEquipment(((NetworkedEntity)(ref val.ArmorLegsSlot.SlotEntity)).GetEntityOnServer(), repair);
					HandleEquipment(((NetworkedEntity)(ref val.ArmorFootgearSlot.SlotEntity)).GetEntityOnServer(), repair);
				}
			}
			catch (Exception e)
			{
				Core.LogException(e, "RepairArmor");
			}
		}

		public static void RepairAmulet(Entity character, bool repair = true)
		{
			//IL_0002: 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_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!character.Has<Equipment>())
				{
					return;
				}
				Equipment val = character.Read<Equipment>();
				Entity entityOnServer = ((NetworkedEntity)(ref val.GrimoireSlot.SlotEntity)).GetEntityOnServer();
				if (!(entityOnServer == Entity.Null) && entityOnServer.Has<PrefabGUID>())
				{
					PrefabGUID val2 = entityOnServer.Read<PrefabGUID>();
					if (!SoulShards.Contains(((PrefabGUID)(ref val2)).GuidHash))
					{
						HandleEquipment(entityOnServer, repair);
					}
				}
			}
			catch (Exception e)
			{
				Core.LogException(e, "RepairAmulet");
			}
		}

		public static void RepairWeapon(Entity character, bool repair = true)
		{
			//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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Entity val = default(Entity);
				if (!InventoryUtilities.TryGetInventoryEntity<EntityManager>(Core.EntityManager, character, ref val, 0))
				{
					return;
				}
				ServerScriptMapper existingSystemManaged = Core.Server.GetExistingSystemManaged<ServerScriptMapper>();
				if (existingSystemManaged == null)
				{
					return;
				}
				ServerGameManager serverGameManager = existingSystemManaged._ServerGameManager;
				DynamicBuffer<InventoryBuffer> val2 = default(DynamicBuffer<InventoryBuffer>);
				if (!((ServerGameManager)(ref serverGameManager)).TryGetBuffer<InventoryBuffer>(val, ref val2))
				{
					return;
				}
				for (int i = 0; i < 8 && i < val2.Length; i++)
				{
					InventoryBuffer val3 = val2[i];
					Entity entityOnServer = ((NetworkedEntity)(ref val3.ItemEntity)).GetEntityOnServer();
					if (!(entityOnServer == Entity.Null) && entityOnServer.Has<Durability>() && entityOnServer.Has<EquippableData>())
					{
						EquippableData val4 = entityOnServer.Read<EquippableData>();
						if ((int)val4.EquipmentType == 2)
						{
							HandleEquipment(entityOnServer, repair);
						}
					}
				}
			}
			catch (Exception e)
			{
				Core.LogException(e, "RepairWeapon");
			}
		}

		public static void TrySendBroadcastMessage(string playerName, List<string> claimedNames)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.BroadcastMessageEnabled != null && !Plugin.BroadcastMessageEnabled.Value)
			{
				return;
			}
			try
			{
				string newValue = string.Join(", ", claimedNames);
				string text = Plugin.BroadcastMessage?.Value ?? "";
				string text2 = text.Replace("#player#", playerName).Replace("#quest#", newValue);
				FixedString512Bytes val = default(FixedString512Bytes);
				((FixedString512Bytes)(ref val))..ctor(text2);
				ServerChatUtils.SendSystemMessageToAllClients(Core.EntityManager, ref val);
			}
			catch (Exception e)
			{
				Core.LogException(e, "TrySendBroadcastMessage");
			}
		}

		public static void TrySendWebhookMessage(string playerName, List<string> claimedNames)
		{
			if (Plugin.WebhookEnabled != null && !Plugin.WebhookEnabled.Value)
			{
				return;
			}
			try
			{
				string newValue = string.Join(", ", claimedNames);
				string text = Plugin.WebhookMessage?.Value ?? "";
				string message = text.Replace("#player#", playerName).Replace("#quest#", newValue);
				TrySendWebhookAsync(message);
			}
			catch (Exception e)
			{
				Core.LogException(e, "TrySendWebhookMessage");
			}
		}

		public static async Task TrySendWebhookAsync(string message)
		{
			try
			{
				var (ok, error) = await WebhookService.SendAsync(message).ConfigureAwait(continueOnCapturedContext: false);
				if (!ok && !string.IsNullOrWhiteSpace(error) && !string.Equals(error, "Webhook is disabled.", StringComparison.Ordinal) && !string.Equals(error, "Webhook URL is empty.", StringComparison.Ordinal))
				{
					ManualLogSource log = Core.Log;
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(10, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Webhook] ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(error);
					}
					log.LogWarning(val);
				}
			}
			catch (Exception ex)
			{
				Exception e = ex;
				Core.LogException(e, "TrySendWebhookAsync");
			}
		}

		public static void TryAddDailyQuestBuff(Entity userEntity, Entity characterEntity, PlayerQuestState st)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.ClaimedBuffEnabled == null || !Plugin.ClaimedBuffEnabled.Value)
			{
				return;
			}
			int num = Plugin.ClaimedBuffPrefab?.Value ?? 0;
			if (num == 0)
			{
				return;
			}
			try
			{
				if (st.ClaimedBuffPrefab != 0 && st.ClaimedBuffPrefab != num)
				{
					Buffs.RemoveBuff(characterEntity, new PrefabGUID(st.ClaimedBuffPrefab));
				}
				Buffs.AddBuff(userEntity, characterEntity, new PrefabGUID(num), -1);
				st.ClaimedBuffPrefab = num;
			}
			catch (Exception e)
			{
				Core.LogException(e, "TryAddDailyQuestBuff");
			}
		}

		public static bool TryRemoveDailyQuestBuff(Entity characterEntity, PlayerQuestState st)
		{
			//IL_0003: 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_000c: 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_0015: 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_0043: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			bool result = false;
			if (characterEntity == default(Entity) || characterEntity == Entity.Null)
			{
				return false;
			}
			try
			{
				if (st.ClaimedBuffPrefab != 0)
				{
					Buffs.RemoveBuff(characterEntity, new PrefabGUID(st.ClaimedBuffPrefab));
					st.ClaimedBuffPrefab = 0;
					result = true;
				}
				int num = Plugin.ClaimedBuffPrefab?.Value ?? 0;
				if (num != 0)
				{
					Buffs.RemoveBuff(characterEntity, new PrefabGUID(num));
				}
			}
			catch (Exception e)
			{
				Core.LogException(e, "TryRemoveDailyQuestBuff");
			}
			return result;
		}
	}
	[BepInPlugin("DailyQuest", "DailyQuest", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		internal static Harmony Harmony;

		internal static ManualLogSource PluginLog;

		public static ConfigFile PluginConfig;

		public static ConfigEntry<bool> GearRepairOnClaimEnabled;

		public static ConfigEntry<bool> BroadcastMessageEnabled;

		public static ConfigEntry<string> BroadcastMessage;

		public static ConfigEntry<bool> WebhookEnabled;

		public static ConfigEntry<string> WebhookUrl;

		public static ConfigEntry<string> WebhookMessage;

		public static ConfigEntry<bool> ClaimedBuffEnabled;

		public static ConfigEntry<int> ClaimedBuffPrefab;

		public static ManualLogSource LogInstance { get; private set; }

		public override void Load()
		{
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			if (Application.productName != "VRisingServer")
			{
				return;
			}
			PluginLog = ((BasePlugin)this).Log;
			LogInstance = ((BasePlugin)this).Log;
			PluginConfig = ((BasePlugin)this).Config;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DailyQuest");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			GearRepairOnClaimEnabled = ((BasePlugin)this).Config.Bind<bool>("Repair", "GearRepairOnClaim", false, "Enable gear repair when rewards are claimed.");
			BroadcastMessageEnabled = ((BasePlugin)this).Config.Bind<bool>("Broadcast", "BroadcastEnabled", true, "Enable in-game broadcast message when rewards are claimed.");
			BroadcastMessage = ((BasePlugin)this).Config.Bind<string>("Broadcast", "BroadcastMessage", "<color=white>#player#</color> completed and claimed rewards for: #quest#. Use <color=green>.quest daily</color> to check your quests.", "Format of the in-game broadcast message.");
			WebhookEnabled = ((BasePlugin)this).Config.Bind<bool>("Webhook", "WebhookEnabled", false, "Enable Discord webhook message when rewards are claimed.");
			WebhookUrl = ((BasePlugin)this).Config.Bind<string>("Webhook", "WebhookUrl", "", "Webhook URL. Example: https://discord.com/api/webhooks/123456789012345678/aBc1234d5Efg6H78ij9k0-L1m2nO3pq4RstU5v6w78Xyz9");
			WebhookMessage = ((BasePlugin)this).Config.Bind<string>("Webhook", "WebhookMessage", "**[Daily quest]** - **#player#** has completed and claimed the rewards for: #quest#", "Format of the Discord webhook message.");
			ClaimedBuffEnabled = ((BasePlugin)this).Config.Bind<bool>("Buff", "ClaimedBuffEnabled", false, "Enable giving a buff when rewards are claimed.");
			ClaimedBuffPrefab = ((BasePlugin)this).Config.Bind<int>("Buff", "ClaimedBuffPrefab", -463147620, "PrefabGUID of the buff to apply.");
			try
			{
				QuestService.EnsureFilesExist();
				MigrationService.RunAllMigrations();
				((BasePlugin)this).Log.LogInfo((object)"DailyQuest config files ensured.");
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = ((BasePlugin)this).Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to create DailyQuest files: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log2.LogError(val2);
			}
			Harmony = new Harmony("dailyquest");
			Harmony.PatchAll(Assembly.GetExecutingAssembly());
			CommandRegistry.RegisterAll();
		}

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

		public const string PLUGIN_NAME = "DailyQuest";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace DailyQuest.Services
{
	internal static class MigrationService
	{
		private sealed class LegacyWebhookConfig
		{
			public bool Enabled { get; set; }

			public string WebhookUrl { get; set; }
		}

		private static readonly string CONFIG_DIR = Path.Combine(Paths.ConfigPath, "DailyQuest");

		private static readonly string QUEST_CONFIG_FILE = Path.Combine(CONFIG_DIR, "quest_config.json");

		private static readonly string WEBHOOK_CONFIG_FILE = Path.Combine(CONFIG_DIR, "webhook_config.json");

		private static readonly string DATE_TIME = DateTime.Now.ToString("yyyyMMdd_HHmmss");

		private static readonly string BACKUP_DIR = Path.Combine(CONFIG_DIR, "OldVersionBackup");

		private static readonly string QUEST_CONFIG_BACKUP_FILE = Path.Combine(BACKUP_DIR, "quest_config_backup_" + DATE_TIME + ".json");

		private static readonly string WEBHOOK_CONFIG_BACKUP_FILE = Path.Combine(BACKUP_DIR, "webhook_config_backup_" + DATE_TIME + ".json");

		private static readonly string README_FILE = Path.Combine(BACKUP_DIR, "readme.txt");

		private static readonly JsonSerializerOptions JsonOpts = new JsonSerializerOptions
		{
			WriteIndented = true,
			AllowTrailingCommas = true,
			ReadCommentHandling = JsonCommentHandling.Skip,
			PropertyNameCaseInsensitive = true
		};

		public static void RunAllMigrations()
		{
			bool flag = MigrateQuestConfig();
			bool flag2 = MigrateWebhookConfig();
			if (flag || flag2)
			{
				CreateMigrationInfoFile();
			}
		}

		private static bool MigrateQuestConfig()
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			if (!File.Exists(QUEST_CONFIG_FILE))
			{
				return false;
			}
			bool flag = default(bool);
			try
			{
				string text = File.ReadAllText(QUEST_CONFIG_FILE);
				if (text.Contains("\"GearRepairOnClaim\":") || text.Contains("\"Quests\":"))
				{
					Core.Log.LogWarning((object)"[MigrationService] LEGACY QUEST FORMAT DETECTED! STARTING MIGRATION...");
					Directory.CreateDirectory(BACKUP_DIR);
					File.Copy(QUEST_CONFIG_FILE, QUEST_CONFIG_BACKUP_FILE, overwrite: true);
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MigrationService] Step 1. Quest Backup created at: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(QUEST_CONFIG_BACKUP_FILE);
					}
					log.LogInfo(val);
					QuestConfig questConfig = JsonSerializer.Deserialize<QuestConfig>(text, JsonOpts) ?? new QuestConfig();
					if (Plugin.GearRepairOnClaimEnabled != null)
					{
						Plugin.GearRepairOnClaimEnabled.Value = questConfig.RepairOnClaim;
						Plugin.PluginConfig.Save();
						Core.Log.LogInfo((object)"[MigrationService] Step 2. GearRepairOnClaim config moved to DailyQuest.cfg");
					}
					byte[] bytes = JsonSerializer.SerializeToUtf8Bytes(questConfig.Quests ?? new List<QuestDef>(), JsonOpts);
					File.WriteAllBytes(QUEST_CONFIG_FILE, bytes);
					Core.Log.LogInfo((object)"[MigrationService] Step 3. Quest file rewritten to NEW format successfully!");
					return true;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Core.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(42, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MigrationService] Quest Migration Error: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val2);
			}
			return false;
		}

		private static bool MigrateWebhookConfig()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			if (!File.Exists(WEBHOOK_CONFIG_FILE))
			{
				return false;
			}
			bool flag = default(bool);
			try
			{
				Core.Log.LogWarning((object)"[MigrationService] LEGACY WEBHOOK FORMAT DETECTED! STARTING MIGRATION...");
				Directory.CreateDirectory(BACKUP_DIR);
				File.Copy(WEBHOOK_CONFIG_FILE, WEBHOOK_CONFIG_BACKUP_FILE, overwrite: true);
				ManualLogSource log = Core.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MigrationService] Step 1. Webhook Backup created at: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(WEBHOOK_CONFIG_BACKUP_FILE);
				}
				log.LogInfo(val);
				string json = File.ReadAllText(WEBHOOK_CONFIG_FILE);
				LegacyWebhookConfig legacyWebhookConfig = JsonSerializer.Deserialize<LegacyWebhookConfig>(json, JsonOpts);
				if (legacyWebhookConfig != null)
				{
					Plugin.WebhookEnabled.Value = legacyWebhookConfig.Enabled;
					Plugin.WebhookUrl.Value = legacyWebhookConfig.WebhookUrl ?? "";
					Plugin.PluginConfig.Save();
					Core.Log.LogInfo((object)"[MigrationService] Step 2. Webhook settings moved to DailyQuest.cfg");
				}
				File.Delete(WEBHOOK_CONFIG_FILE);
				Core.Log.LogInfo((object)"[MigrationService] Step 3. Old webhook config file deleted successfully!");
				return true;
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Core.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(44, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MigrationService] Webhook Migration Error: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val2);
			}
			return false;
		}

		private static void CreateMigrationInfoFile()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				Directory.CreateDirectory(BACKUP_DIR);
				string contents = $"DailyQuest Migration Info Created at {DateTime.Now:yyyy-MM-dd HH:mm:ss}\r\n- 'quest_config_backup_xxxxxxxx_xxxxxx.json' and 'webhook_config_xxxxxxxx_xxxxxx.json' in {BACKUP_DIR} were created to safely back up your configurations from version 1.0.4 or older.\r\n- As of version 1.1.0, the 'GearRepairOnClaim' setting and all webhook configurations have been consolidated into 'BepInEx/config/DailyQuest.cfg' for easier management.\r\n- We have restructured 'quest_config.json' to contain only the quest list. All your existing quest setups will continue to function normally.\r\n- You can open the 'BepInEx/config/DailyQuest.cfg' to review the new configuration format.\r\n- If any settings in 'DailyQuest.cfg' are missing or incorrect, you can manually restore your original configurations from the backup files mentioned above.\r\n";
				File.WriteAllText(README_FILE, contents);
				ManualLogSource log = Core.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MigrationService] Migration info file created at: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(README_FILE);
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MigrationService] Could not create info file: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val2);
			}
		}
	}
	internal static class QuestService
	{
		private static readonly string CONFIG_DIR = Path.Combine(Paths.ConfigPath, "DailyQuest");

		private static readonly string CONFIG_FILE = Path.Combine(CONFIG_DIR, "quest_config.json");

		private static readonly string PLAYER_FILE = Path.Combine(CONFIG_DIR, "quest_player.json");

		private static readonly object _lock = new object();

		private static QuestConfig _config = new QuestConfig();

		private static Dictionary<string, QuestDef> _questsById = new Dictionary<string, QuestDef>(StringComparer.Ordinal);

		private static List<QuestDef> _allQuests = new List<QuestDef>();

		private static List<QuestDef> _easyQuests = new List<QuestDef>();

		private static List<QuestDef> _mediumQuests = new List<QuestDef>();

		private static List<QuestDef> _hardQuests = new List<QuestDef>();

		private static Dictionary<string, PlayerQuestState> _players = new Dictionary<string, PlayerQuestState>();

		private static HashSet<int> _allActiveTargetPrefabs = new HashSet<int>();

		private static string _cachedTodayString = DateTime.Now.ToString("yyyy-MM-dd");

		private static DateTime _lastDate = DateTime.MinValue.Date;

		private static bool _initialized;

		private static readonly JsonSerializerOptions JsonOpts = new JsonSerializerOptions
		{
			WriteIndented = true,
			AllowTrailingCommas = true,
			ReadCommentHandling = JsonCommentHandling.Skip,
			PropertyNameCaseInsensitive = true
		};

		public static string BuildStatusText(ulong sid, string playerName, Entity characterEntity = default(Entity))
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			EnsureAssignedForToday(sid, playerName, characterEntity);
			lock (_lock)
			{
				string key = sid.ToString();
				if (!_players.TryGetValue(key, out var value) || value == null)
				{
					return "<color=red>No data.</color>";
				}
				QuestDef questById_NoLock = GetQuestById_NoLock(value.EasyQuestId);
				QuestDef questById_NoLock2 = GetQuestById_NoLock(value.MediumQuestId);
				QuestDef questById_NoLock3 = GetQuestById_NoLock(value.HardQuestId);
				string text = BuildQuestBlock_NoLock("1", questById_NoLock, value.EasyProgress, value.EasyClaimed);
				string text2 = BuildQuestBlock_NoLock("2", questById_NoLock2, value.MediumProgress, value.MediumClaimed);
				string text3 = BuildQuestBlock_NoLock("3", questById_NoLock3, value.HardProgress, value.HardClaimed);
				return "<color=yellow>Daily Quests (Reset in " + GetNextResetText() + ")</color>\n" + text + "\n" + text2 + "\n" + text3;
			}
		}

		private static string BuildQuestBlock_NoLock(string label, QuestDef quest, int progress, bool claimed)
		{
			if (quest != null)
			{
				int num = Math.Max(0, quest.RequiredKills);
				int num2 = Math.Max(0, progress);
				if (num2 > num)
				{
					num2 = num;
				}
				string rewardDisplay_NoLock = GetRewardDisplay_NoLock(quest);
				string value = ((num <= 0 || num2 < num) ? $"Progress {num2}/{num}" : (claimed ? "Reward claimed" : "Completed! Claim with .quest reward"));
				return $"<color=#87CEFA>Quest {label}</color>: {quest.Name} x{num}\nReward: {rewardDisplay_NoLock}\nStatus: {value}";
			}
			return $"<color=#87CEFA>Quest {label}</color>: <color=yellow>No quest {label.ToLowerInvariant()} configured.</color>";
		}

		public static string BuildPlayerStatusTextByName(string playerName)
		{
			if (string.IsNullOrWhiteSpace(playerName))
			{
				return "<color=red>Invalid player name.</color>";
			}
			lock (_lock)
			{
				EnsureInitialized_NoLock();
				PlayerQuestState playerQuestState = _players.Values.FirstOrDefault((PlayerQuestState x) => x != null && !string.IsNullOrWhiteSpace(x.Name) && string.Equals(x.Name, playerName, StringComparison.OrdinalIgnoreCase));
				if (playerQuestState == null)
				{
					return "<color=red>Player not found in quest data.</color>";
				}
				QuestDef questById_NoLock = GetQuestById_NoLock(playerQuestState.EasyQuestId);
				QuestDef questById_NoLock2 = GetQuestById_NoLock(playerQuestState.MediumQuestId);
				QuestDef questById_NoLock3 = GetQuestById_NoLock(playerQuestState.HardQuestId);
				string text = BuildAdminQuestLine_NoLock("1", questById_NoLock, playerQuestState.EasyProgress, playerQuestState.EasyClaimed);
				string text2 = BuildAdminQuestLine_NoLock("2", questById_NoLock2, playerQuestState.MediumProgress, playerQuestState.MediumClaimed);
				string text3 = BuildAdminQuestLine_NoLock("3", questById_NoLock3, playerQuestState.HardProgress, playerQuestState.HardClaimed);
				string b = DateTime.Now.ToString("yyyy-MM-dd");
				bool flag = string.Equals(playerQuestState.Date, b, StringComparison.Ordinal);
				string text4 = "<color=yellow>Daily Quests: <color=white>" + playerQuestState.Name + "</color></color>";
				string text5 = (flag ? ("<color=#87CEFA>Quest Date</color>: " + playerQuestState.Date) : ("<color=#87CEFA>Quest Date</color>: " + playerQuestState.Date + " (Outdated)"));
				return text4 + "\n" + text + "\n" + text2 + "\n" + text3 + "\n" + text5;
			}
		}

		private static string BuildAdminQuestLine_NoLock(string label, QuestDef quest, int progress, bool claimed)
		{
			if (quest == null)
			{
				return "<color=#87CEFA>Quest " + label + "</color>: <color=yellow>No quest configured.</color>";
			}
			int num = Math.Max(0, quest.RequiredKills);
			int num2 = Math.Max(0, progress);
			if (num2 > num)
			{
				num2 = num;
			}
			string value = (claimed ? "(Reward claimed)" : ((num2 >= num) ? "(Completed)" : $"({num2}/{num})"));
			string value2 = (string.IsNullOrWhiteSpace(quest.Name) ? ("Quest " + label) : quest.Name);
			return $"<color=#87CEFA>Quest {label}</color>: {value2} {value}";
		}

		private static bool TryClaimOne_NoLock(Entity userEntity, Entity characterEntity, string label, string questId, int progress, bool alreadyClaimed, out string replyText, out PrefabGUID rewardPrefabOut, out int rewardAmountOut)
		{
			//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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			replyText = "";
			rewardPrefabOut = new PrefabGUID(0);
			rewardAmountOut = 0;
			if (string.IsNullOrWhiteSpace(questId))
			{
				replyText = "<color=#87CEFA>Quest " + label + "</color>: not assigned today.";
				return false;
			}
			QuestDef questById_NoLock = GetQuestById_NoLock(questId);
			if (questById_NoLock == null)
			{
				replyText = "<color=#87CEFA>Quest " + label + "</color>: not found in config.";
				return false;
			}
			int num = Math.Max(0, questById_NoLock.RequiredKills);
			if (num <= 0)
			{
				replyText = "<color=#87CEFA>Quest " + label + "</color>: has invalid requiredKills.";
				return false;
			}
			if (progress < num)
			{
				replyText = "<color=#87CEFA>Quest " + label + "</color>: not completed yet. Use <color=green>.quest daily</color> to check.";
				return false;
			}
			if (alreadyClaimed)
			{
				replyText = "<color=#87CEFA>Quest " + label + "</color>: reward already claimed today.";
				return false;
			}
			if (!TryResolveRewardPrefab_NoLock(questById_NoLock, out var rewardPrefab, out var rewardName))
			{
				replyText = "<color=red>Reward prefab not configured correctly.</color>";
				return false;
			}
			int num2 = Math.Max(0, questById_NoLock.Reward?.Amount ?? 0);
			if (num2 <= 0)
			{
				replyText = "<color=red>Reward amount invalid.</color>";
				return false;
			}
			rewardPrefabOut = rewardPrefab;
			rewardAmountOut = num2;
			replyText = $"<color=#87CEFA>Quest {label}</color>: reward claimed <color=#87CEFA>{num2}x {rewardName}</color>";
			return true;
		}

		private static void SendQuestToast(User user, string label, string questName, int prog, int need, bool done)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if (!(user == default(User)) && user.IsConnected)
			{
				if (need < 0)
				{
					need = 0;
				}
				if (prog < 0)
				{
					prog = 0;
				}
				if (prog > need)
				{
					prog = need;
				}
				string value = (done ? $"<color=green>{prog}/{need}</color>, Claim: <color=green>.quest reward</color>" : $"<color=yellow>{prog}/{need}</color>, Details: <color=green>.quest daily</color>");
				string text = $"<color=#87CEFA>Quest {label}</color>: <color=white>{questName}</color> {value}";
				FixedString512Bytes val = default(FixedString512Bytes);
				((FixedString512Bytes)(ref val))..ctor(text);
				ServerChatUtils.SendSystemMessageToClient(Core.EntityManager, user, ref val);
			}
		}

		private static string GetRewardDisplay_NoLock(QuestDef quest)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (quest?.Reward == null)
			{
				return "None";
			}
			string value = quest.Reward.Name ?? "";
			int amount = quest.Reward.Amount;
			if (string.IsNullOrWhiteSpace(value))
			{
				int prefab = quest.Reward.Prefab;
				if (prefab != 0)
				{
					try
					{
						value = ECSExtensions.LookupName(new PrefabGUID(prefab));
					}
					catch
					{
						value = prefab.ToString();
					}
				}
				else
				{
					value = "Unknown";
				}
			}
			return $"{Math.Max(0, amount)}x {value}";
		}

		private static string TodayString()
		{
			return _cachedTodayString;
		}

		public static bool IsQuestTarget(int prefabHash)
		{
			return _allActiveTargetPrefabs.Contains(prefabHash);
		}

		public static void Initialize()
		{
			lock (_lock)
			{
				EnsureInitialized_NoLock();
			}
		}

		private static void EnsureInitialized_NoLock()
		{
			if (!_initialized)
			{
				EnsureFilesExist();
				LoadConfig_NoLock();
				LoadPlayers_NoLock();
				SaveThrottle.Init(delegate
				{
					SavePlayers_NoLock();
				}, TimeSpan.FromSeconds(10.0));
				_lastDate = DateTime.Now.Date;
				_initialized = true;
			}
		}

		public static void Reload()
		{
			lock (_lock)
			{
				if (Plugin.PluginConfig != null)
				{
					Plugin.PluginConfig.Reload();
				}
				EnsureFilesExist();
				LoadConfig_NoLock();
				_initialized = true;
			}
			Core.Log.LogInfo((object)"[Quest] DailyQuest.cfg and quest_config.json reloaded successfully");
		}

		public static void EnsureAssignedForToday(ulong sid, string playerName, Entity characterEntity = default(Entity))
		{
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			if (sid == 0)
			{
				return;
			}
			lock (_lock)
			{
				EnsureInitialized_NoLock();
				RollDateIfNeeded_NoLock();
				string text = TodayString();
				string key = sid.ToString();
				bool flag = false;
				if (!_players.TryGetValue(key, out var value) || value == null)
				{
					value = new PlayerQuestState
					{
						SteamId = sid,
						Name = (playerName ?? ""),
						Date = text,
						EasyQuestId = "",
						EasyProgress = 0,
						EasyClaimed = false,
						MediumQuestId = "",
						MediumProgress = 0,
						MediumClaimed = false,
						HardQuestId = "",
						HardProgress = 0,
						HardClaimed = false
					};
					flag = true;
				}
				else
				{
					string text2 = playerName ?? value.Name ?? "";
					if (!string.Equals(value.Name, text2, StringComparison.Ordinal))
					{
						value.Name = text2;
						flag = true;
					}
				}
				if (!string.Equals(value.Date, text, StringComparison.Ordinal))
				{
					value.Date = text;
					value.EasyQuestId = "";
					value.EasyProgress = 0;
					value.EasyClaimed = false;
					value.MediumQuestId = "";
					value.MediumProgress = 0;
					value.MediumClaimed = false;
					value.HardQuestId = "";
					value.HardProgress = 0;
					value.HardClaimed = false;
					flag = true;
					if (Helper.TryRemoveDailyQuestBuff(characterEntity, value))
					{
						flag = true;
					}
				}
				if (string.IsNullOrWhiteSpace(value.EasyQuestId))
				{
					value.EasyQuestId = PickQuestId_NoLock(sid, text, "easy", _easyQuests);
					value.EasyProgress = 0;
					value.EasyClaimed = false;
					flag = true;
				}
				if (string.IsNullOrWhiteSpace(value.MediumQuestId))
				{
					value.MediumQuestId = PickQuestId_NoLock(sid, text, "medium", _mediumQuests);
					value.MediumProgress = 0;
					value.MediumClaimed = false;
					flag = true;
				}
				if (string.IsNullOrWhiteSpace(value.HardQuestId))
				{
					value.HardQuestId = PickQuestId_NoLock(sid, text, "hard", _hardQuests);
					value.HardProgress = 0;
					value.HardClaimed = false;
					flag = true;
				}
				if (flag)
				{
					_players[key] = value;
					SaveThrottle.MarkDirty();
				}
			}
		}

		public static bool TryClaim(ChatCommandContext ctx, ulong sid, string playerName, Entity characterEntity)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			EnsureAssignedForToday(sid, playerName);
			lock (_lock)
			{
				string key = sid.ToString();
				if (!_players.TryGetValue(key, out var value) || value == null)
				{
					ctx.Reply("<color=red>No quest data.</color>");
					return false;
				}
				Entity senderUserEntity = ctx.Event.SenderUserEntity;
				bool flag = false;
				List<string> list = new List<string>(3);
				List<(PrefabGUID, int)> list2 = new List<(PrefabGUID, int)>();
				if (TryClaimOne_NoLock(senderUserEntity, characterEntity, "1", value.EasyQuestId, value.EasyProgress, value.EasyClaimed, out var replyText, out var rewardPrefabOut, out var rewardAmountOut))
				{
					value.EasyClaimed = true;
					flag = true;
					list2.Add((rewardPrefabOut, rewardAmountOut));
					if (Plugin.GearRepairOnClaimEnabled != null && Plugin.GearRepairOnClaimEnabled.Value)
					{
						Helper.RepairAmulet(characterEntity);
					}
					QuestDef questById_NoLock = GetQuestById_NoLock(value.EasyQuestId);
					int value2 = Math.Max(0, questById_NoLock?.RequiredKills ?? 0);
					list.Add((questById_NoLock != null) ? $"{questById_NoLock.Name} x{value2}" : "Quest 1");
				}
				if (TryClaimOne_NoLock(senderUserEntity, characterEntity, "2", value.MediumQuestId, value.MediumProgress, value.MediumClaimed, out var replyText2, out var rewardPrefabOut2, out var rewardAmountOut2))
				{
					value.MediumClaimed = true;
					flag = true;
					list2.Add((rewardPrefabOut2, rewardAmountOut2));
					if (Plugin.GearRepairOnClaimEnabled != null && Plugin.GearRepairOnClaimEnabled.Value)
					{
						Helper.RepairArmor(characterEntity);
					}
					QuestDef questById_NoLock2 = GetQuestById_NoLock(value.MediumQuestId);
					int value3 = Math.Max(0, questById_NoLock2?.RequiredKills ?? 0);
					list.Add((questById_NoLock2 != null) ? $"{questById_NoLock2.Name} x{value3}" : "Quest 2");
				}
				if (TryClaimOne_NoLock(senderUserEntity, characterEntity, "3", value.HardQuestId, value.HardProgress, value.HardClaimed, out var replyText3, out var rewardPrefabOut3, out var rewardAmountOut3))
				{
					value.HardClaimed = true;
					flag = true;
					list2.Add((rewardPrefabOut3, rewardAmountOut3));
					if (Plugin.GearRepairOnClaimEnabled != null && Plugin.GearRepairOnClaimEnabled.Value)
					{
						Helper.RepairWeapon(characterEntity);
					}
					QuestDef questById_NoLock3 = GetQuestById_NoLock(value.HardQuestId);
					int value4 = Math.Max(0, questById_NoLock3?.RequiredKills ?? 0);
					list.Add((questById_NoLock3 != null) ? $"{questById_NoLock3.Name} x{value4}" : "Quest 3");
				}
				string text = "<color=yellow>Daily Quests (Reset in " + GetNextResetText() + ")</color>\n" + replyText + "\n" + replyText2 + "\n" + replyText3;
				if (!flag)
				{
					ctx.Reply(text);
					return false;
				}
				foreach (var item in list2)
				{
					Helper.AddItemToInventory(characterEntity, item.Item1, item.Item2);
				}
				Helper.TrySendBroadcastMessage(playerName, list);
				Helper.TrySendWebhookMessage(playerName, list);
				Helper.TryAddDailyQuestBuff(senderUserEntity, characterEntity, value);
				_players[key] = value;
				SaveThrottle.ForceSave();
				ctx.Reply(text);
				return true;
			}
		}

		public static void OnKilledPrefab(ulong sid, int diedPrefabGuidHash, User user, string playerNameForEnsure = "", Entity characterEntity = default(Entity))
		{
			//IL_0016: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			if (sid == 0L || diedPrefabGuidHash == 0)
			{
				return;
			}
			EnsureAssignedForToday(sid, playerNameForEnsure, characterEntity);
			lock (_lock)
			{
				string key = sid.ToString();
				if (!_players.TryGetValue(key, out var value) || value == null)
				{
					return;
				}
				bool flag = false;
				QuestDef questById_NoLock = GetQuestById_NoLock(value.EasyQuestId);
				if (questById_NoLock != null && questById_NoLock.TargetPrefabs != null && questById_NoLock.TargetPrefabs.Length != 0 && questById_NoLock.TargetPrefabs.Contains(diedPrefabGuidHash))
				{
					int num = Math.Max(0, questById_NoLock.RequiredKills);
					if (num > 0 && value.EasyProgress < num)
					{
						value.EasyProgress++;
						if (value.EasyProgress > num)
						{
							value.EasyProgress = num;
						}
						flag = true;
						SendQuestToast(user, "1", questById_NoLock.Name, value.EasyProgress, num, value.EasyProgress >= num);
					}
				}
				QuestDef questById_NoLock2 = GetQuestById_NoLock(value.MediumQuestId);
				if (questById_NoLock2 != null && questById_NoLock2.TargetPrefabs != null && questById_NoLock2.TargetPrefabs.Length != 0 && questById_NoLock2.TargetPrefabs.Contains(diedPrefabGuidHash))
				{
					int num2 = Math.Max(0, questById_NoLock2.RequiredKills);
					if (num2 > 0 && value.MediumProgress < num2)
					{
						value.MediumProgress++;
						if (value.MediumProgress > num2)
						{
							value.MediumProgress = num2;
						}
						flag = true;
						SendQuestToast(user, "2", questById_NoLock2.Name, value.MediumProgress, num2, value.MediumProgress >= num2);
					}
				}
				QuestDef questById_NoLock3 = GetQuestById_NoLock(value.HardQuestId);
				if (questById_NoLock3 != null && questById_NoLock3.TargetPrefabs != null && questById_NoLock3.TargetPrefabs.Length != 0 && questById_NoLock3.TargetPrefabs.Contains(diedPrefabGuidHash))
				{
					int num3 = Math.Max(0, questById_NoLock3.RequiredKills);
					if (num3 > 0 && value.HardProgress < num3)
					{
						value.HardProgress++;
						if (value.HardProgress > num3)
						{
							value.HardProgress = num3;
						}
						flag = true;
						SendQuestToast(user, "3", questById_NoLock3.Name, value.HardProgress, num3, value.HardProgress >= num3);
					}
				}
				if (flag)
				{
					_players[key] = value;
					SaveThrottle.MarkDirty();
				}
			}
		}

		private static void RollDateIfNeeded_NoLock()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			DateTime date = DateTime.Now.Date;
			if (!(date == _lastDate))
			{
				_lastDate = date;
				_cachedTodayString = _lastDate.ToString("yyyy-MM-dd");
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Quest] New day detected: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(_lastDate, "yyyy-MM-dd");
				}
				log.LogInfo(val);
			}
		}

		private static string GetNextResetText()
		{
			DateTime now = DateTime.Now;
			DateTime dateTime = now.Date.AddDays(1.0);
			TimeSpan timeSpan = dateTime - now;
			if (timeSpan < TimeSpan.Zero)
			{
				timeSpan = TimeSpan.Zero;
			}
			int value = (int)timeSpan.TotalHours;
			return $"{value:00}:{timeSpan.Minutes:00}:{timeSpan.Seconds:00}";
		}

		private static QuestDef GetQuestById_NoLock(string id)
		{
			if (string.IsNullOrWhiteSpace(id))
			{
				return null;
			}
			if (_questsById.TryGetValue(id, out var value))
			{
				return value;
			}
			return _config?.Quests?.FirstOrDefault((QuestDef x) => x != null && string.Equals(x.Id, id, StringComparison.Ordinal));
		}

		private static string PickQuestId_NoLock(ulong sid, string date, string difficulty, List<QuestDef> pool)
		{
			if (pool == null || pool.Count == 0)
			{
				return "";
			}
			int seed = HashCode.Combine(sid, date, difficulty);
			Random random = new Random(seed);
			return pool[random.Next(pool.Count)]?.Id ?? "";
		}

		private static bool TryResolveRewardPrefab_NoLock(QuestDef quest, out PrefabGUID rewardPrefab, out string rewardName)
		{
			//IL_0003: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			rewardPrefab = new PrefabGUID(0);
			rewardName = "Reward";
			if (quest?.Reward == null)
			{
				return false;
			}
			int prefab = quest.Reward.Prefab;
			if (prefab == 0)
			{
				return false;
			}
			rewardPrefab = new PrefabGUID(prefab);
			rewardName = quest.Reward.Name;
			if (string.IsNullOrWhiteSpace(rewardName))
			{
				try
				{
					rewardName = rewardPrefab.LookupName();
				}
				catch
				{
					rewardName = prefab.ToString();
				}
			}
			return true;
		}

		public static void AdminRemoveBuff(ChatCommandContext ctx, string targetPlayerName)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			lock (_lock)
			{
				EnsureInitialized_NoLock();
				PlayerQuestState playerQuestState = _players.Values.FirstOrDefault((PlayerQuestState x) => x != null && string.Equals(x.Name, targetPlayerName, StringComparison.OrdinalIgnoreCase));
				if (playerQuestState == null)
				{
					ctx.Reply("<color=red>Player " + targetPlayerName + " not found in quest data.</color>");
					return;
				}
				Entity val = Entity.Null;
				NativeArray<Entity> entitiesByComponentType = Helper.GetEntitiesByComponentType<User>();
				try
				{
					Enumerator<Entity> enumerator = entitiesByComponentType.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						User val2 = current.Read<User>();
						if (val2.PlatformId == playerQuestState.SteamId)
						{
							val = val2.LocalCharacter._Entity;
							break;
						}
					}
				}
				finally
				{
					if (entitiesByComponentType.IsCreated)
					{
						entitiesByComponentType.Dispose();
					}
				}
				if (val == Entity.Null)
				{
					ctx.Reply("<color=red>Could not find physical character for " + playerQuestState.Name + ".</color>");
				}
				else if (playerQuestState.ClaimedBuffPrefab == 0)
				{
					int num = Plugin.ClaimedBuffPrefab?.Value ?? 0;
					if (num != 0)
					{
						Buffs.RemoveBuff(val, new PrefabGUID(num));
						ctx.Reply("<color=green>Force removed config buff from " + playerQuestState.Name + ".</color>");
					}
					else
					{
						ctx.Reply("<color=yellow>Player " + playerQuestState.Name + " has no active buff history.</color>");
					}
				}
				else if (Helper.TryRemoveDailyQuestBuff(val, playerQuestState))
				{
					string key = playerQuestState.SteamId.ToString();
					_players[key] = playerQuestState;
					SaveThrottle.ForceSave();
					ctx.Reply("<color=green>Successfully removed daily quest buff from</color> <color=white>" + playerQuestState.Name + "</color>.");
				}
				else
				{
					ctx.Reply("<color=red>Failed to remove buff from " + playerQuestState.Name + ".</color>");
				}
			}
		}

		public static void EnsureFilesExist()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			try
			{
				Directory.CreateDirectory(CONFIG_DIR);
				bool flag = default(bool);
				if (!File.Exists(CONFIG_FILE))
				{
					File.WriteAllText(CONFIG_FILE, "[\n    {\n      \"ID\": \"1_1\",\n      \"Name\": \"kill Wolves\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1418430647,\n        -1554428547,\n        -578677530,\n        134039094,\n        -218175217,\n        572729167,\n        616274140\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_2\",\n      \"Name\": \"kill Deer\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1897056612,\n        -575831311,\n        1780171587\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_3\",\n      \"Name\": \"kill Moose\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -831097925,\n        2097040330,\n        -779632831,\n        1570140219\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_4\",\n      \"Name\": \"kill Crows\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -221278041,\n        1239832946,\n        -2002658567,\n        1029047051\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_5\",\n      \"Name\": \"kill Sheep\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        947731555,\n        1635167941,\n        1012307512\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_6\",\n      \"Name\": \"kill Cow\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        721166952\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_7\",\n      \"Name\": \"kill Flying Skull\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -236166535\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_8\",\n      \"Name\": \"kill Undead Assassin\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1365627158\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_9\",\n      \"Name\": \"kill Horses\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1149585723,\n        -1502865710\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_10\",\n      \"Name\": \"kill Bears\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1043643344,\n        -1391546313,\n        2041915372,\n        -559819989,\n        1938756250,\n        -1697944553\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_11\",\n      \"Name\": \"kill Pigs\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1356006948,\n        1420480270\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_12\",\n      \"Name\": \"kill Treant\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1089337069\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_13\",\n      \"Name\": \"kill Stone Golems / Elementals\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -779411607,\n        20817667\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_14\",\n      \"Name\": \"kill Iron Golem\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        763796308\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_15\",\n      \"Name\": \"kill Scarecrow\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1750347680\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_16\",\n      \"Name\": \"kill Mutant Spitter\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1092792896\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_17\",\n      \"Name\": \"kill Rathorror\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -375581934\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_18\",\n      \"Name\": \"kill Abomination\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        823276204\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_19\",\n      \"Name\": \"kill Spiders\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1078424589,\n        -764515001,\n        2103131615,\n        2136899683,\n        342127250,\n        -548489519\n      ],\n      \"RequiredKills\": 40,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_20\",\n      \"Name\": \"kill Mosquito\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -744966291\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_21\",\n      \"Name\": \"kill Night Lurker\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -2046268156\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_22\",\n      \"Name\": \"kill Ghost Crossbowman\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -85729652\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_23\",\n      \"Name\": \"kill Ghost Warrior\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1618703048\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_24\",\n      \"Name\": \"kill Banshee\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1146194149\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_25\",\n      \"Name\": \"kill Ghost Guardian\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -458883491\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_26\",\n      \"Name\": \"kill Ghost Assassin\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        849891426\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_27\",\n      \"Name\": \"kill Worm Terror\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        658578725\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_28\",\n      \"Name\": \"kill Sister\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1772642154\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_29\",\n      \"Name\": \"kill Dunley Villagers\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1887807944,\n        525027204\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_30\",\n      \"Name\": \"kill Bell Ringer\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -1670130821\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_31\",\n      \"Name\": \"kill Hound\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -249647316\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_32\",\n      \"Name\": \"kill Nun\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -700632469\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_33\",\n      \"Name\": \"kill Militia Archer\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        203103783\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_34\",\n      \"Name\": \"kill Militia Veteran\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        2005508157\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_35\",\n      \"Name\": \"kill Pyro\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -322293503\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_36\",\n      \"Name\": \"kill Technician\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        820492683\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_37\",\n      \"Name\": \"kill Tractor Beamer\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        -293507834\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_38\",\n      \"Name\": \"kill Railgunner\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1732477970\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"1_39\",\n      \"Name\": \"kill Sentry Officer\",\n      \"Difficulty\": \"easy\",\n      \"TargetPrefabs\": [\n        1401026468\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 2103989354,\n        \"Name\": \"Stygian Shards\",\n        \"Amount\": 1200\n      }\n    },\n    {\n      \"ID\": \"2_1\",\n      \"Name\": \"kill Werewolf\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -951976780\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_2\",\n      \"Name\": \"kill Witch\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -56441915\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_3\",\n      \"Name\": \"kill Corrupted Mantraps\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1527640414,\n        1906792990,\n        -1915060856,\n        358623979,\n        2107764370\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_4\",\n      \"Name\": \"Cut down Corrupt Trees\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1378837905,\n        861604950,\n        735695679\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_5\",\n      \"Name\": \"kill Corrupted Treants\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1496810447,\n        358623979,\n        2107764370\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_6\",\n      \"Name\": \"kill Driller\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        709450349\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_7\",\n      \"Name\": \"kill Lightning Protector\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1655577903\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_8\",\n      \"Name\": \"kill Gattler\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -884401089\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_9\",\n      \"Name\": \"kill Zapper\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -2018710724\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_10\",\n      \"Name\": \"kill Gloomrot Villagers\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1216169364,\n        -732208863\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_11\",\n      \"Name\": \"kill Silverlight Villagers\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1224027101,\n        -2025921616\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_12\",\n      \"Name\": \"kill Devoted\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1660801216\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_13\",\n      \"Name\": \"kill Slave Masters\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        891705701,\n        -240536861\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_14\",\n      \"Name\": \"kill Footman\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        2128996433\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_15\",\n      \"Name\": \"kill Rifleman\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1148936156\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_16\",\n      \"Name\": \"kill Cleric\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1464869978\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_17\",\n      \"Name\": \"kill Knights\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -930333806,\n        794228023\n      ],\n      \"RequiredKills\": 18,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_18\",\n      \"Name\": \"kill Paladin\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1728773109\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_19\",\n      \"Name\": \"kill Lightweaver\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1185952775\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_20\",\n      \"Name\": \"kill Priest\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1406393857\n      ],\n