Decompiled source of ChatWheel v1.0.2

ChatWheel.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
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.Json;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChatWheel.Commands;
using ChatWheel.Models;
using ChatWheel.Services;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Terrain;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
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("ChatWheel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Use emote wheel as a chat wheel")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+4dc60ed6814cd8904b02ee3c61d6785fdbeb4f2a")]
[assembly: AssemblyProduct("ChatWheel")]
[assembly: AssemblyTitle("ChatWheel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 ChatWheel
{
	internal static class Core
	{
		private static bool _hasInitialized = false;

		public static World Server { get; } = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");


		public static EntityManager EntityManager { get; } = Server.EntityManager;


		public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; }

		public static ChatWheelService ChatWheelService { get; } = new ChatWheelService();


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


		internal static void InitializeAfterLoaded()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (!_hasInitialized)
			{
				PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>();
				_hasInitialized = true;
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("InitializeAfterLoaded");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed");
				}
				log.LogInfo(val);
			}
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}
	}
	public static class ECSExtensions
	{
		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 bool TryRead<T>(this Entity entity, out T componentData) where T : struct
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			ComponentType val = default(ComponentType);
			((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
			componentData = default(T);
			EntityManager entityManager = Core.EntityManager;
			int result;
			if (((EntityManager)(ref entityManager)).HasComponent(entity, val))
			{
				entityManager = Core.EntityManager;
				result = (((EntityManager)(ref entityManager)).TryGetComponentData<T>(entity, ref componentData) ? 1 : 0);
			}
			else
			{
				result = 0;
			}
			return (byte)result != 0;
		}

		public static bool Exists(this 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_0009: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Core.EntityManager;
			return ((EntityManager)(ref entityManager)).Exists(entity);
		}

		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;
		}
	}
	internal static class Helper
	{
		public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0002: 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_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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0067: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions val = (EntityQueryOptions)0;
			if (includeAll)
			{
				val = (EntityQueryOptions)(val | 0xC3);
			}
			if (includeDisabled)
			{
				val = (EntityQueryOptions)(val | 2);
			}
			if (includeSpawn)
			{
				val = (EntityQueryOptions)(val | 0x40);
			}
			if (includePrefab)
			{
				val = (EntityQueryOptions)(val | 1);
			}
			if (includeDestroyed)
			{
				val = (EntityQueryOptions)(val | 0x80);
			}
			EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
			val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0));
			EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions(val);
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3);
			return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0002: 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_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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions val = (EntityQueryOptions)0;
			if (includeAll)
			{
				val = (EntityQueryOptions)(val | 0xC3);
			}
			if (includeDisabled)
			{
				val = (EntityQueryOptions)(val | 2);
			}
			if (includeSpawn)
			{
				val = (EntityQueryOptions)(val | 0x40);
			}
			if (includePrefab)
			{
				val = (EntityQueryOptions)(val | 1);
			}
			if (includeDestroyed)
			{
				val = (EntityQueryOptions)(val | 0x80);
			}
			EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
			val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0));
			val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0));
			EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions(val);
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3);
			return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static void SendSystemMessageToClient(User user, string message)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			FixedString512Bytes val = default(FixedString512Bytes);
			((FixedString512Bytes)(ref val))..ctor(message);
			ServerChatUtils.SendSystemMessageToClient(Core.EntityManager, user, ref val);
		}

		public unsafe static void SetComponentData<T>(Entity entity, T componentData) where T : struct
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			int num = Marshal.SizeOf(componentData);
			fixed (byte* ptr = StructureToByteArray(componentData))
			{
				EntityManager entityManager = Core.EntityManager;
				((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, TypeIndex.op_Implicit(ComponentTypeIndex<T>()), (void*)ptr, num);
			}
		}

		private static ComponentType ComponentType<T>()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return new ComponentType(Il2CppType.Of<T>(), (AccessMode)0);
		}

		private static int ComponentTypeIndex<T>()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return TypeIndex.op_Implicit(ComponentType<T>().TypeIndex);
		}

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

		public static bool AddComponent<T>(Entity entity) where T : struct
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Core.EntityManager;
			return ((EntityManager)(ref entityManager)).AddComponent(entity, ComponentType<T>());
		}

		public static void AddComponentData<T>(Entity entity, T componentData) where T : struct
		{
			//IL_0001: 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)
			AddComponent<T>(entity);
			SetComponentData(entity, componentData);
		}
	}
	[BepInPlugin("casanova.nova.ChatWheel", "ChatWheel", "1.0.2")]
	[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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			PluginLog = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("casanova.nova.ChatWheel");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.2");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			LogInstance = ((BasePlugin)this).Log;
			Database.InitConfig();
			Harmony = new Harmony("casanova.nova.ChatWheel");
			Harmony.PatchAll(Assembly.GetExecutingAssembly());
			CommandRegistry.RegisterAll();
		}

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

		public const string PLUGIN_NAME = "ChatWheel";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace ChatWheel.Services
{
	public class ChatWheelService
	{
		public static Dictionary<int, string> EMOTE_MAP = new Dictionary<int, string>
		{
			{ -658066984, "Beckon" },
			{ -1462274656, "Bow" },
			{ -26826346, "Clap" },
			{ -53273186, "No" },
			{ -452406649, "Point" },
			{ -370061286, "Salute" },
			{ -1064533554, "Surrender" },
			{ -158502505, "Taunt" },
			{ 1177797340, "Wave" },
			{ -1525577000, "Yes" },
			{ 808904257, "Sit" },
			{ -578764388, "Shrug" }
		};

		public string GetEmoteName(PrefabGUID prefabGuid)
		{
			return EMOTE_MAP.GetValueOrDefault(((PrefabGUID)(ref prefabGuid)).GuidHash, "Unknown Emote");
		}
	}
}
namespace ChatWheel.Patches
{
	[HarmonyPatch(typeof(EmoteSystem), "OnUpdate")]
	public static class EmoteSystemPatch
	{
		public static readonly PrefabGUID Buff_InCombat_PvPVampire = new PrefabGUID(697095869);

