Decompiled source of DailyQuest v1.0.4

DailyQuest.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
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.Physics;
using ProjectM.Scripting;
using ProjectM.Shared;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
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("Daily quest mod for V Rising servers")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("DailyQuest")]
[assembly: AssemblyTitle("DailyQuest")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DailyQuest
{
	internal static class Core
	{
		private static World _server;

		private static MonoBehaviour monoBehaviour;

		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(51, 5, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner:");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.StackTrace);
			}
			log.LogError(val);
		}

		internal static 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()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			if (_hasInitialized)
			{
				return;
			}
			if (!IsServerReady())
			{
				Log.LogWarning((object)"Server world is not ready yet.");
				return;
			}
			PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>();
			ServerScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>();
			QuestService.Initialize();
			bool flag = default(bool);
			if (!WebhookService.Reload(out var error))
			{
				ManualLogSource log = Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to load webhook_config.json: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(error);
				}
				log.LogWarning(val);
			}
			_hasInitialized = true;
			ManualLogSource log2 = Log;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("InitializeAfterLoaded");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" completed");
			}
			log2.LogInfo(val2);
		}

		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 Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)monoBehaviour == (Object)null)
			{
				GameObject val = new GameObject("DailyQuest");
				monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
				Object.DontDestroyOnLoad((Object)(object)val);
			}
			return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
		}

		public static void StopCoroutine(Coroutine coroutine)
		{
			if (!((Object)(object)monoBehaviour == (Object)null))
			{
				monoBehaviour.StopCoroutine(coroutine);
			}
		}
	}
	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 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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)
			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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			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);
			}
		}

		public static void RepairAmulet(Entity character, bool repair = true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			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);
				}
			}
		}

		public static void RepairWeapon(Entity character, bool repair = true)
		{
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			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);
					}
				}
			}
		}
	}
	[BepInPlugin("DailyQuest", "DailyQuest", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		internal static Harmony Harmony;

		internal static ManualLogSource PluginLog;

		public static ManualLogSource LogInstance { get; private set; }

		public override void Load()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			if (Application.productName != "VRisingServer")
			{
				return;
			}
			PluginLog = ((BasePlugin)this).Log;
			LogInstance = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DailyQuest");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.4");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			try
			{
				QuestService.EnsureFilesExist();
				WebhookService.EnsureFilesExist();
				((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();
			Core.StartCoroutine(InitializeWhenReady());
		}

		private IEnumerator InitializeWhenReady()
		{
			while (!Core.IsServerReady())
			{
				yield return null;
			}
			try
			{
				Core.InitializeAfterLoaded();
				((BasePlugin)this).Log.LogInfo((object)"DailyQuest initialized.");
			}
			catch (Exception e)
			{
				ManualLogSource log = ((BasePlugin)this).Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DailyQuest initialization failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(e);
				}
				log.LogError(val);
			}
		}

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

		public const string PLUGIN_NAME = "DailyQuest";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}
namespace DailyQuest.Services
{
	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> _enabledQuests = new List<QuestDef>();

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

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

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

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

		private static DateTime _lastDate = DateTime.MinValue.Date;

		private const int SaveIntervalSeconds = 10;

		private static bool _dirty;

		private static DateTime _nextSave = DateTime.MinValue;

		private static Coroutine _tickCoroutine;

		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)
		{
			EnsureAssignedForToday(sid, playerName);
			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\n" + text2 + "\n\n" + text3 + "\n";
			}
		}

		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 Quest: <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 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>";
		}

		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 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}";
		}

		public static void Initialize()
		{
			lock (_lock)
			{
				EnsureFilesExist();
				LoadConfig_NoLock(createIfMissing: true);
				LoadPlayers_NoLock();
				_lastDate = DateTime.Now.Date;
				if (_tickCoroutine == null)
				{
					_tickCoroutine = Core.StartCoroutine(TickLoop());
				}
				_initialized = true;
			}
			Core.Log.LogInfo((object)"[Quest] QuestService initialized");
		}

		public static void Reload()
		{
			lock (_lock)
			{
				EnsureFilesExist();
				LoadConfig_NoLock(createIfMissing: false);
				_initialized = true;
			}
			Core.Log.LogInfo((object)"[Quest] quest_config.json reloaded");
		}

		public static void EnsureAssignedForToday(ulong sid, string playerName)
		{
			if (sid == 0)
			{
				return;
			}
			lock (_lock)
			{
				EnsureInitialized_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 (string.IsNullOrWhiteSpace(value.EasyQuestId))
				{
					List<QuestDef> pool = ((_enabledEasyQuests.Count > 0) ? _enabledEasyQuests : _enabledQuests);
					value.EasyQuestId = PickQuestId_NoLock(sid, text, "easy", pool);
					value.EasyProgress = 0;
					value.EasyClaimed = false;
					flag = true;
				}
				if (string.IsNullOrWhiteSpace(value.MediumQuestId))
				{
					value.MediumQuestId = PickQuestId_NoLock(sid, text, "medium", _enabledMediumQuests);
					value.MediumProgress = 0;
					value.MediumClaimed = false;
					flag = true;
				}
				if (string.IsNullOrWhiteSpace(value.HardQuestId))
				{
					value.HardQuestId = PickQuestId_NoLock(sid, text, "hard", _enabledHardQuests);
					value.HardProgress = 0;
					value.HardClaimed = false;
					flag = true;
				}
				if (flag)
				{
					_players[key] = value;
					MarkDirty_NoLock();
				}
			}
		}

		public static bool TryClaim(ChatCommandContext ctx, ulong sid, string playerName, Entity characterEntity)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: 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);
				if (TryClaimOne_NoLock(ctx, senderUserEntity, characterEntity, "1", value.EasyQuestId, value.EasyProgress, value.EasyClaimed, out var replyText))
				{
					value.EasyClaimed = true;
					ctx.Reply(replyText);
					flag = true;
					if (_config.RepairOnClaim)
					{
						try
						{
							Helper.RepairAmulet(characterEntity);
						}
						catch (Exception e)
						{
							Core.LogException(e, "TryClaim");
						}
					}
					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(ctx, senderUserEntity, characterEntity, "2", value.MediumQuestId, value.MediumProgress, value.MediumClaimed, out var replyText2))
				{
					value.MediumClaimed = true;
					ctx.Reply(replyText2);
					flag = true;
					if (_config.RepairOnClaim)
					{
						try
						{
							Helper.RepairArmor(characterEntity);
						}
						catch (Exception e2)
						{
							Core.LogException(e2, "TryClaim");
						}
					}
					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(ctx, senderUserEntity, characterEntity, "3", value.HardQuestId, value.HardProgress, value.HardClaimed, out var replyText3))
				{
					value.HardClaimed = true;
					ctx.Reply(replyText3);
					flag = true;
					if (_config.RepairOnClaim)
					{
						try
						{
							Helper.RepairWeapon(characterEntity);
						}
						catch (Exception e3)
						{
							Core.LogException(e3, "TryClaim");
						}
					}
					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");
				}
				if (!flag)
				{
					return false;
				}
				_players[key] = value;
				MarkDirty_NoLock();
				ForceSave_NoLock();
				string text = string.Join(", ", list);
				string text2 = $"<color=white>{playerName}</color> completed and claimed rewards for: {text}. Use <color=green>.quest daily</color> to check your quests.";
				FixedString512Bytes val = default(FixedString512Bytes);
				((FixedString512Bytes)(ref val))..ctor(text2);
				ServerChatUtils.SendSystemMessageToAllClients(Core.EntityManager, ref val);
				TrySendClaimWebhook(playerName, text);
				return true;
			}
		}

		private static void TrySendClaimWebhook(string playerName, string list)
		{
			string message = "**[Daily quest]** - **" + playerName + "** has completed and claimed the rewards for " + list;
			SendClaimWebhookAsync(message);
		}

		private static async Task SendClaimWebhookAsync(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, "SendClaimWebhookAsync");
			}
		}

		public static void OnKilledPrefab(ulong sid, int diedPrefabGuidHash, User user, string playerNameForEnsure = "")
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			if (sid == 0L || diedPrefabGuidHash == 0)
			{
				return;
			}
			EnsureAssignedForToday(sid, playerNameForEnsure);
			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;
					MarkDirty_NoLock();
				}
			}
		}

		private static void EnsureInitialized_NoLock()
		{
			if (!_initialized)
			{
				EnsureFilesExist();
				LoadConfig_NoLock(createIfMissing: true);
				LoadPlayers_NoLock();
				_lastDate = DateTime.Now.Date;
				_initialized = true;
				Core.Log.LogInfo((object)"[Quest] QuestService lazy-initialized");
			}
		}

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

		private static void RollDateIfNeeded_NoLock()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			DateTime date = DateTime.Now.Date;
			if (!(date == _lastDate))
			{
				_lastDate = date;
				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 TodayString()
		{
			return DateTime.Now.ToString("yyyy-MM-dd");
		}

		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;
		}

		private static void MarkDirty_NoLock()
		{
			_dirty = true;
			if (_nextSave == DateTime.MinValue)
			{
				_nextSave = DateTime.Now.AddSeconds(10.0);
			}
		}

		internal static void Tick()
		{
			lock (_lock)
			{
				RollDateIfNeeded_NoLock();
				if (_dirty && (!(_nextSave != DateTime.MinValue) || !(DateTime.Now < _nextSave)))
				{
					SavePlayers_NoLock();
					_dirty = false;
					_nextSave = DateTime.MinValue;
				}
			}
		}

		private static void ForceSave_NoLock()
		{
			SavePlayers_NoLock();
			_dirty = false;
			_nextSave = DateTime.MinValue;
		}

		private static IEnumerator TickLoop()
		{
			while (true)
			{
				try
				{
					Tick();
				}
				catch (Exception ex)
				{
					Exception e = ex;
					Core.LogException(e, "TickLoop");
				}
				yield return (object)new WaitForSeconds(1f);
			}
		}

		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  \"GearRepairOnClaim\": false,\n  \"Quests\": [\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      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_21\",\n      \"Name\": \"kill Cardinal Aide\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1745498602\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_22\",\n      \"Name\": \"kill Sanguinary Guards\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1144208724,\n        -669027288\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_23\",\n      \"Name\": \"kill Exsanguinator\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1076780215\n      ],\n      \"RequiredKills\": 28,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_24\",\n      \"Name\": \"kill Nightmares\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -981051151,\n        -1009917656\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_25\",\n      \"Name\": \"kill Blood Prophets\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -2080231735,\n        1912966420\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_26\",\n      \"Name\": \"kill Dreadhorns\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1140588645,\n        981369753\n      ],\n      \"RequiredKills\": 25,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_27\",\n      \"Name\": \"kill Dark Temptresses\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        2111003460,\n        -494298686\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_28\",\n      \"Name\": \"kill Slaughterbeasts\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        2049379982,\n        -653348998\n      ],\n      \"RequiredKills\": 30,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_29\",\n      \"Name\": \"kill Gargoyles\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -65981941,\n        -392776091,\n        280858720\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_30\",\n      \"Name\": \"kill DartFlinger\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1209580976\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_31\",\n      \"Name\": \"kill Lurker\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -1733829912\n      ],\n      \"RequiredKills\": 20,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_32\",\n      \"Name\": \"kill Alchemist\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        326501064\n      ],\n      \"RequiredKills\": 18,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_33\",\n      \"Name\": \"kill Dreadcleaver\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1864177126\n      ],\n      \"RequiredKills\": 18,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_34\",\n      \"Name\": \"kill Viper\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        -436956599\n      ],\n      \"RequiredKills\": 18,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_35\",\n      \"Name\": \"kill Sentinel\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        1531777139\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"2_36\",\n      \"Name\": \"kill Striker\",\n      \"Difficulty\": \"medium\",\n      \"TargetPrefabs\": [\n        761646020\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 576389135,\n        \"Name\": \"Greater Stygian Shards\",\n        \"Amount\": 800\n      }\n    },\n    {\n      \"ID\": \"3_1\",\n      \"Name\": \"kill Dracula\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -327335305\n      ],\n      \"RequiredKills\": 3,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_2\",\n      \"Name\": \"kill Megara\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        591725925\n      ],\n      \"RequiredKills\": 3,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_3\",\n      \"Name\": \"kill Adam\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        1233988687\n      ],\n      \"RequiredKills\": 3,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_4\",\n      \"Name\": \"kill Solarus\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -740796338\n      ],\n      \"RequiredKills\": 4,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_5\",\n      \"Name\": \"kill Talzur\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -393555055\n      ],\n      \"RequiredKills\": 4,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_6\",\n      \"Name\": \"kill General Valencia\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        495971434\n      ],\n      \"RequiredKills\": 5,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_7\",\n      \"Name\": \"kill Lord Styx\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        1112948824\n      ],\n      \"RequiredKills\": 5,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_8\",\n      \"Name\": \"kill Gorecrusher\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1936575244\n      ],\n      \"RequiredKills\": 5,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_9\",\n      \"Name\": \"kill Dantos\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        173259239\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_10\",\n      \"Name\": \"kill Simon Belmont\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        336560131\n      ],\n      \"RequiredKills\": 5,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_11\",\n      \"Name\": \"kill Azariel\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        114912615\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_12\",\n      \"Name\": \"kill Voltatia\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        2054432370\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_13\",\n      \"Name\": \"kill Lucile\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        1295855316\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_14\",\n      \"Name\": \"kill Terrorclaw\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1347412392\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_15\",\n      \"Name\": \"kill Matka\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -910296704\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_16\",\n      \"Name\": \"kill Stavros\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1669199769\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_17\",\n      \"Name\": \"kill Jakira\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1383529374\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_18\",\n      \"Name\": \"kill Henry Blackbrew\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        814083983\n      ],\n      \"RequiredKills\": 6,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_19\",\n      \"Name\": \"kill Mairwyn\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -2013903325\n      ],\n      \"RequiredKills\": 7,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_20\",\n      \"Name\": \"kill Morian\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        685266977\n      ],\n      \"RequiredKills\": 7,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_21\",\n      \"Name\": \"kill Baron du Bouchon\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        192051202\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_22\",\n      \"Name\": \"kill Sir Magnus\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -26105228\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_23\",\n      \"Name\": \"kill Cyril\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        326378955\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_24\",\n      \"Name\": \"kill Willfred\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1007062401\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_25\",\n      \"Name\": \"kill Albert\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -203043163\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_26\",\n      \"Name\": \"kill Foulrot\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1208888966\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_27\",\n      \"Name\": \"kill Ben\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        109969450\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_28\",\n      \"Name\": \"kill Ungora\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -548489519\n      ],\n      \"RequiredKills\": 8,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_29\",\n      \"Name\": \"kill Angram\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        106480588\n      ],\n      \"RequiredKills\": 9,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_30\",\n      \"Name\": \"kill Domina\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1101874342\n      ],\n      \"RequiredKills\": 9,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_31\",\n      \"Name\": \"kill Ziva\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        172235178\n      ],\n      \"RequiredKills\": 9,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_32\",\n      \"Name\": \"kill Octavian\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        1688478381\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_33\",\n      \"Name\": \"kill General Cassius\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -496360395\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_34\",\n      \"Name\": \"kill Raziel\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -680831417\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_35\",\n      \"Name\": \"kill Jade\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1968372384\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_36\",\n      \"Name\": \"kill Gaius\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -753453016\n      ],\n      \"RequiredKills\": 10,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_37\",\n      \"Name\": \"kill General Elena\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        795262842\n      ],\n      \"RequiredKills\": 11,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_38\",\n      \"Name\": \"kill Frostmaw\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        24378719\n      ],\n      \"RequiredKills\": 11,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_39\",\n      \"Name\": \"kill Terah\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -1065970933\n      ],\n      \"RequiredKills\": 11,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_40\",\n      \"Name\": \"kill Primal Blood Souls\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        -440174408,\n        -427888732,\n        1990744594,\n        -943858353,\n        -1805216630,\n        -982850914,\n        -1189707552,\n        282791819,\n        -1160778038,\n        468179469,\n        2079933370,\n        666177656\n      ],\n      \"RequiredKills\": 12,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    },\n    {\n      \"ID\": \"3_41\",\n      \"Name\": \"kill Lesser Blood Souls\",\n      \"Difficulty\": \"hard\",\n      \"TargetPrefabs\": [\n        1854211210,\n        17609984,\n        -1420322422,\n        478580792,\n        1318855899,\n        1494126678,\n        -1381375644,\n        -1822337177,\n        -989493184,\n        2009018555\n      ],\n      \"RequiredKills\": 15,\n      \"Reward\": {\n        \"Prefab\": 28358550,\n        \"Name\": \"Primal Stygian Shards\",\n        \"Amount\": 400\n      }\n    }\n  ]\n}");
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Quest] Created config: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(CONFIG_FILE);
					}
					log.LogInfo(val);
				}
				if (!File.Exists(PLAYER_FILE))
				{
					File.WriteAllText(PLAYER_FILE, "{}");
					ManualLogSource log2 = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Quest] Created player data: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(PLAYER_FILE);
					}
					log2.LogInfo(val);
				}
			}
			catch (Exception e)
			{
				Core.LogException(e, "EnsureFilesExist");
			}
		}

		private static void RebuildQuestIndex_NoLock()
		{
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			_questsById = new Dictionary<string, QuestDef>(StringComparer.Ordinal);
			_enabledQuests = new List<QuestDef>();
			_enabledEasyQuests = new List<QuestDef>();
			_enabledMediumQuests = new List<QuestDef>();
			_enabledHardQuests = new List<QuestDef>();
			if (_config?.Quests == null)
			{
				Core.Log.LogWarning((object)"[Quest] _config.Quests is null");
				return;
			}
			foreach (QuestDef quest in _config.Quests)
			{
				if (quest != null)
				{
					if (!string.IsNullOrWhiteSpace(quest.Id))
					{
						_questsById[quest.Id] = quest;
					}
					_enabledQuests.Add(quest);
					string text = (quest.Difficulty ?? "easy").Trim().ToLowerInvariant();
					if (text == "hard")
					{
						_enabledHardQuests.Add(quest);
					}
					else if (text == "medium")
					{
						_enabledMediumQuests.Add(quest);
					}
					else
					{
						_enabledEasyQuests.Add(quest);
					}
				}
			}
			ManualLogSource log = Core.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Quest] Loaded quests: all ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_enabledQuests.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", easy ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_enabledEasyQuests.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", medium ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_enabledMediumQuests.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", hard ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_enabledHardQuests.Count);
			}
			log.LogInfo(val);
		}

		private static void LoadConfig_NoLock(bool createIfMissing)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Directory.CreateDirectory(CONFIG_DIR);
			if (!File.Exists(CONFIG_FILE))
			{
				bool flag = default(bool);
				if (!createIfMissing)
				{
					ManualLogSource log = Core.Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Quest] Config not found: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(CONFIG_FILE);
					}
					log.LogWarning(val);
					_config = new QuestConfig();
					RebuildQuestIndex_NoLock();
					return;
				}
				File.WriteAllText(CONFIG_FILE, "{\n  \"GearRepairOnClaim\": false,\n  \"Quests\": [\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\",