		public static readonly PrefabGUID Buff_General_VampirePvPDeathDebuff = new PrefabGUID(1591132469);

		[HarmonyPrefix]
		private static void OnUpdatePrefix(EmoteSystem __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a94: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_0685: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_084a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_0861: Unknown result type (might be due to invalid IL or missing references)
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_086f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0874: Unknown result type (might be due to invalid IL or missing references)
			//IL_0878: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0884: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_088a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d3: Invalid comparison between Unknown and I4
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_099e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_071c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Expected O, but got Unknown
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09be: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_09df: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e2: Invalid comparison between Unknown and I4
			//IL_0910: Unknown result type (might be due to invalid IL or missing references)
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_091c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0756: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_09eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a18: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_092d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0932: Unknown result type (might be due to invalid IL or missing references)
			//IL_0934: Unknown result type (might be due to invalid IL or missing references)
			//IL_0936: Unknown result type (might be due to invalid IL or missing references)
			//IL_093b: Unknown result type (might be due to invalid IL or missing references)
			//IL_093d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_077a: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_077e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_094d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0956: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			EntityQuery query = __instance._Query;
			NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val.GetEnumerator();
				CastleTerritory val13 = default(CastleTerritory);
				FixedString512Bytes val20 = default(FixedString512Bytes);
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (!current.Exists())
					{
						continue;
					}
					UseEmoteEvent val2 = current.Read<UseEmoteEvent>();
					FromCharacter val3 = current.Read<FromCharacter>();
					PrefabGUID action = val2.Action;
					Entity character = val3.Character;
					Entity user = val3.User;
					if (!user.Exists())
					{
						continue;
					}
					User user2 = user.Read<User>();
					string text = user2.PlatformId.ToString();
					string key = $"{text}|{((PrefabGUID)(ref action)).GuidHash}";
					EntityManager entityManager;
					if (ChatWheelCommands.TO_BIND.TryGetValue(text, out var value))
					{
						Database.CHATWHEEL[key] = value;
						Database.SaveChatWheel();
						ChatWheelCommands.TO_BIND.Remove(text);
						entityManager = Core.EntityManager;
						((EntityManager)(ref entityManager)).DestroyEntity(current);
						Helper.SendSystemMessageToClient(user2, "ChatWheel: Message is now bound to " + Core.ChatWheelService.GetEmoteName(action));
					}
					else if (ChatWheelCommands.TO_UNBIND.Contains(text))
					{
						Database.CHATWHEEL.Remove(key);
						Database.SaveChatWheel();
						ChatWheelCommands.TO_UNBIND.Remove(text);
						entityManager = Core.EntityManager;
						((EntityManager)(ref entityManager)).DestroyEntity(current);
						Helper.SendSystemMessageToClient(user2, "ChatWheel: Emote " + Core.ChatWheelService.GetEmoteName(action) + " is now back to normal");
					}
					else
					{
						if (!Database.CHATWHEEL.TryGetValue(key, out var value2) || !Database.IsChatWheelEnabled(text))
						{
							continue;
						}
						NetworkId val4 = user.Read<NetworkId>();
						Entity entityOnServer = ((NetworkedEntity)(ref user2.ClanEntity)).GetEntityOnServer();
						NetworkId val5 = character.Read<NetworkId>();
						bool flag = value2.message.Contains("$combatTimer", StringComparison.OrdinalIgnoreCase);
						bool flag2 = value2.message.Contains("$baneTimer", StringComparison.OrdinalIgnoreCase);
						bool flag3 = value2.message.Contains("$deathTimer", StringComparison.OrdinalIgnoreCase);
						bool flag4 = value2.message.Contains("$location", StringComparison.OrdinalIgnoreCase);
						bool flag5 = value2.message.Contains("$ultCd", StringComparison.OrdinalIgnoreCase);
						string newValue = "0s";
						string text2 = "0s";
						string newValue2 = "30s";
						string text3 = "";
						string newValue3 = "N/A";
						if (flag || flag2)
						{
							Enumerator<Entity> enumerator2 = Helper.GetEntitiesByComponentTypes<Buff, PrefabGUID>().GetEnumerator();
							while (enumerator2.MoveNext())
							{
								Entity current2 = enumerator2.Current;
								if (!(current2.Read<EntityOwner>().Owner == character))
								{
									continue;
								}
								PrefabGUID val6 = current2.Read<PrefabGUID>();
								int guidHash = ((PrefabGUID)(ref val6)).GuidHash;
								if (flag)
								{
									val6 = Buff_InCombat_PvPVampire;
									if (guidHash.Equals(((PrefabGUID)(ref val6)).GuidHash))
									{
										Age val7 = current2.Read<Age>();
										LifeTime val8 = current2.Read<LifeTime>();
										newValue = Convert.ToInt32(val8.Duration - val7.Value) + "s";
										continue;
									}
								}
								if (!(flag2 || flag3))
								{
									continue;
								}
								val6 = Buff_General_VampirePvPDeathDebuff;
								if (!guidHash.Equals(((PrefabGUID)(ref val6)).GuidHash))
								{
									continue;
								}
								if (flag2)
								{
									Age val9 = current2.Read<Age>();
									LifeTime val10 = current2.Read<LifeTime>();
									int num = Convert.ToInt32(val10.Duration - val9.Value);
									int num2 = num / 60;
									int num3 = num % 60;
									text2 = "";
									if (num2 > 0)
									{
										text2 += $"{num2}m";
									}
									if (num3 > 0)
									{
										text2 += $"{num3}s";
									}
								}
								if (flag3)
								{
									Buff val11 = current2.Read<Buff>();
									newValue2 = Math.Min(150, 30 + val11.Stacks * 60) + "s";
								}
							}
						}
						if (flag4)
						{
							TilePosition val12 = character.Read<TilePosition>();
							Enumerator<Entity> enumerator3 = Helper.GetEntitiesByComponentType<CastleHeart>().GetEnumerator();
							while (enumerator3.MoveNext())
							{
								Entity current3 = enumerator3.Current;
								Entity castleTerritoryEntity = current3.Read<CastleHeart>().CastleTerritoryEntity;
								if (CastleTerritoryExtensions.IsTileInTerritory(Core.EntityManager, val12.Tile, ref castleTerritoryEntity, ref val13) && current3.TryRead<UserOwner>(out UserOwner componentData))
								{
									Entity entityOnServer2 = ((NetworkedEntity)(ref componentData.Owner)).GetEntityOnServer();
									if (!((Entity)(ref entityOnServer2)).Equals(Entity.Null) && entityOnServer2.Exists() && entityOnServer2.TryRead<User>(out User componentData2))
									{
										text3 = ((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString() + "'s castle in ";
									}
									break;
								}
							}
							CurrentMapZone val14 = user.Read<CurrentMapZone>();
							string text4 = ((object)(TerrainChunk)(ref val14.TerrainChunk)).ToString();
							if (text4 == "8,8" || text4 == "14,8")
							{
								text3 += Database.GetChunkCommonName(text4);
							}
							else
							{
								entityManager = Core.EntityManager;
								EntityQueryDesc[] array = new EntityQueryDesc[1];
								EntityQueryDesc val15 = new EntityQueryDesc();
								val15.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<TerrainChunkMetadata>() });
								array[0] = val15;
								EntityQuery val16 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
								NativeArray<Entity> val17 = ((EntityQuery)(ref val16)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
								try
								{
									Enumerator<Entity> enumerator4 = val17.GetEnumerator();
									while (enumerator4.MoveNext())
									{
										Entity current4 = enumerator4.Current;
										if (current4.TryRead<TerrainChunkMetadata>(out TerrainChunkMetadata componentData3) && ((TerrainChunk)(ref componentData3.Coordinate)).Equals(val14.TerrainChunk))
										{
											text3 += Database.GetChunkCommonName(((object)(FixedString128Bytes)(ref componentData3.ChunkName)).ToString());
											break;
										}
									}
								}
								finally
								{
									val17.Dispose();
								}
							}
						}
						if (flag5)
						{
							double serverTime = Core.Server.GetExistingSystemManaged<ServerScriptMapper>().GetServerGameManager().ServerTime;
							entityManager = Core.EntityManager;
							Enumerator<AbilityGroupSlotBuffer> enumerator5 = ((EntityManager)(ref entityManager)).GetBuffer<AbilityGroupSlotBuffer>(character, false).GetEnumerator();
							while (enumerator5.MoveNext())
							{
								AbilityGroupSlotBuffer current5 = enumerator5.Current;
								Entity entity = current5.GroupSlotEntity._Entity;
								AbilityGroupSlot val18 = entity.Read<AbilityGroupSlot>();
								if (val18.SlotId != 7)
								{
									continue;
								}
								Entity entity2 = val18.StateEntity._Entity;
								if (!ModifiableBool.op_Implicit(val18.CopyCooldown))
								{
									entity2 = val18.PreviousStateEntity._Entity;
								}
								if (!((Entity)(ref entity2)).Equals(Entity.Null) && entity2.Exists())
								{
									entityManager = Core.EntityManager;
									Enumerator<AbilityStateBuffer> enumerator6 = ((EntityManager)(ref entityManager)).GetBuffer<AbilityStateBuffer>(entity2, false).GetEnumerator();
									if (enumerator6.MoveNext())
									{
										AbilityStateBuffer current6 = enumerator6.Current;
										Entity entity3 = current6.StateEntity._Entity;
										AbilityCooldownState val19 = entity3.Read<AbilityCooldownState>();
										newValue3 = Math.Ceiling(Math.Max(val19.CooldownEndTime - serverTime, 0.0)) + "s";
									}
								}
								break;
							}
						}
						((FixedString512Bytes)(ref val20))..ctor(value2.message.Replace("$combatTimer", newValue, StringComparison.OrdinalIgnoreCase).Replace("$baneTimer", text2, StringComparison.OrdinalIgnoreCase).Replace("$deathTimer", newValue2, StringComparison.OrdinalIgnoreCase)
							.Replace("$location", text3, StringComparison.OrdinalIgnoreCase)
							.Replace("$ultCd", newValue3, StringComparison.OrdinalIgnoreCase));
						entityManager = Core.EntityManager;
						((EntityManager)(ref entityManager)).DestroyEntity(current);
						if (value2.message[0] == '.')
						{
							ChatMessageEvent val21 = default(ChatMessageEvent);
							val21.MessageType = (ChatMessageType)3;
							val21.MessageText = FixedString512Bytes.op_Implicit(value2.message);
							ChatMessageEvent componentData4 = val21;
							entityManager = Core.EntityManager;
							Entity val22 = ((EntityManager)(ref entityManager)).CreateEntity();
							entityManager = Core.EntityManager;
							((EntityManager)(ref entityManager)).AddComponentData<FromCharacter>(val22, val3);
							Helper.AddComponentData<ChatMessageEvent>(val22, componentData4);
							continue;
						}
						ServerChatMessageType val23 = (ServerChatMessageType)((value2.scope == "global") ? 1 : ((value2.scope == "clan") ? 3 : 8));
						if ((int)val23 == 3)
						{
							if (!entityOnServer.Exists() || ((Entity)(ref entityOnServer)).Equals(Entity.Null))
							{
								Helper.SendSystemMessageToClient(user2, "ChatWheel: You don't have a clan.");
								continue;
							}
							entityManager = Core.EntityManager;
							DynamicBuffer<SyncToUserBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<SyncToUserBuffer>(entityOnServer, false);
							for (int i = 0; i < buffer.Length; i++)
							{
								SyncToUserBuffer val24 = buffer[i];
								Entity userEntity = val24.UserEntity;
								if (userEntity.TryRead<ConnectedUser>(out ConnectedUser componentData5))
								{
									int userIndex = componentData5.UserIndex;
									ServerChatUtils.SendChatMessage(Core.EntityManager, ref userIndex, ref val20, ref val4, ref val5, val23, DateTime.UtcNow.Ticks);
								}
							}
							continue;
						}
						Enumerator<Entity> enumerator7 = Helper.GetEntitiesByComponentType<PlayerCharacter>().GetEnumerator();
						while (enumerator7.MoveNext())
						{
							Entity current7 = enumerator7.Current;
							Entity userEntity2 = current7.Read<PlayerCharacter>().UserEntity;
							if (!userEntity2.TryRead<ConnectedUser>(out ConnectedUser componentData6))
							{
								continue;
							}
							if ((int)val23 == 8)
							{
								LocalToWorld val25 = character.Read<LocalToWorld>();
								float3 position = ((LocalToWorld)(ref val25)).Position;
								val25 = current7.Read<LocalToWorld>();
								float3 position2 = ((LocalToWorld)(ref val25)).Position;
								if (Vector3.Distance(float3.op_Implicit(position), float3.op_Implicit(position2)) > 40f)
								{
									continue;
								}
							}
							int userIndex2 = componentData6.UserIndex;
							ServerChatUtils.SendChatMessage(Core.EntityManager, ref userIndex2, ref val20, ref val4, ref val5, val23, DateTime.UtcNow.Ticks);
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Core.Log;
				bool flag6 = default(bool);
				BepInExErrorLogInterpolatedStringHandler val26 = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag6);
				if (flag6)
				{
					((BepInExLogInterpolatedStringHandler)val26).AppendLiteral("Error in EmoteSystemPatch: ");
					((BepInExLogInterpolatedStringHandler)val26).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val26);
			}
			finally
			{
				val.Dispose();
			}
		}
	}
}
namespace ChatWheel.Models
{
	public class ChatWheelMessage
	{
		public string scope;

		public string message;
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public readonly struct Database
	{
		private static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "ChatWheel");

		public static readonly string PLAYER_SETTINGS_PATH = Path.Combine(CONFIG_PATH, "playerSettings.json");

		public static readonly string CHATWHEEL_PATH = Path.Combine(CONFIG_PATH, "chatwheel.json");

		public static readonly string CHUNKMAP_PATH = Path.Combine(CONFIG_PATH, "chunkMap.json");

		private static readonly Dictionary<string, string> CHUNKMAP = new Dictionary<string, string>
		{
			{ "14,8", "Farbane southeast near waygate" },
			{ "8,8", "Farbane southwest near waygate" },
			{ "Curse_Builder_Corner01_Territory", "CF northwest" },
			{ "Curse_Builder_Corner02_Territory", "CF northeast" },
			{ "Curse_Corner01", "Frog Boss" },
			{ "Curse_Edge04", "Cyril-Matka" },
			{ "Curse_Edge05_Territory", "CF middle south" },
			{ "Curse_Edge06", "CF near Behemoth cave" },
			{ "Curse_SpiderCave01_Territory", "Spider Cave" },
			{ "Cursed_InCorner01_Territory", "CF north" },
			{ "Dev_Island_Chunk", "Dev Island" },
			{ "Dunley_Builder_Corner01_Territory", "Dunley southwest corner" },
			{ "Dunley_Builder_Corner02_Territory", "Dunley southeast " },
			{ "Dunley_Builder_Corner04", "Quartz Quarry" },
			{ "Dunley_Builder_Edge01_Territory", "Dunley east" },
			{ "Dunley_Builder_Edge02_Territory", "Iron Mine east beside waygate" },
			{ "Dunley_Builder_Edge03_Territory", "Iron Mine west beside waygate" },
			{ "Dunley_Builder_Edge04_Territory", "around Maja" },
			{ "Dunley_Corner05_DraculasRuin", "Dunley north below Gloom waygate" },
			{ "Dunley_Edge01_HorseTrack", "Horse Track" },
			{ "Dunley_Edge05_BigFarm", "Dunley near Lumber Mill" },
			{ "Dunley_Edge06_FarmCotton_Territory", "Dunley southeast Cotton Farm" },
			{ "Dunley_Edge08_DraculasRuin", "Styx south" },
			{ "Dunley_Group_IronMine_Mid01_Territory", "Iron Mine" },
			{ "Dunley_Group_IronMine_Mid02_Territory", "Iron Mine north" },
			{ "Dunley_Group_Middle01", "Dunley middle" },
			{ "Dunley_Group_Middle02", "Dunley-Farbane Cave" },
			{ "Dunley_Group_Middle03", "Dunley near Market" },
			{ "Dunley_Group_Middle04", "Dunley north near Iron Cave" },
			{ "Dunley_GroupWerewolf_Chunk01_Territory", "Leandra" },
			{ "Dunley_GroupWerewolf_Chunk02", "Colosseum-Werewolf area" },
			{ "Dunley_GroupWerewolf_Chunk03", "Maja north" },
			{ "Dunley_GroupWerewolf_Chunk04_Territory", "Werewolf" },
			{ "Dunley_GroupWerewolf_Chunk05_Territory", "Werewolf east" },
			{ "Dunley_InCorner01_IronVeins_Territory", "Monastery waygate" },
			{ "Dunley_Mid02_Colosseum", "Colosseum" },
			{ "Dunley_Mid02_Colosseum_Territory", "Colosseum" },
			{ "Dunley_Mid03_BigFort", "Dunley around Octavian" },
			{ "Dunley_Mid04_VillageChurch_Territory", "Mosswick" },
			{ "Dunley_Mid05_Lake", "Iron Mine west" },
			{ "Dunley_Mid06_AnimalFarm", "Iron Mine east" },
			{ "Dunley_Mid07_Waypoint_Territory", "Beatrice north" },
			{ "Dunley_Mid08_VillageChurch_Territory", "Beatrice" },
			{ "Dunley_Mid09_BigChurch_Territory", "Monastery" },
			{ "Dunley_Mid09_Waypoint", "Octavian waygate" },
			{ "DunleyCursed_BridgeGroup01_Chunk01", "CF west waygate" },
			{ "DunleySilver_BridgeGroup01_Chunk01_Territory", "Dunley-SL road" },
			{ "DunleySilver_BridgeGroup01_Chunk02", "SL waygate" },
			{ "DunleyWerewolf_Chunk01", "Leandra" },
			{ "ElrisCursed_Bridge_Group01_Chunk01", "Foulrot waygate" },
			{ "ElrisCursed_Bridge_Group01_Chunk02", "Rift #2 north" },
			{ "ElrisCursed_Bridge01_Chunk02", "Mortium north" },
			{ "Farbane_BackgroundChunk02", "Farbane far south middle" },
			{ "Farbane_Builder_Corner01_Territory", "Farbane southwest corner" },
			{ "Farbane_Builder_Corner02_Territory", "Farbane near west Dunley bridge" },
			{ "Farbane_Builder_Corner03_Territory", "Below Goreswine Right Cemetery" },
			{ "Farbane_Builder_Corner04_Territory", "Farbane south of Goreswine Left Cemetery" },
			{ "Farbane_Builder_Edge01_Territory", "Finn" },
			{ "Farbane_Builder_Edge02_Territory", "Talzur" },
			{ "Farbane_Builder_Edge03_Territory", "Farbane southeast" },
			{ "Farbane_Builder_Edge04_Territory", "Farbane north, east of Quincey" },
			{ "Farbane_Builder_Edge05_Territory", "Farbane north, west of Quincey" },
			{ "Farbane_Builder_Edge06_Territory", "Clive north" },
			{ "Farbane_Builder_Edge07_Territory", "Farbane southwest" },
			{ "Farbane_Builder_Edge08_Territory", "Farbane southeast" },
			{ "Farbane_Builder_InCorner01_Territory", "Farbane near west Merchant" },
			{ "Farbane_Builder_InCorner03_Territory", "Bear Cave west" },
			{ "Farbane_Builder_InCorner04_Territory", "Farbane southwest area" },
			{ "Farbane_Builder_InCorner05_Territory", "Polora south" },
			{ "Farbane_Corner03_GrizzlyBearCave_Territory", "Bear Cave" },
			{ "Farbane_Corner04_Medow_Territory", "Polora" },
			{ "Farbane_Corner06_Sulfurquarry", "Clive" },
			{ "Farbane_Edge05", "Farbane south middle" },
			{ "Farbane_Edge06_BanditFort_Territory", "Quincey" },
			{ "Farbane_InCorner04_Graveyard_Territory", "Goreswine Left Cemetery" },
			{ "Farbane_InCorner05_Graveyard_Territory", "Goreswine Right Cemetery" },
			{ "Farbane_InCorner06_Territory", "Farbane west edge" },
			{ "Farbane_Mid02_HauntedGraveyard_Territory", "Nicholaus" },
			{ "Farbane_Mid02_Waypoint_Territory", "near Keely waygate" },
			{ "Farbane_Mid05_BanditEncampment_Territory", "Nicholaus-Keely road" },
			{ "Farbane_Mid07_Territory", "Farbane east" },
			{ "Farbane_Mid09_Territory", "Copper Mine north" },
			{ "Farbane_Mid10_Territory", "Farbane west" },
			{ "Farbane_Mid11_Quarry_Territory", "Copper Mine" },
			{ "Farbane_Mid12_BanditForge_Territory", "Grayson" },
			{ "Farbane_Mid13_BanditTailor_Territory", "Keely" },
			{ "Farbane_Mid14_Territory", "Farbane west" },
			{ "Farbane_Mid15_Territory", "Farbane middle" },
			{ "Farbane_Mid16_Territory", "Farbane east" },
			{ "Farbane_Mid17_LumberCamp_Territory", "Rufus" },
			{ "Farbane_Mid18_Waypoint_Territory", "near Grayson waygate" },
			{ "Farbane_Snow_TransitionGroup01_Chunk01_Territory", "Farbane-Snow road" },
			{ "Farbane_Snow_TransitionGroup01_Chunk02_Territory", "Terrorclaw Cave" },
			{ "Farbane_Snow_TransitionGroup01_Chunk03_Territory", "Snow waygate" },
			{ "Farbane_Snow_TransitionGroup01_Chunk04_Territory", "Snow northeast" },
			{ "FarbaneDunley_BridgeGroup01_Chunk01_Territory", "Farbane-Dunley east bridge" },
			{ "FarbaneDunley_BridgeGroup01_Chunk02_Territory", "Dunley southeast" },
			{ "FarbaneDunley_BridgeGroup02_Chunk01_Territory", "Farbane-Dunley west bridge" },
			{ "FarbaneDunley_BridgeGroup02_Chunk02_Territory", "Dunley southwest" },
			{ "FarbaneSilver_Group_Bridge01_Territory", "Polora waygate" },
			{ "FarbaneSilver_Group_Bridge02", "SL south" },
			{ "Gloomrot_Corner01", "Bottom Right Gloom" },
			{ "Gloomrot_Corner02", "Gloom northeast corner" },
			{ "Gloomrot_Corner03", "Gloom west waygate" },
			{ "Gloomrot_Corner04", "Gloom northwest corner" },
			{ "Gloomrot_Edge01_DraculasRuin", "Styx" },
			{ "Gloomrot_Edge02_DraculasRuin", "Gloom south waygate" },
			{ "Gloomrot_Edge03", "Gloom northeast" },
			{ "Gloomrot_Edge04", "Ziva north" },
			{ "Gloomrot_Edge05", "Voltatia" },
			{ "Gloomrot_Edge06", "Adam east" },
			{ "Gloomrot_Edge07", "Adam" },
			{ "Gloomrot_Edge08", "Domina south" },
			{ "Gloomrot_Edge09", "Gloom west waygate" },
			{ "Gloomrot_Edge10", "Gloom Merchant" },
			{ "Gloomrot_Edge11", "Gloom northwest corner" },
			{ "Gloomrot_Mid01", "Adam" },
			{ "Gloomrot_Mid02", "Sulphur Mine east" },
			{ "Gloomrot_Mid03", "Gloom Sulphur Mine" },
			{ "Gloomrot_Mid04", "Domina-Angram area" },
			{ "Gloomrot_Mid05", "Henry south" },
			{ "Gloomrot_Mid06", "Henry" },
			{ "Gloomrot_Mid07", "Henry east" },
			{ "Gloomrot_Mid08", "Gloom north waygate" },
			{ "Gloomrot_Mid09", "Ziva" },
			{ "GloomrotCursed_BridgeGroup01_Chunk01", "Gloom-CF road" },
			{ "Noctem_Corner01", "Rift #7 east" },
			{ "Noctem_Corner02", "Small Garden" },
			{ "Noctem_Corner03", "Rift #1" },
			{ "Noctem_Corner04", "Dracula's Garden" },
			{ "Noctem_Edge01", "Rift #7" },
			{ "Noctem_Edge02", "Mortium South" },
			{ "Noctem_Edge03", "Dracula's Garden" },
			{ "Noctem_Edge04", "Rift #4" },
			{ "Noctem_Edge05", "Mortium top left" },
			{ "Noctem_Edge06", "Rift #6" },
			{ "Noctem_Edge07_boss", "Dracula's Throne Room" },
			{ "Noctem_Edge07_bossDead", "Dracula's Red Portal Room" },
			{ "Noctem_Edge07_ruined", "Shadow Realm Portal Room" },
			{ "Noctem_Mid01", "Rift #5" },
			{ "Noctem_Mid02", "Mortium middle" },
			{ "Noctem_Mid03", "Rift #2" },
			{ "Noctem_Mid04", "Rift #3" },
			{ "Noctem_Mid05", "Mortium top right around Rift #6" },
			{ "Silver_Builder_Corner01_Territory", "Mairwyn south" },
			{ "Silver_Builder_Corner02", "SL-Gloom road" },
			{ "Silver_Builder_Corner03_Territory", "SL southwest corner" },
			{ "Silver_Builder_Corner04_Territory", "City north plot" },
			{ "Silver_Builder_Mountain_Edge01_Territory", "SL waygate north" },
			{ "Silver_City01", "City Docks" },
			{ "Silver_City02", "City south" },
			{ "Silver_City03", "City north/east" },
			{ "Silver_City04_Territory", "City northwest" },
			{ "Silver_Edge01_Silvermine", "Silver Mine" },
			{ "Silver_Edge01_SilverMine", "Silver Mine" },
			{ "Silver_Edge02", "Mairwyn" },
			{ "Silver_Edge03", "Solarus" },
			{ "Silver_Mid01", "Morian" },
			{ "Silver_Mid02", "Baron-Solarus area" },
			{ "Silver_Mid03", "SL waygate" },
			{ "Snow_WildlingGroup01_Edge01", "Rift #3 north" },
			{ "Start_Vault", "The Starting Area" },
			{ "Strongblade_Corner02", "Oak west of Stavros" },
			{ "Strongblade_Corner03", "Oak Beach" },
			{ "Strongblade_Corner04", "Dantos" },
			{ "Strongblade_Corner05", "Megara" },
			{ "Strongblade_Edge01", "Oak south" },
			{ "Strongblade_Edge02", "Oak southwest corner" },
			{ "Strongblade_Edge03", "Oak east" },
			{ "Strongblade_Edge04", "Oak east waygate" },
			{ "Strongblade_InCorner01", "Oak west waygate" },
			{ "Strongblade_InCorner02", "Stavros" },
			{ "Strongblade_Mid01", "Lucile" },
			{ "Strongblade_Mid02", "Dantos south" },
			{ "Strongblade_SilverGloomTransition01", "Jakira" },
			{ "Strongblade_SilverTransition01", "SL-Oak road" },
			{ "Strongblande_SilverGloomTransition01", "Jakira" },
			{ "Wild_Group_StartGraveyard03", "The Graveyard" },
			{ "Wild_Group_StartGraveyard03_Copy", "The Graveyard" },
			{ "Wild_Group_StartGraveyard04_Copy", "The Graveyard" }
		};

		public static Dictionary<string, ChatWheelMessage> CHATWHEEL = new Dictionary<string, ChatWheelMessage>();

		public static Dictionary<string, bool> PLAYER_SETTINGS = new Dictionary<string, bool>();

		public static void InitConfig()
		{
			CHATWHEEL.Clear();
			PLAYER_SETTINGS.Clear();
			string json;
			if (File.Exists(CHUNKMAP_PATH))
			{
				json = File.ReadAllText(CHUNKMAP_PATH);
				Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
				foreach (KeyValuePair<string, string> item in dictionary)
				{
					CHUNKMAP[item.Key] = item.Value;
				}
			}
			else
			{
				SaveChunkMap();
			}
			if (File.Exists(CHATWHEEL_PATH))
			{
				json = File.ReadAllText(CHATWHEEL_PATH);
				Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
				foreach (KeyValuePair<string, string> item2 in dictionary)
				{
					string[] array = item2.Value.Split(',', 2);
					CHATWHEEL[item2.Key] = new ChatWheelMessage
					{
						scope = array[0],
						message = array[1]
					};
				}
			}
			else
			{
				SaveChatWheel();
			}
			if (!File.Exists(PLAYER_SETTINGS_PATH))
			{
				return;
			}
			json = File.ReadAllText(PLAYER_SETTINGS_PATH);
			Dictionary<string, bool> dictionary2 = JsonSerializer.Deserialize<Dictionary<string, bool>>(json);
			foreach (KeyValuePair<string, bool> item3 in dictionary2)
			{
				PLAYER_SETTINGS[item3.Key] = item3.Value;
			}
		}

		public static void ReloadChunkMap()
		{
			if (!File.Exists(CHUNKMAP_PATH))
			{
				return;
			}
			string json = File.ReadAllText(CHUNKMAP_PATH);
			Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
			foreach (KeyValuePair<string, string> item in dictionary)
			{
				CHUNKMAP[item.Key] = item.Value;
			}
		}

		public static void SaveChatWheel()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			foreach (KeyValuePair<string, ChatWheelMessage> item in CHATWHEEL)
			{
				dictionary[item.Key] = item.Value.scope + "," + item.Value.message;
			}
			WriteConfig(CHATWHEEL_PATH, dictionary);
		}

		public static void WriteConfig(string path, Dictionary<string, string> dict)
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			string contents = JsonSerializer.Serialize(dict, new JsonSerializerOptions
			{
				WriteIndented = true
			});
			File.WriteAllText(path, contents);
		}

		public static void WriteConfig(string path, Dictionary<string, bool> dict)
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			string contents = JsonSerializer.Serialize(dict, new JsonSerializerOptions
			{
				WriteIndented = true
			});
			File.WriteAllText(path, contents);
		}

		public static void SaveChunkMap()
		{
			WriteConfig(CHUNKMAP_PATH, CHUNKMAP);
		}

		public static void UpdateChunkMap(string chunk, string name)
		{
			CHUNKMAP[chunk] = name;
			SaveChunkMap();
		}

		public static string GetChunkCommonName(string chunk)
		{
			return CHUNKMAP.ContainsKey(chunk) ? CHUNKMAP[chunk] : chunk.Replace("_", " ");
		}

		public static void SavePlayerSettings()
		{
			WriteConfig(PLAYER_SETTINGS_PATH, PLAYER_SETTINGS);
		}

		public static void DisableChatWheel(string platformId)
		{
			PLAYER_SETTINGS[platformId] = false;
			SavePlayerSettings();
		}

		public static void EnableChatWheel(string platformId)
		{
			PLAYER_SETTINGS[platformId] = true;
			SavePlayerSettings();
		}

		public static bool IsChatWheelEnabled(string platformId)
		{
			return PLAYER_SETTINGS.GetValueOrDefault(platformId, defaultValue: true);
		}
	}
}
namespace ChatWheel.Commands
{
	[CommandGroup("chatwheel", "cw")]
	internal class ChatWheelCommands
	{
		public static Dictionary<string, ChatWheelMessage> TO_BIND = new Dictionary<string, ChatWheelMessage>();

		public static List<string> TO_UNBIND = new List<string>();

		[Command("bind", "b", null, "Binds a chat message on the emote wheel", null, false)]
		public static void BindCommand(ChatCommandContext ctx, string scope, string message)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			scope = scope.ToLower();
			if (scope == "local" || scope == "l")
			{
				scope = "local";
			}
			else
			{
				if (!(scope == "clan") && !(scope == "team") && !(scope == "c"))
				{
					ctx.Reply("Invalid message scope. Please choose between local or clan.");
					return;
				}
				scope = "clan";
			}
			string key = ctx.Event.User.PlatformId.ToString();
			ChatWheelMessage value = new ChatWheelMessage
			{
				message = message,
				scope = scope
			};
			TO_BIND[key] = value;
			ctx.Reply("ChatWheel: Now choose the emote to bind it to (Hold ALT).");
		}

		[Command("unbind", "ub", null, "Unbinds a chat message on the emote wheel", null, false)]
		public static void UnbindCommand(ChatCommandContext ctx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			string item = ctx.Event.User.PlatformId.ToString();
			TO_UNBIND.Add(item);
			ctx.Reply("ChatWheel: Now choose the emote you want to unbind.");
		}

		[Command("list", "l", null, "Lists all bound messages", null, false)]
		public static void ListCommand(ChatCommandContext ctx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			string text = ctx.Event.User.PlatformId.ToString();
			bool flag = false;
			PrefabGUID prefabGuid = default(PrefabGUID);
			foreach (KeyValuePair<string, ChatWheelMessage> item in Database.CHATWHEEL)
			{
				if (item.Key.StartsWith(text))
				{
					flag = true;
					((PrefabGUID)(ref prefabGuid))..ctor(int.Parse(item.Key.Split("|")[1]));
					string value = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(item.Value.scope.ToLower());
					ctx.Reply($"Emote <color=#C82D36>{Core.ChatWheelService.GetEmoteName(prefabGuid)}</color> <color=#0ff>[{value}]</color> <color=#8DD9FF>{item.Value.message}");
				}
			}
			if (!Database.IsChatWheelEnabled(text) && flag)
			{
				ctx.Reply("<color=red>Note: ChatWheel is disabled! Enable it by doing</color> <color=#8DD9FF>.cw enable");
			}
			if (!flag)
			{
				ctx.Reply("No chat is bound to the wheel.");
			}
		}

		[Command("clear", null, null, "Removes all bound messages", null, false)]
		public static void ClearCommand(ChatCommandContext ctx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			string value = ctx.Event.User.PlatformId.ToString();
			int num = 0;
			foreach (KeyValuePair<string, ChatWheelMessage> item in Database.CHATWHEEL)
			{
				if (item.Key.StartsWith(value))
				{
					num++;
					Database.CHATWHEEL.Remove(item.Key);
				}
			}
			if (num > 0)
			{
				Database.SaveChatWheel();
				ctx.Reply($"Cleared {num} message(s).");
			}
			else
			{
				ctx.Reply("Nothing to clear.");
			}
		}

		[Command("enable", null, null, "Enables chatwheel", null, false)]
		public static void EnableCommand(ChatCommandContext ctx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			string platformId = ctx.Event.User.PlatformId.ToString();
			Database.EnableChatWheel(platformId);
			ctx.Reply("ChatWheel enabled.");
		}

		[Command("disable", null, null, "Disables chatwheel", null, false)]
		public static void DisableCommand(ChatCommandContext ctx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			string platformId = ctx.Event.User.PlatformId.ToString();
			Database.DisableChatWheel(platformId);
			ctx.Reply("ChatWheel disabled.");
		}

		[Command("reload", "r", null, "Reload the chunk map if file was manually updated", null, true)]
		public static void ReloadChunkMapCommand(ChatCommandContext ctx)
		{
			Database.ReloadChunkMap();
			ctx.Reply("Reloaded.");
		}

		[Command("renamechunk", "rc", null, "Updates the chunk map", null, true)]
		public static void UpdateChunkMapCommand(ChatCommandContext ctx, string name)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			CurrentMapZone val = ctx.Event.SenderUserEntity.Read<CurrentMapZone>();
			string text = ((object)(TerrainChunk)(ref val.TerrainChunk)).ToString();
			EntityManager entityManager = Core.EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<TerrainChunkMetadata>() });
			array[0] = val2;
			EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			NativeArray<Entity> val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val4.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (current.TryRead<TerrainChunkMetadata>(out TerrainChunkMetadata componentData) && ((TerrainChunk)(ref componentData.Coordinate)).Equals(val.TerrainChunk))
					{
						text = ((object)(FixedString128Bytes)(ref componentData.ChunkName)).ToString();
						break;
					}
				}
			}
			finally
			{
				val4.Dispose();
			}
			Database.UpdateChunkMap(text, name);
			ctx.Reply($"Updated name for \"{text}\" to \"{name}\"");
		}
	}
}