Decompiled source of Bloodcraft v1.13.22

Bloodcraft.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Bloodcraft.Commands;
using Bloodcraft.Interfaces;
using Bloodcraft.Patches;
using Bloodcraft.Resources;
using Bloodcraft.Services;
using Bloodcraft.Systems;
using Bloodcraft.Systems.Expertise;
using Bloodcraft.Systems.Familiars;
using Bloodcraft.Systems.Legacies;
using Bloodcraft.Systems.Leveling;
using Bloodcraft.Systems.Professions;
using Bloodcraft.Systems.Quests;
using Bloodcraft.Utilities;
using BloodcraftEclipseBridge.Messages;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Text;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.AimPreviewSplines.Component;
using ProjectM.Audio;
using ProjectM.Behaviours;
using ProjectM.CastleBuilding;
using ProjectM.CastleBuilding.AssetSwapping;
using ProjectM.CastleBuilding.Items;
using ProjectM.CastleBuilding.Placement;
using ProjectM.CastleBuilding.Rebuilding;
using ProjectM.Community;
using ProjectM.Debugging;
using ProjectM.Gameplay;
using ProjectM.Gameplay.Clan;
using ProjectM.Gameplay.Scripting;
using ProjectM.Gameplay.Systems;
using ProjectM.Gameplay.WarEvents;
using ProjectM.HUD;
using ProjectM.Haptics;
using ProjectM.Hybrid;
using ProjectM.LightningStorm;
using ProjectM.Network;
using ProjectM.Pathfinding;
using ProjectM.Physics;
using ProjectM.Presentation;
using ProjectM.Replays;
using ProjectM.Roofs;
using ProjectM.Scripting;
using ProjectM.Sequencer;
using ProjectM.Sequencer.Debugging;
using ProjectM.Shared;
using ProjectM.Shared.Systems;
using ProjectM.Shared.WarEvents;
using ProjectM.Shared.WorldEvents;
using ProjectM.SunBlocker;
using ProjectM.Terrain;
using ProjectM.Terrain.Editor;
using ProjectM.Tiles;
using ProjectM.Transmog;
using ProjectM.UI;
using ProjectM.Wind;
using ScarletRCON.Shared;
using Stunlock.Core;
using Stunlock.Core.Authoring;
using Stunlock.Network;
using Stunlock.Sequencer;
using Terrain.Systems;
using Tests;
using Unity.Collections;
using Unity.Deformations;
using Unity.Entities;
using Unity.Entities.Graphics;
using Unity.Entities.Graphics.Extension;
using Unity.Entities.Hybrid.Baking;
using Unity.Entities.Serialization;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Physics;
using Unity.Physics.Authoring;
using Unity.Physics.GraphicsIntegration;
using Unity.Physics.Systems;
using Unity.Rendering;
using Unity.Scenes;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Bloodcraft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.13.22.0")]
[assembly: AssemblyInformationalVersion("1.13.22+cc34b357e6c3c88e5feadb9b0f7e11ab8d0c904f")]
[assembly: AssemblyProduct("Bloodcraft")]
[assembly: AssemblyTitle("Bloodcraft")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.13.22.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]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Bloodcraft
{
	[HarmonyPatch(typeof(WarEventRegistrySystem), "RegisterWarEventEntities")]
	internal static class Bootstrap
	{
		private static ManualLogSource _logSource;

		private static bool _initialized;

		internal static void Initialize(Harmony harmony, ManualLogSource logSource)
		{
			_logSource = logSource;
			harmony.CreateClassProcessor(typeof(Bootstrap)).Patch();
		}

		[HarmonyPostfix]
		private static void Postfix()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (_initialized)
			{
				return;
			}
			_initialized = true;
			bool flag = default(bool);
			try
			{
				Core.OnInitialize();
				StartupStateService.Mark(StartupState.BootstrapFired);
				ManualLogSource logSource = _logSource;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.13.22");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
				}
				logSource.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource logSource2 = _logSource;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(0, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				logSource2.LogError(val2);
			}
		}
	}
	internal static class Core
	{
		private static World _server;

		private static bool _serverNotReadyLogged;

		private static MonoBehaviour _monoBehaviour;

		private static readonly List<PrefabGUID> _returnBuffs = new List<PrefabGUID>(13)
		{
			PrefabGUIDs.Buff_Shared_Return,
			PrefabGUIDs.Buff_Shared_Return_NoInvulernable,
			PrefabGUIDs.Buff_Vampire_BloodKnight_Return,
			PrefabGUIDs.Buff_Vampire_Dracula_Return,
			PrefabGUIDs.Buff_Dracula_Return,
			PrefabGUIDs.Buff_WerewolfChieftain_Return,
			PrefabGUIDs.Buff_Werewolf_Return,
			PrefabGUIDs.Buff_Monster_Return,
			PrefabGUIDs.Buff_Purifier_Return,
			PrefabGUIDs.Buff_Blackfang_Morgana_Return,
			PrefabGUIDs.Buff_ChurchOfLight_Paladin_Return,
			PrefabGUIDs.Buff_Gloomrot_Voltage_Return,
			PrefabGUIDs.Buff_Militia_Fabian_Return
		};

		private static readonly List<PrefabGUID> _bearFormBuffs = new List<PrefabGUID>(2)
		{
			PrefabGUIDs.AB_Shapeshift_Bear_Buff,
			PrefabGUIDs.AB_Shapeshift_Bear_Skin01_Buff
		};

		private static readonly List<PrefabGUID> _shardBearerDropTables = new List<PrefabGUID>(5)
		{
			PrefabGUIDs.DT_Unit_Relic_Manticore_Unique,
			PrefabGUIDs.DT_Unit_Relic_Paladin_Unique,
			PrefabGUIDs.DT_Unit_Relic_Monster_Unique,
			PrefabGUIDs.DT_Unit_Relic_Dracula_Unique,
			PrefabGUIDs.DT_Unit_Relic_Morgana_Unique
		};

		private static readonly ComponentType[] _nightmareUnitAllComponents = (ComponentType[])(object)new ComponentType[6]
		{
			ComponentType.ReadOnly(Il2CppType.Of<PrefabGUID>()),
			ComponentType.ReadOnly(Il2CppType.Of<Health>()),
			ComponentType.ReadOnly(Il2CppType.Of<UnitStats>()),
			ComponentType.ReadOnly(Il2CppType.Of<AiMoveSpeeds>()),
			ComponentType.ReadOnly(Il2CppType.Of<UnitLevel>()),
			ComponentType.ReadOnly(Il2CppType.Of<AggroConsumer>())
		};

		private static EntityQueries.QueryDesc _nightmareUnitQueryDesc;

		private static HashSet<WeaponType> _bleedingEdge = new HashSet<WeaponType>();

		private static HashSet<Profession> _disabledProfessions = new HashSet<Profession>();

		private const int SECONDARY_SKILL_SLOT = 4;

		private const int BLEED_STACKS = 3;

		private const float NIGHTMARE_HEALTH_MULTIPLIER = 5f;

		private const float NIGHTMARE_POWER_MULTIPLIER = 1.5f;

		private const float NIGHTMARE_MOVE_SPEED_MULTIPLIER = 1.25f;

		private static bool _initialized;

		private static readonly HashSet<PrefabGUID> _shardBearers = new HashSet<PrefabGUID>
		{
			PrefabGUIDs.CHAR_Manticore_VBlood,
			PrefabGUIDs.CHAR_ChurchOfLight_Paladin_VBlood,
			PrefabGUIDs.CHAR_Gloomrot_Monster_VBlood,
			PrefabGUIDs.CHAR_Vampire_Dracula_VBlood,
			PrefabGUIDs.CHAR_Blackfang_Morgana_VBlood
		};

		private static World Server
		{
			get
			{
				World server = _server;
				if (server != null && server.IsCreated)
				{
					return _server;
				}
				_server = WorldUtility.FindServerWorld(true);
				World server2 = _server;
				if (server2 == null || !server2.IsCreated)
				{
					if (!_serverNotReadyLogged)
					{
						_serverNotReadyLogged = true;
						Log.LogWarning((object)"Server world requested before it is ready.");
					}
					throw new InvalidOperationException("Server world is not ready yet.");
				}
				_serverNotReadyLogged = false;
				return _server;
			}
		}

		public static EntityManager EntityManager => Server.EntityManager;

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

		public static SystemService SystemService { get; set; }

		public static ServerGameBalanceSettings ServerGameBalanceSettings { get; set; }

		public static bool IsPvP => (int)ServerGameBalanceSettings.GameModeType == 1;

		public static double ServerTime => ServerGameManager.ServerTime;

		public static double DeltaTime => ServerGameManager.DeltaTime;

		public static ManualLogSource Log => Plugin.MiniBehaviour.LogSource;

		private static bool ShouldResetShardBearers => ConfigService.EliteShardBearers;

		private static bool ShouldApplyBonusStats
		{
			get
			{
				if (!ConfigService.LegacySystem && !ConfigService.ExpertiseSystem && !ConfigService.ClassSystem)
				{
					return ConfigService.FamiliarSystem;
				}
				return true;
			}
		}

		public static bool Eclipsed
		{
			get
			{
				if (!ConfigService.LevelingSystem && !ConfigService.LegacySystem && !ConfigService.ExpertiseSystem && !ConfigService.ClassSystem)
				{
					return ConfigService.FamiliarSystem;
				}
				return true;
			}
		}

		public static IReadOnlySet<WeaponType> BleedingEdge => _bleedingEdge;

		public static IReadOnlySet<Profession> DisabledProfessions => _disabledProfessions;

		public static byte[] NEW_SHARED_KEY { get; set; }

		public static bool IsReady => _initialized;

		internal static void OnInitialize()
		{
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			if (_initialized)
			{
				return;
			}
			NEW_SHARED_KEY = Convert.FromBase64String(SecretManager.GetNewSharedKey());
			SystemService = new SystemService(Server);
			if (!ComponentRegistry._initialized)
			{
				ComponentRegistry.Initialize();
			}
			new PlayerService();
			new LocalizationService();
			if (Eclipsed)
			{
				EmberglassEclipseBridge.Initialize();
				new EclipseService();
			}
			if (ConfigService.ExtraRecipes)
			{
				Recipes.ModifyRecipes();
			}
			if (ConfigService.StarterKit)
			{
				Configuration.GetStarterKitItems();
			}
			if (ConfigService.PrestigeSystem)
			{
				Buffs.GetPrestigeBuffs();
			}
			if (ConfigService.ClassSystem)
			{
				Configuration.GetClassSpellCooldowns();
				Classes.GetAbilityJewels();
			}
			if (ConfigService.LevelingSystem)
			{
				DeathEventListenerSystemPatch.OnDeathEventHandler += LevelingSystem.OnUpdate;
			}
			if (ConfigService.ExpertiseSystem)
			{
				DeathEventListenerSystemPatch.OnDeathEventHandler += WeaponSystem.OnUpdate;
			}
			if (ConfigService.QuestSystem)
			{
				new QuestService();
				DeathEventListenerSystemPatch.OnDeathEventHandler += QuestSystem.OnUpdate;
			}
			if (ConfigService.FamiliarSystem)
			{
				Configuration.GetExcludedFamiliars();
				if (!ConfigService.LevelingSystem)
				{
					DeathEventListenerSystemPatch.OnDeathEventHandler += FamiliarLevelingSystem.OnUpdate;
				}
				DeathEventListenerSystemPatch.OnDeathEventHandler += FamiliarUnlockSystem.OnUpdate;
				new BattleService();
				new FamiliarService();
			}
			if (ConfigService.ProfessionSystem)
			{
				GetDisabledProfessions();
			}
			GetBleedingEdgeWeapons();
			ModifyPrefabs();
			Buffs.GetStackableBuffs();
			try
			{
				ServerGameBalanceSettings = ServerGameBalanceSettings.Get(SystemService.ServerGameSettingsSystem._ServerBalanceSettings);
				Progression.GetAttributeCaps();
			}
			catch (Exception ex)
			{
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error getting attribute soft caps: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogWarning(val);
			}
			if (ShouldResetShardBearers)
			{
				ResetShardBearers();
			}
			_initialized = true;
			StartupStateService.Mark(StartupState.CoreInitialized);
		}

		private static MonoBehaviour GetOrCreateMonoBehaviour()
		{
			return _monoBehaviour ?? (_monoBehaviour = CreateMonoBehaviour());
		}

		private static MonoBehaviour CreateMonoBehaviour()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			IgnorePhysicsDebugSystem obj = new GameObject("Bloodcraft").AddComponent<IgnorePhysicsDebugSystem>();
			Object.DontDestroyOnLoad((Object)(object)((Component)obj).gameObject);
			return (MonoBehaviour)(object)obj;
		}

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			return GetOrCreateMonoBehaviour().StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
		}

		public static void StopCoroutine(Coroutine routine)
		{
			GetOrCreateMonoBehaviour().StopCoroutine(routine);
		}

		public static void Delayed(Action action, float delay = 0.25f)
		{
			RunDelayed(delay, action).Run();
		}

		private static IEnumerator RunDelayed(float delay, Action action)
		{
			yield return (object)new WaitForSeconds(delay);
			action?.Invoke();
		}

		public static AddItemSettings GetAddItemSettings()
		{
			//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_000f: 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_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_0038: Unknown result type (might be due to invalid IL or missing references)
			AddItemSettings result = default(AddItemSettings);
			result.EntityManager = EntityManager;
			result.DropRemainder = true;
			ServerGameManager serverGameManager = ServerGameManager;
			result.ItemDataMap = ((ServerGameManager)(ref serverGameManager)).ItemLookupMap;
			result.EquipIfPossible = true;
			return result;
		}

		private static void GetBleedingEdgeWeapons()
		{
			HashSet<WeaponType> hashSet = new HashSet<WeaponType>();
			foreach (WeaponType item in Configuration.ParseEnumsFromString<WeaponType>(ConfigService.BleedingEdge))
			{
				hashSet.Add(item);
			}
			_bleedingEdge = hashSet;
		}

		public static void GetDisabledProfessions()
		{
			HashSet<Profession> hashSet = new HashSet<Profession>();
			foreach (Profession item in Configuration.ParseEnumsFromString<Profession>(ConfigService.DisabledProfessions))
			{
				hashSet.Add(item);
			}
			_disabledProfessions = hashSet;
		}

		private static void ModifyPrefabs()
		{
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_003f: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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_00a5: 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_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: 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_01b6: 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_01c7: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigService.LevelingSystem)
			{
				Entity entity = default(Entity);
				if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_EquipBuff_Shared_General, ref entity))
				{
					entity.Add<ScriptSpawn>();
				}
				if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_EquipBuff_MagicSource_BloodKey_T01, ref entity))
				{
					entity.Add<ScriptSpawn>();
				}
			}
			if (ConfigService.FamiliarSystem)
			{
				Entity @null = Entity.Null;
				foreach (PrefabGUID returnBuff in _returnBuffs)
				{
					if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(returnBuff, ref @null) && @null.TryGetBuffer<HealOnGameplayEvent>(out DynamicBuffer<HealOnGameplayEvent> dynamicBuffer))
					{
						HealOnGameplayEvent val = dynamicBuffer[0];
						val.showSCT = false;
						dynamicBuffer[0] = val;
					}
				}
			}
			Entity entity2 = default(Entity);
			if (ShouldApplyBonusStats && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(Buffs.BonusStatsBuff, ref entity2))
			{
				entity2.Add<ScriptSpawn>();
				if (entity2.TryGetBuffer<ModifyUnitStatBuff_DOTS>(out DynamicBuffer<ModifyUnitStatBuff_DOTS> dynamicBuffer2))
				{
					dynamicBuffer2.Clear();
				}
			}
			if (ConfigService.BearFormDash)
			{
				Entity entity3 = default(Entity);
				foreach (PrefabGUID bearFormBuff in _bearFormBuffs)
				{
					if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(bearFormBuff, ref entity3) && entity3.TryGetBuffer<ReplaceAbilityOnSlotBuff>(out DynamicBuffer<ReplaceAbilityOnSlotBuff> dynamicBuffer3))
					{
						ReplaceAbilityOnSlotBuff val2 = dynamicBuffer3[4];
						val2.NewGroupId = PrefabGUIDs.AB_Shapeshift_Bear_Dash_Group;
						dynamicBuffer3[4] = val2;
					}
				}
			}
			if (ConfigService.EliteShardBearers && !IsPvP)
			{
				Entity entity4 = default(Entity);
				foreach (PrefabGUID shardBearerDropTable in _shardBearerDropTables)
				{
					if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(shardBearerDropTable, ref entity4) && entity4.TryGetBuffer<DropTableDataBuffer>(out DynamicBuffer<DropTableDataBuffer> dynamicBuffer4) && !dynamicBuffer4.IsEmpty)
					{
						DropTableDataBuffer val3 = dynamicBuffer4[0];
						val3.DropRate = 0.6f;
						dynamicBuffer4.Add(val3);
						val3.DropRate = 0.45f;
						dynamicBuffer4.Add(val3);
						val3.DropRate = 0.3f;
						dynamicBuffer4.Add(val3);
					}
				}
			}
			if (ConfigService.NightmareMode && !IsPvP)
			{
				_nightmareUnitQueryDesc = EntityManager.CreateQueryDesc(_nightmareUnitAllComponents, null, null, new int[1], (EntityQueryOptions)195);
				ApplyNightmareMode();
			}
			if (BleedingEdge.Any())
			{
				Entity entity5 = default(Entity);
				if (BleedingEdge.Contains(WeaponType.Slashers) && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(Buffs.VargulfBleedBuff, ref entity5))
				{
					entity5.With<Buff>((VExtensions.WithRefHandler<Buff>)delegate(ref Buff buff)
					{
						buff.MaxStacks = 3;
						buff.IncreaseStacks = true;
					});
				}
				if (BleedingEdge.Contains(WeaponType.Crossbow, WeaponType.Pistols))
				{
					ComponentType[] allTypes = (ComponentType[])(object)new ComponentType[4]
					{
						ComponentType.ReadOnly(Il2CppType.Of<PrefabGUID>()),
						ComponentType.ReadOnly(Il2CppType.Of<Projectile>()),
						ComponentType.ReadOnly(Il2CppType.Of<LifeTime>()),
						ComponentType.ReadOnly(Il2CppType.Of<Velocity>())
					};
					BleedingEdgePrimaryProjectileRoutine(EntityManager.CreateQueryDesc(allTypes, null, null, new int[1], (EntityQueryOptions)195)).Run();
				}
				Entity entity6 = default(Entity);
				if (BleedingEdge.Contains(WeaponType.Daggers) && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.EquipBuff_Weapon_Daggers_Ability03, ref entity6))
				{
					entity6.WithEdit<RemoveBuffOnGameplayEventEntry>(0, (VExtensions.WithRefHandler<RemoveBuffOnGameplayEventEntry>)delegate(ref RemoveBuffOnGameplayEventEntry removeBuffOnGameplayEventEntry)
					{
						//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)
						removeBuffOnGameplayEventEntry.Buff = PrefabIdentifier.Empty;
					});
				}
			}
			if (!ConfigService.PrimalArsenal)
			{
				return;
			}
			Entity entity7 = default(Entity);
			if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_Weapon_Axe_T09_ShadowMatter, ref entity7))
			{
				entity7.With<EquippableData>((VExtensions.WithRefHandler<EquippableData>)delegate(ref EquippableData equippableData)
				{
					//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)
					equippableData.BuffGuid = PrefabGUIDs.EquipBuff_Weapon_DualHammers_Ability03;
				});
			}
			try
			{
				ShadowMatter.GatherShadows();
			}
			catch (Exception ex)
			{
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(0, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex);
				}
				log.LogWarning(val4);
			}
		}

		private static void ApplyNightmareMode()
		{
			NightmareModeRoutine().Run();
		}

		private static IEnumerator NightmareModeRoutine()
		{
			yield return EntityQueries.QueryResultStreamAsync(_nightmareUnitQueryDesc, delegate(EntityQueries.QueryResultStream stream)
			{
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Expected O, but got Unknown
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					using (stream)
					{
						foreach (EntityQueries.QueryResult result in stream.GetResults())
						{
							PrefabGUID prefabGuid = result.ResolveComponentData<PrefabGUID>();
							string prefabName = prefabGuid.GetPrefabName();
							if (!ShouldSkipNightmareTarget(prefabGuid, prefabName))
							{
								ApplyNightmareStats(result.Entity);
							}
						}
					}
				}
				catch (Exception ex)
				{
					ManualLogSource log = Log;
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[NightmareMode] error: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
					}
					log.LogWarning(val);
				}
			});
		}

		private static bool ShouldSkipNightmareTarget(PrefabGUID prefabGuid, string prefabName)
		{
			if (!((PrefabGUID)(ref prefabGuid)).HasValue())
			{
				return true;
			}
			if (QuestService.FilteredTargetUnits.Any((string filter) => prefabName.Contains(filter, StringComparison.CurrentCultureIgnoreCase)))
			{
				return true;
			}
			if (prefabName.Contains("Servant", StringComparison.CurrentCultureIgnoreCase))
			{
				return true;
			}
			if (prefabName.Contains("Player", StringComparison.CurrentCultureIgnoreCase))
			{
				return true;
			}
			return false;
		}

		private static void ApplyNightmareStats(Entity entity)
		{
			//IL_0000: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			entity.With<Health>((VExtensions.WithRefHandler<Health>)delegate(ref Health health)
			{
				health.MaxHealth._Value *= 5f;
				health.Value = health.MaxHealth._Value;
			});
			entity.With<UnitStats>((VExtensions.WithRefHandler<UnitStats>)delegate(ref UnitStats unitStats)
			{
				unitStats.PhysicalPower._Value *= 1.5f;
				unitStats.SpellPower._Value *= 1.5f;
			});
			entity.With<AiMoveSpeeds>((VExtensions.WithRefHandler<AiMoveSpeeds>)delegate(ref AiMoveSpeeds aiMoveSpeeds)
			{
				aiMoveSpeeds.Walk._Value *= 1.25f;
				aiMoveSpeeds.Run._Value *= 1.25f;
			});
		}

		private static void ResetShardBearers()
		{
			//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_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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			ComponentType[] all = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.ReadOnly(Il2CppType.Of<PrefabGUID>()),
				ComponentType.ReadOnly(Il2CppType.Of<VBloodConsumeSource>()),
				ComponentType.ReadOnly(Il2CppType.Of<VBloodUnit>())
			};
			using NativeAccessor<Entity> nativeAccessor = EntityManager.BuildEntityQuery(all, (EntityQueryOptions)2).ToEntityArrayAccessor((Allocator)2);
			try
			{
				Enumerator<Entity> enumerator = nativeAccessor.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (current.TryGetComponent<PrefabGUID>(out PrefabGUID componentData) && _shardBearers.Contains(componentData))
					{
						current.Destroy();
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResetShardBearers] error: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogWarning(val);
			}
		}

		private static IEnumerator BleedingEdgePrimaryProjectileRoutine(EntityQueries.QueryDesc projectileQueryDesc)
		{
			bool pistols = BleedingEdge.Contains(WeaponType.Pistols);
			bool crossbow = BleedingEdge.Contains(WeaponType.Crossbow);
			yield return EntityQueries.QueryResultStreamAsync(projectileQueryDesc, delegate(EntityQueries.QueryResultStream stream)
			{
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Expected O, but got Unknown
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					using (stream)
					{
						foreach (EntityQueries.QueryResult result in stream.GetResults())
						{
							Entity entity = result.Entity;
							string prefabName = result.ResolveComponentData<PrefabGUID>().GetPrefabName();
							if (pistols && IsWeaponPrimaryProjectile(prefabName, WeaponType.Pistols))
							{
								entity.With<Projectile>((VExtensions.WithRefHandler<Projectile>)delegate(ref Projectile projectile)
								{
									projectile.Range *= 1.25f;
								});
								entity.With<LifeTime>((VExtensions.WithRefHandler<LifeTime>)delegate(ref LifeTime lifeTime)
								{
									lifeTime.Duration *= 1.25f;
								});
							}
							else if (crossbow && IsWeaponPrimaryProjectile(prefabName, WeaponType.Crossbow))
							{
								entity.With<Projectile>((VExtensions.WithRefHandler<Projectile>)delegate(ref Projectile projectile)
								{
									projectile.Speed = 100f;
								});
							}
						}
					}
				}
				catch (Exception ex)
				{
					ManualLogSource log = Log;
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BleedingEdgePrimaryProjectileRoutine] - ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
					}
					log.LogWarning(val);
				}
			});
		}

		private static bool IsWeaponPrimaryProjectile(string prefabName, WeaponType weaponType)
		{
			return prefabName.ContainsAll(new List<string>(3)
			{
				weaponType.ToString(),
				"Primary",
				"Projectile"
			});
		}

		public static void DumpEntity(this Entity entity, World world)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0007: 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_001f: Expected O, but got Unknown
			StringBuilder val = new StringBuilder();
			bool flag = default(bool);
			try
			{
				EntityDebuggingUtility.DumpEntity(world, entity, true, val);
				ManualLogSource log = Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Entity Dump:\n");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)val).ToString());
				}
				log.LogInfo(val2);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Log;
				BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error dumping entity: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val3);
			}
		}
	}
	public struct NativeAccessor<T> : IDisposable where T : unmanaged
	{
		private NativeArray<T> _array;

		public T this[int index]
		{
			get
			{
				return _array[index];
			}
			set
			{
				_array[index] = value;
			}
		}

		public int Length => _array.Length;

		public NativeAccessor(NativeArray<T> array)
		{
			//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)
			_array = array;
		}

		public Enumerator<T> GetEnumerator()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return _array.GetEnumerator();
		}

		public void Dispose()
		{
			_array.Dispose();
		}
	}
	internal static class GenerateREADME
	{
		private static readonly Regex _commandGroupRegex = new Regex("\\[CommandGroup\\((?<args>.*?)\\)\\]", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);

		private static readonly Regex _commandAttributeRegex = new Regex("\\[Command\\((?<args>.*?)\\)\\]", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);

		private static readonly Regex _argPairRegex = new Regex("\\b(?<key>\\w+)\\s*:\\s*(?<value>\\\"[^\\\"]*\\\"|[^,\\)\\r\\n]+)", RegexOptions.IgnoreCase | RegexOptions.Compiled);

		private const string COMMANDS_HEADER = "## Chat Commands";

		private const string CONFIG_HEADER = "## Configuration";

		private static readonly Dictionary<(string groupName, string groupShort), List<(string name, string shortHand, bool adminOnly, string usage, string description)>> _commandsByGroup = new Dictionary<(string, string), List<(string, string, bool, string, string)>>();

		private static string CommandsPath { get; set; }

		private static string ReadMePath { get; set; }

		public static void Main(string[] args)
		{
			if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true")
			{
				Console.WriteLine("GenerateREADME skipped during GitHub Actions build.");
				return;
			}
			if (args.Length < 2)
			{
				Console.WriteLine("Usage: GenerateREADME <CommandsPath> <ReadMePath>");
				return;
			}
			CommandsPath = args[0];
			ReadMePath = args[1];
			try
			{
				Generate();
				Console.WriteLine("README generated successfully.");
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error generating README: " + ex.Message);
			}
		}

		private static void Generate()
		{
			CollectCommands();
			string commandsSection = BuildCommandsSection();
			string configSection = BuildConfigSection();
			UpdateReadme(commandsSection, configSection);
		}

		private static void CollectCommands()
		{
			foreach (string item in from file in Directory.GetFiles(CommandsPath, "*.cs")
				where !Path.GetFileName(file).Equals("DevCommands.cs", StringComparison.CurrentCultureIgnoreCase)
				select file)
			{
				string input = File.ReadAllText(item);
				Match match = _commandGroupRegex.Match(input);
				string args = (match.Success ? match.Groups["args"].Value : string.Empty);
				string text = GetStringArg(args, "name");
				string stringArg = GetStringArg(args, "short");
				if (string.IsNullOrEmpty(stringArg))
				{
					stringArg = GetStringArg(args, "shortHand");
				}
				if (string.IsNullOrEmpty(text))
				{
					text = "misc";
				}
				if (!_commandsByGroup.TryGetValue((text, stringArg), out List<(string, string, bool, string, string)> value))
				{
					value = new List<(string, string, bool, string, string)>();
					_commandsByGroup[(text, stringArg)] = value;
				}
				foreach (Match item2 in _commandAttributeRegex.Matches(input))
				{
					string value2 = item2.Groups["args"].Value;
					string stringArg2 = GetStringArg(value2, "name");
					string stringArg3 = GetStringArg(value2, "shortHand");
					bool boolArg = GetBoolArg(value2, "adminOnly");
					string stringArg4 = GetStringArg(value2, "usage");
					string stringArg5 = GetStringArg(value2, "description");
					value.Add((stringArg2, stringArg3, boolArg, stringArg4, stringArg5));
				}
			}
			foreach (var item3 in _commandsByGroup.Keys.ToList())
			{
				Dictionary<(string groupName, string groupShort), List<(string name, string shortHand, bool adminOnly, string usage, string description)>> commandsByGroup = _commandsByGroup;
				List<(string, string, bool, string, string)> list = new List<(string, string, bool, string, string)>();
				list.AddRange(_commandsByGroup[item3].OrderBy<(string, string, bool, string, string), string>(((string name, string shortHand, bool adminOnly, string usage, string description) c) => c.name, StringComparer.CurrentCultureIgnoreCase));
				commandsByGroup[item3] = list;
			}
		}

		private static string BuildCommandsSection()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("## Chat Commands").AppendLine();
			foreach (var item8 in _commandsByGroup.Keys.OrderBy(((string groupName, string groupShort) g) => g.groupName))
			{
				string item = item8.groupName;
				string item2 = item8.groupShort;
				StringBuilder stringBuilder2 = stringBuilder;
				StringBuilder stringBuilder3 = stringBuilder2;
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(13, 1, stringBuilder2);
				handler.AppendLiteral("### ");
				handler.AppendFormatted(Capitalize(item));
				handler.AppendLiteral(" Commands");
				stringBuilder3.AppendLine(ref handler);
				foreach (var item9 in _commandsByGroup[(item, item2)])
				{
					string item3 = item9.name;
					string item4 = item9.shortHand;
					bool item5 = item9.adminOnly;
					string item6 = item9.usage;
					string item7 = item9.description;
					bool flag = !string.IsNullOrEmpty(item4);
					string text = (string.IsNullOrEmpty(item6) ? ("." + (string.IsNullOrEmpty(item2) ? item : item2) + " " + (flag ? item4 : item3)) : item6);
					string text2 = string.Empty;
					string[] array = text.Split(' ', 3, StringSplitOptions.RemoveEmptyEntries);
					if (array.Length >= 3)
					{
						text2 = array[2];
					}
					else if (array.Length == 2 && array[1].StartsWith("["))
					{
						text2 = array[1];
					}
					string value = (item5 ? " \ud83d\udd12" : string.Empty);
					string value2 = ((text2.Length > 0) ? $"- `.{item} {item3} {text2}`{value}" : $"- `.{item} {item3}`{value}");
					stringBuilder.AppendLine(value2);
					if (!string.IsNullOrEmpty(item7))
					{
						stringBuilder2 = stringBuilder;
						StringBuilder stringBuilder4 = stringBuilder2;
						handler = new StringBuilder.AppendInterpolatedStringHandler(4, 1, stringBuilder2);
						handler.AppendLiteral("  - ");
						handler.AppendFormatted(item7);
						stringBuilder4.AppendLine(ref handler);
					}
					stringBuilder2 = stringBuilder;
					StringBuilder stringBuilder5 = stringBuilder2;
					handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder2);
					handler.AppendLiteral("  - Shortcut: *");
					handler.AppendFormatted(text);
					handler.AppendLiteral("*");
					stringBuilder5.AppendLine(ref handler);
				}
				stringBuilder.AppendLine();
			}
			return stringBuilder.ToString();
		}

		private static string BuildConfigSection()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("## Configuration");
			stringBuilder.AppendLine();
			List<IGrouping<string, ConfigService.ConfigInitialization.ConfigEntryDefinition>> list = (from entry in ConfigService.ConfigInitialization.ConfigEntries
				group entry by entry.Section into @group
				orderby ConfigService.ConfigInitialization.SectionOrder.IndexOf(@group.Key)
				select @group).ToList();
			foreach (IGrouping<string, ConfigService.ConfigInitialization.ConfigEntryDefinition> item in list)
			{
				StringBuilder stringBuilder2 = stringBuilder;
				StringBuilder stringBuilder3 = stringBuilder2;
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 1, stringBuilder2);
				handler.AppendLiteral("### ");
				handler.AppendFormatted(item.Key);
				stringBuilder3.AppendLine(ref handler);
				foreach (ConfigService.ConfigInitialization.ConfigEntryDefinition item2 in item)
				{
					string value = ((item2.DefaultValue is string text) ? ("\"" + text + "\"") : item2.DefaultValue.ToString());
					string text2 = item2.DefaultValue.GetType().Name.ToLower();
					switch (text2)
					{
					case "boolean":
						text2 = "bool";
						break;
					case "single":
						text2 = "float";
						break;
					case "int32":
						text2 = "int";
						break;
					}
					stringBuilder2 = stringBuilder;
					StringBuilder stringBuilder4 = stringBuilder2;
					handler = new StringBuilder.AppendInterpolatedStringHandler(24, 4, stringBuilder2);
					handler.AppendLiteral("- **");
					handler.AppendFormatted(AddSpacesToCamelCase(item2.Key));
					handler.AppendLiteral("**: `");
					handler.AppendFormatted(item2.Key);
					handler.AppendLiteral("` (");
					handler.AppendFormatted(text2);
					handler.AppendLiteral(", default: ");
					handler.AppendFormatted(value);
					handler.AppendLiteral(")");
					stringBuilder4.AppendLine(ref handler);
					if (!string.IsNullOrEmpty(item2.Description))
					{
						stringBuilder2 = stringBuilder;
						StringBuilder stringBuilder5 = stringBuilder2;
						handler = new StringBuilder.AppendInterpolatedStringHandler(2, 1, stringBuilder2);
						handler.AppendLiteral("  ");
						handler.AppendFormatted(item2.Description);
						stringBuilder5.AppendLine(ref handler);
					}
				}
				if (list.IndexOf(item) < list.Count - 1)
				{
					stringBuilder.AppendLine();
				}
			}
			return stringBuilder.ToString();
		}

		private static string AddSpacesToCamelCase(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return input;
			}
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < input.Length; i++)
			{
				char c = input[i];
				bool flag = char.IsUpper(c);
				bool num = i > 0;
				bool flag2 = num && char.IsLower(input[i - 1]);
				bool flag3 = i < input.Length - 1 && char.IsLower(input[i + 1]);
				if (num && flag && (flag2 || flag3))
				{
					stringBuilder.Append(' ');
				}
				stringBuilder.Append(c);
			}
			return stringBuilder.ToString();
		}

		private static void UpdateReadme(string commandsSection, string configSection)
		{
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			bool flag4 = false;
			List<string> list = new List<string>();
			try
			{
				foreach (string item in File.ReadLines(ReadMePath))
				{
					if (item.Trim().Equals("## Chat Commands", StringComparison.CurrentCultureIgnoreCase))
					{
						flag = true;
						flag3 = true;
						list.Add(commandsSection);
						continue;
					}
					if (item.Trim().Equals("## Configuration", StringComparison.CurrentCultureIgnoreCase))
					{
						flag2 = true;
						flag4 = true;
						list.Add(configSection);
						continue;
					}
					if (flag && item.Trim().StartsWith("## ", StringComparison.CurrentCultureIgnoreCase) && !item.Trim().Equals("## Chat Commands", StringComparison.CurrentCultureIgnoreCase))
					{
						flag = false;
					}
					if (flag2 && item.Trim().StartsWith("## ", StringComparison.CurrentCultureIgnoreCase) && !item.Trim().Equals("## Configuration", StringComparison.CurrentCultureIgnoreCase))
					{
						flag2 = false;
					}
					if (!flag && !flag2)
					{
						list.Add(item);
					}
				}
				if (flag2)
				{
					list.Add(configSection);
					flag2 = false;
				}
				if (!flag3)
				{
					list.Add("## Chat Commands");
					list.Add(commandsSection);
				}
				if (!flag4)
				{
					list.Add("## Configuration");
					list.Add(configSection);
				}
				File.WriteAllLines(ReadMePath, list);
			}
			catch (Exception ex)
			{
				Console.Error.WriteLine("Error updating the readme: " + ex.Message);
				throw;
			}
		}

		private static string GetStringArg(string args, string key)
		{
			foreach (Match item in _argPairRegex.Matches(args))
			{
				if (!item.Groups["key"].Value.Equals(key, StringComparison.CurrentCultureIgnoreCase))
				{
					continue;
				}
				string text = item.Groups["value"].Value.Trim();
				string result;
				if (text.Length > 1 && text[0] == '"')
				{
					if (text[text.Length - 1] == '"')
					{
						string text2 = text;
						result = text2.Substring(1, text2.Length - 1 - 1);
						goto IL_0097;
					}
				}
				result = text;
				goto IL_0097;
				IL_0097:
				return result;
			}
			return string.Empty;
		}

		private static bool GetBoolArg(string args, string key)
		{
			foreach (Match item in _argPairRegex.Matches(args))
			{
				bool result;
				if (string.Equals(item.Groups["key"].Value, key, StringComparison.CurrentCultureIgnoreCase))
				{
					return bool.TryParse(item.Groups["value"].Value, out result) && result;
				}
			}
			return false;
		}

		private static string Capitalize(string input)
		{
			if (!string.IsNullOrEmpty(input))
			{
				return char.ToUpper(input[0]) + input.Substring(1, input.Length - 1);
			}
			return input;
		}
	}
	internal static class IExtensions
	{
		public static Dictionary<TValue, TKey> Reverse<TKey, TValue>(this IDictionary<TKey, TValue> source)
		{
			Dictionary<TValue, TKey> dictionary = new Dictionary<TValue, TKey>();
			foreach (KeyValuePair<TKey, TValue> item in source)
			{
				dictionary[item.Value] = item.Key;
			}
			return dictionary;
		}

		public static Dictionary<TValue, TKey> ReverseIl2CppDictionary<TKey, TValue>(this Dictionary<TKey, TValue> source)
		{
			Dictionary<TValue, TKey> dictionary = new Dictionary<TValue, TKey>();
			if (source == null)
			{
				return dictionary;
			}
			Enumerator<TKey, TValue> enumerator = source.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<TKey, TValue> current = enumerator.Current;
				if (!dictionary.ContainsKey(current.Value))
				{
					dictionary[current.Value] = current.Key;
				}
			}
			return dictionary;
		}

		public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
		{
			foreach (T item in collection)
			{
				action(item);
			}
		}

		public static bool IsIndexWithinRange<T>(this IList<T> list, int index)
		{
			if (index >= 0)
			{
				return index < list.Count;
			}
			return false;
		}

		public static bool ContainsAll(this string stringChars, List<string> strings)
		{
			foreach (string @string in strings)
			{
				if (!stringChars.Contains(@string, StringComparison.CurrentCultureIgnoreCase))
				{
					return false;
				}
			}
			return true;
		}

		public static T DrawRandom<T>(this IList<T> list)
		{
			if (list == null || !list.Any())
			{
				return default(T);
			}
			int index = new Random((int)Misc.GetRandomSeed()).Next(list.Count);
			if (!list.IsIndexWithinRange(index))
			{
				return default(T);
			}
			return list[index];
		}

		public static IEnumerable<IReadOnlyList<T>> Batch<T>(this IReadOnlyList<T> source, int size)
		{
			if (size <= 0)
			{
				throw new ArgumentOutOfRangeException("size");
			}
			List<T> list = (source as List<T>) ?? throw new ArgumentException("Source must be a List<T>.", "source");
			for (int i = 0; i < list.Count; i += size)
			{
				yield return list.GetRange(i, Math.Min(size, list.Count - i));
			}
		}

		public static bool ContainsAny(this string stringChars, List<string> strings, StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase)
		{
			foreach (string @string in strings)
			{
				if (stringChars.Contains(@string, stringComparison))
				{
					return true;
				}
			}
			return false;
		}

		public static void Shuffle<T>(this IList<T> list)
		{
			Random random = new Random((int)Misc.GetRandomSeed());
			int num = list.Count;
			while (num > 1)
			{
				num--;
				int num2 = random.Next(num + 1);
				int index = num;
				int index2 = num2;
				T value = list[num2];
				T value2 = list[num];
				list[index] = value;
				list[index2] = value2;
			}
		}

		public static bool Equals<T>(this T value, params T[] options) where T : unmanaged
		{
			foreach (T val in options)
			{
				if (value.Equals(val))
				{
					return true;
				}
			}
			return false;
		}

		public static bool Contains<T>(this IEnumerable<T> source, params T[] values)
		{
			foreach (T value in values)
			{
				if (Enumerable.Contains(source, value))
				{
					return true;
				}
			}
			return false;
		}

		public static void Run(this IEnumerator routine, float delay = 0f)
		{
			if (delay > 0f)
			{
				Core.StartCoroutine(Delay(routine, delay));
			}
			else
			{
				Core.StartCoroutine(routine);
			}
		}

		public static IEnumerator Delay(IEnumerator routine, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			routine.Run();
		}

		public static Coroutine Start(this IEnumerator routine)
		{
			return Core.StartCoroutine(routine);
		}

		public static void Stop(this Coroutine coroutine)
		{
			Core.StopCoroutine(coroutine);
		}

		public static bool AsBool(this byte b)
		{
			return b != 0;
		}
	}
	[BepInPlugin("io.zfolmt.Bloodcraft", "Bloodcraft", "1.13.22")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BasePlugin
	{
		internal static class MiniBehaviour
		{
			internal static Plugin Instance { get; set; }

			internal static ManualLogSource LogSource { get; set; }

			internal static void OnLoad()
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Expected O, but got Unknown
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				StartupStateService.Reset();
				if (!IsVRisingServer())
				{
					return;
				}
				Bootstrap.Initialize(BootstrapHarmony, LogSource);
				StartupStateService.Mark(StartupState.BootstrapPatched);
				Harmony harmony = Harmony;
				if (harmony != null)
				{
					harmony.PatchAll();
				}
				StartupStateService.Mark(StartupState.MainHarmonyPatched);
				OnLoadInternal();
				bool flag = default(bool);
				if (StartupStateService.IsReady())
				{
					ManualLogSource logSource = LogSource;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Startup checks passed. ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(StartupStateService.BuildSummary());
					}
					logSource.LogInfo(val);
				}
				else
				{
					ManualLogSource logSource2 = LogSource;
					BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Startup checks failed. ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(StartupStateService.BuildSummary());
					}
					logSource2.LogWarning(val2);
				}
			}

			private static void OnLoadInternal()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				ConfigService.ConfigInitialization.InitializeConfig();
				StartupStateService.Mark(StartupState.ConfigLoaded);
				DataService.PlayerDataInitialization.LoadPlayerData();
				StartupStateService.Mark(StartupState.PlayerDataLoaded);
				CommandRegistry.RegisterAll();
				StartupStateService.Mark(StartupState.CommandsRegistered);
				RconCommandRegistrar.RegisterAll();
				StartupStateService.Mark(StartupState.RconRegistered);
				ManualLogSource logSource = LogSource;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded [");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.13.22");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
				}
				logSource.LogInfo(val);
			}

			internal static bool OnUnload()
			{
				Harmony harmony = Harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
				Harmony bootstrapHarmony = BootstrapHarmony;
				if (bootstrapHarmony != null)
				{
					bootstrapHarmony.UnpatchSelf();
				}
				CommandRegistry.UnregisterAssembly();
				RconCommandRegistrar.UnregisterAssembly();
				StartupStateService.Reset();
				return true;
			}
		}

		internal static Harmony Harmony { get; set; }

		internal static Harmony BootstrapHarmony { get; set; }

		private static bool IsVRisingServer()
		{
			return Application.productName == "VRisingServer";
		}

		public override void Load()
		{
			MiniBehaviour.OnLoad();
		}

		public override bool Unload()
		{
			return MiniBehaviour.OnUnload();
		}

		public Plugin()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Harmony = new Harmony("io.zfolmt.Bloodcraft");
			BootstrapHarmony = new Harmony("io.zfolmt.Bloodcraft.bootstrap");
			MiniBehaviour.Instance = this;
			MiniBehaviour.LogSource = ((BasePlugin)this).Log;
		}
	}
	internal static class VExtensions
	{
		public delegate void WithRefHandler<T>(ref T item);

		private const string EMPTY_KEY = "LocalizationKey.Empty";

		private const string ENTITY_PREFIX = "Entity(";

		private const string CHAR = "CHAR_";

		private const int LENGTH = 7;

		private static EntityManager EntityManager => Core.EntityManager;

		private static ServerGameManager ServerGameManager => Core.ServerGameManager;

		private static SystemService SystemService => Core.SystemService;

		private static DebugEventsSystem DebugEventsSystem => SystemService.DebugEventsSystem;

		public static void With<T>(this Entity entity, WithRefHandler<T> action) where T : struct
		{
			//IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<T>())
			{
				T item = entity.Read<T>();
				action(ref item);
				EntityManager entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
			}
		}

		public static void WithEdit<T>(this Entity entity, int index, WithRefHandler<T> action) where T : struct
		{
			//IL_0000: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			bool flag = default(bool);
			if (!entity.TryGetBuffer<T>(out var dynamicBuffer))
			{
				ManualLogSource log = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Entity is missing DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log.LogWarning(val);
			}
			else if (!dynamicBuffer.IsIndexWithinRange<T>(index))
			{
				ManualLogSource log2 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Index (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") OoR (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(dynamicBuffer.Length);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") for DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log2.LogWarning(val);
			}
			else
			{
				T item = dynamicBuffer[index];
				action(ref item);
				dynamicBuffer[index] = item;
			}
		}

		public static void WithInsert<T>(this Entity entity, int index, T element) where T : struct
		{
			//IL_0000: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			bool flag = default(bool);
			if (!entity.TryGetBuffer<T>(out var dynamicBuffer))
			{
				ManualLogSource log = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Entity is missing DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log.LogWarning(val);
			}
			else if (!dynamicBuffer.IsIndexWithinRange<T>(index))
			{
				ManualLogSource log2 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Index (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") OoR (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(index);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(dynamicBuffer.Length);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") for DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log2.LogWarning(val);
			}
			else
			{
				dynamicBuffer.Insert(index, element);
			}
		}

		public static void WithAdd<T>(this Entity entity, T element) where T : struct
		{
			//IL_0000: 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_001a: Expected O, but got Unknown
			if (!entity.TryGetBuffer<T>(out var dynamicBuffer))
			{
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Entity is missing DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log.LogWarning(val);
			}
			else
			{
				dynamicBuffer.Add(element);
			}
		}

		public static void WithClear<T>(this Entity entity) where T : struct
		{
			//IL_0000: 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_001a: Expected O, but got Unknown
			if (!entity.TryGetBuffer<T>(out var dynamicBuffer))
			{
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Entity is missing DynamicBuffer<");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(typeof(T));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">!");
				}
				log.LogWarning(val);
			}
			else
			{
				dynamicBuffer.Clear();
			}
		}

		public static void AddWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct
		{
			//IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!entity.Has<T>())
			{
				entity.Add<T>();
			}
			entity.With(action);
		}

		public static void Write<T>(this Entity entity, T componentData) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<T>())
			{
				EntityManager entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentData<T>(entity, componentData);
			}
		}

		public static T Read<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			T result = default(T);
			if (!((EntityManager)(ref entityManager)).TryGetComponentData<T>(entity, ref result))
			{
				return default(T);
			}
			return result;
		}

		public static bool TryLookup<T>(this Entity entity, ref ComponentLookup<T> componentLookup, out T component)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return componentLookup.TryGetComponent(entity, ref component);
		}

		public static T Lookup<T>(this Entity entity, ref ComponentLookup<T> componentLookup)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			T result = default(T);
			if (!componentLookup.TryGetComponent(entity, ref result))
			{
				return default(T);
			}
			return result;
		}

		public static bool Has<T>(this Entity entity, ref ComponentLookup<T> componentLookup)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return componentLookup.HasComponent(entity);
		}

		public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
		{
			//IL_0000: 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_0014: 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)
			if (entity.TryGetBuffer<T>(out var dynamicBuffer))
			{
				return dynamicBuffer;
			}
			return default(DynamicBuffer<T>);
		}

		public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity);
		}

		public static bool TryGetComponent<T>(this Entity entity, out T componentData) where T : struct
		{
			//IL_0007: 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)
			componentData = default(T);
			if (entity.Has<T>())
			{
				componentData = entity.Read<T>();
				return true;
			}
			return false;
		}

		public static bool IsCharacter(this PrefabGUID prefabGuid)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return prefabGuid.GetPrefabName().StartsWith("CHAR_");
		}

		public static string GetPrefabName(this PrefabGUID prefabGuid, bool verbose = false)
		{
			//IL_0005: 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)
			if (LocalizationService.PrefabGuidNames.TryGetValue(prefabGuid, out var value))
			{
				if (!verbose)
				{
					return $"{value} {prefabGuid}";
				}
				return value;
			}
			return "LocalizationKey.Empty";
		}

		public static string GetSequenceName(this SequenceGUID sequenceGuid)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (!LocalizationService.SequenceGuidNames.TryGetValue(sequenceGuid, out var value))
			{
				return string.Empty;
			}
			return value;
		}

		public static string GetLocalizedName(this PrefabGUID prefabGuid)
		{
			//IL_0000: 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)
			string value = LocalizationService.GetNameFromPrefabGuid(prefabGuid);
			if (!string.IsNullOrEmpty(value))
			{
				return value;
			}
			if (LocalizationService.PrefabGuidNames.TryGetValue(prefabGuid, out value))
			{
				return value;
			}
			return "LocalizationKey.Empty";
		}

		public static void Add<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if (!entity.Has<T>())
			{
				EntityManager entityManager = EntityManager;
				((EntityManager)(ref entityManager)).AddComponent<T>(entity);
			}
		}

		public static bool Has<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			return ((EntityManager)(ref entityManager)).HasComponent<T>(entity);
		}

		public static void Remove<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<T>())
			{
				EntityManager entityManager = EntityManager;
				((EntityManager)(ref entityManager)).RemoveComponent<T>(entity);
			}
		}

		public static bool TryGetFollowedPlayer(this Entity entity, out Entity player)
		{
			//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_000b: 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_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)
			player = Entity.Null;
			if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.TryGetPlayer(out player))
			{
				return true;
			}
			return false;
		}

		public static bool TryGetPlayer(this Entity entity, out Entity player)
		{
			//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_000b: 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)
			player = Entity.Null;
			if (entity.Has<PlayerCharacter>())
			{
				player = entity;
				return true;
			}
			return false;
		}

		public static bool IsPlayer(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<PlayerCharacter>();
		}

		public static bool IsFamiliar(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<BlockFeedBuff>();
		}

		public static bool IsFollowingPlayer(this Entity entity)
		{
			//IL_0000: 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_0008: 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_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_0010: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<BlockFeedBuff>() && !entity.Has<Buff>() && !entity.Has<ServantEquipment>())
			{
				return true;
			}
			if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.IsPlayer())
			{
				return true;
			}
			return false;
		}

		public static bool TryGetAttached(this Entity entity, out Entity attached)
		{
			//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_000b: 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_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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			attached = Entity.Null;
			if (entity.TryGetComponent<Attach>(out Attach componentData) && componentData.Parent.Exists())
			{
				attached = componentData.Parent;
				return true;
			}
			return false;
		}

		public static Entity GetBuffTarget(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity);
		}

		public static Entity GetPrefabEntity(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!entity.Exists())
			{
				return Entity.Null;
			}
			ServerGameManager serverGameManager = ServerGameManager;
			return ((ServerGameManager)(ref serverGameManager)).GetPrefabEntity(entity.GetPrefabGuid());
		}

		public static Entity GetPrefabEntity(this PrefabGUID prefabGuid)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (!((PrefabGUID)(ref prefabGuid)).HasValue())
			{
				return Entity.Null;
			}
			ServerGameManager serverGameManager = ServerGameManager;
			return ((ServerGameManager)(ref serverGameManager)).GetPrefabEntity(prefabGuid);
		}

		public static Entity GetSpellTarget(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity);
		}

		public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity)
		{
			//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_000b: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			teamEntity = Entity.Null;
			if (entity.TryGetComponent<TeamReference>(out TeamReference componentData))
			{
				Entity value = componentData.Value._Value;
				if (value.Exists())
				{
					teamEntity = value;
					return true;
				}
			}
			return false;
		}

		public static bool Exists(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (entity.HasValue() && entity.IndexWithinCapacity())
			{
				EntityManager entityManager = EntityManager;
				return ((EntityManager)(ref entityManager)).Exists(entity);
			}
			return false;
		}

		public static void ResolveLookup<T>(this ref ComponentLookup<T> componentLookup, SystemBase systemBase, bool isReadOnly = false) where T : struct
		{
			//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)
			if (IsEmpty(ref componentLookup))
			{
				componentLookup = systemBase.GetComponentLookup<T>(isReadOnly);
			}
			componentLookup.Update(systemBase);
		}

		public static void ResolveLookup<T>(this ref BufferLookup<T> bufferLookup, SystemBase systemBase, bool isReadOnly = false) where T : struct
		{
			//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)
			if (IsEmpty(ref bufferLookup))
			{
				bufferLookup = systemBase.GetBufferLookup<T>(isReadOnly);
			}
			bufferLookup.Update(systemBase);
		}

		public static void ResolveHandle<T>(this ref ComponentTypeHandle<T> componentTypeHandle, SystemBase systemBase, bool isReadOnly = false) where T : struct
		{
			//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)
			if (componentTypeHandle.IsZeroSized)
			{
				componentTypeHandle = ((ComponentSystemBase)systemBase).GetComponentTypeHandle<T>(isReadOnly);
			}
			componentTypeHandle.Update(systemBase);
		}

		public static void ResolveHandle<T>(this ref BufferTypeHandle<T> bufferTypeHandle, SystemBase systemBase, bool isReadOnly = false) where T : struct
		{
			//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)
			if (IsEmpty(ref bufferTypeHandle))
			{
				bufferTypeHandle = ((ComponentSystemBase)systemBase).GetBufferTypeHandle<T>(isReadOnly);
			}
			bufferTypeHandle.Update(systemBase);
		}

		public static bool IsEmpty<T>(this ref ComponentLookup<T> componentLookup) where T : struct
		{
			return componentLookup.m_IsZeroSized.AsBool();
		}

		public static bool IsEmpty<T>(this ref BufferLookup<T> bufferLookup) where T : struct
		{
			return bufferLookup.m_InternalCapacity == 0;
		}

		public static bool IsEmpty<T>(this ref BufferTypeHandle<T> bufferTypeHandle) where T : struct
		{
			return bufferTypeHandle.m_Length == 0;
		}

		public static bool HasValue(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return entity != Entity.Null;
		}

		public static bool IndexWithinCapacity(this Entity entity)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			ReadOnlySpan<char> span = ((object)(Entity)(ref entity)).ToString().AsSpan();
			if (!span.StartsWith("Entity("))
			{
				return false;
			}
			ref ReadOnlySpan<char> reference = ref span;
			span = reference.Slice(7, reference.Length - 7);
			int num = span.IndexOf(':');
			if (num <= 0)
			{
				return false;
			}
			reference = ref span;
			int result = num + 1;
			ReadOnlySpan<char> span2 = reference.Slice(result, reference.Length - result);
			int num2 = span2.IndexOf(')');
			if (num2 <= 0)
			{
				return false;
			}
			if (!int.TryParse(span.Slice(0, num), out var result2))
			{
				return false;
			}
			if (!int.TryParse(span2.Slice(0, num2), out result))
			{
				return false;
			}
			EntityManager entityManager = EntityManager;
			int entityCapacity = ((EntityManager)(ref entityManager)).EntityCapacity;
			return (uint)result2 < (uint)entityCapacity;
		}

		public static bool IsDisabled(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<Disabled>();
		}

		public static void Enable(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (entity.IsDisabled())
			{
				entity.Remove<Disabled>();
			}
		}

		public static void Disable(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!entity.IsDisabled())
			{
				entity.Add<Disabled>();
			}
		}

		public static bool IsVBlood(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<VBloodConsumeSource>();
		}

		public static bool IsDuelChallenger(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<VBloodDuelChallenger>();
		}

		public static bool IsGateBoss(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<VBloodUnit>())
			{
				return !entity.Has<VBloodConsumeSource>();
			}
			return false;
		}

		public static bool IsVBloodOrGateBoss(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<VBloodUnit>();
		}

		public static bool IsLegendary(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<LegendaryItemInstance>();
		}

		public static bool HasSpellLevel(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<SpellLevel>();
		}

		public static bool IsMounter(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<UnitMounter>();
		}

		public static bool IsAncestralWeapon(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<LegendaryItemInstance>())
			{
				return !entity.IsMagicSource();
			}
			return false;
		}

		public static bool IsShardNecklace(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (entity.Has<LegendaryItemInstance>())
			{
				return entity.IsMagicSource();
			}
			return false;
		}

		public static bool IsMagicSource(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (entity.TryGetComponent<EquippableData>(out EquippableData componentData))
			{
				return ((object)(EquipmentType)(ref componentData.EquipmentType)).Equals((object)(EquipmentType)3);
			}
			return false;
		}

		public static ulong GetSteamId(this Entity entity)
		{
			//IL_0000: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData))
			{
				return componentData.UserEntity.GetUser().PlatformId;
			}
			if (entity.TryGetComponent<User>(out User componentData2))
			{
				return componentData2.PlatformId;
			}
			return 0uL;
		}

		public static NetworkId GetNetworkId(this Entity entity)
		{
			//IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			if (entity.TryGetComponent<NetworkId>(out NetworkId componentData))
			{
				return componentData;
			}
			return NetworkId.Empty;
		}

		public static bool TryGetPlayerInfo(this ulong steamId, out PlayerService.PlayerInfo playerInfo)
		{
			if (PlayerService.SteamIdPlayerInfoCache.TryGetValue(steamId, out playerInfo))
			{
				return true;
			}
			if (PlayerService.SteamIdOnlinePlayerInfoCache.TryGetValue(steamId, out playerInfo))
			{
				return true;
			}
			return false;
		}

		public static PrefabGUID GetPrefabGuid(this Entity entity)
		{
			//IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
			{
				return componentData;
			}
			return PrefabGUID.Empty;
		}

		public static int GetGuidHash(this Entity entity)
		{
			//IL_0000: 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)
			if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
			{
				return ((PrefabGUID)(ref componentData)).GuidHash;
			}
			PrefabGUID empty = PrefabGUID.Empty;
			return ((PrefabGUID)(ref empty)).GuidHash;
		}

		public static Entity GetUserEntity(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001b: 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)
			if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData))
			{
				return componentData.UserEntity;
			}
			if (entity.IsUser())
			{
				return entity;
			}
			return Entity.Null;
		}

		public static Entity GetOwner(this Entity entity, bool trueOwner = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002b: 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_0013: 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_0035: 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)
			if (!entity.Exists())
			{
				return Entity.Null;
			}
			Entity result = default(Entity);
			if (trueOwner && VampireDownedServerEventSystem.TryFindRootOwner(entity, 1, EntityManager, ref result))
			{
				return result;
			}
			ServerGameManager serverGameManager = ServerGameManager;
			if (!((ServerGameManager)(ref serverGameManager)).TryGetOwner(entity, ref result))
			{
				return Entity.Null;
			}
			return result;
		}

		public static User GetUser(this Entity entity)
		{
			//IL_0000: 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_000a: 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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			if (entity.TryGetComponent<User>(out User componentData))
			{
				return componentData;
			}
			if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData2) && componentData2.UserEntity.TryGetComponent<User>(out componentData))
			{
				return componentData;
			}
			return User.Empty;
		}

		public static bool IsUser(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return entity.Has<User>();
		}

		public static bool HasBuff(this Entity entity, PrefabGUID buffPrefabGuid)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			ServerGameManager serverGameManager = ServerGameManager;
			return ((ServerGameManager)(ref serverGameManager)).HasBuff(entity, ((PrefabGUID)(ref buffPrefabGuid)).ToIdentifier());
		}

		public static bool HasBuff<T>(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return BuffUtility.HasBuff<T>(EntityManager, entity);
		}

		public static bool TryGetBuffer<T>(this Entity entity, out DynamicBuffer<T> dynamicBuffer) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			ServerGameManager serverGameManager = ServerGameManager;
			if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer<T>(entity, ref dynamicBuffer))
			{
				return true;
			}
			dynamicBuffer = default(DynamicBuffer<T>);
			return false;
		}

		public static float3 GetAimPosition(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (entity.TryGetComponent<EntityInput>(out EntityInput componentData))
			{
				return componentData.AimPosition;
			}
			return float3.zero;
		}

		public static float3 GetPosition(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (entity.TryGetComponent<Translation>(out Translation componentData))
			{
				return componentData.Value;
			}
			return float3.zero;
		}

		public static int2 GetTileCoord(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (entity.TryGetComponent<TilePosition>(out TilePosition componentData))
			{
				return componentData.Tile;
			}
			return int2.zero;
		}

		public static int GetUnitLevel(this Entity entity)
		{
			//IL_0000: 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)
			if (entity.TryGetComponent<UnitLevel>(out UnitLevel componentData))
			{
				return componentData.Level._Value;
			}
			return 0;
		}

		public static float GetMaxDurability(this Entity entity)
		{
			//IL_0000: 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)
			if (entity.TryGetComponent<Durability>(out Durability componentData))
			{
				return componentData.MaxDurability;
			}
			return 0f;
		}

		public static float GetDurability(this Entity entity)
		{
			//IL_0000: 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)
			if (entity.TryGetComponent<Durability>(out Durability componentData))
			{
				return componentData.Value;
			}
			return 0f;
		}

		public static float GetMaxHealth(this Entity entity)
		{
			//IL_0000: 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)
			if (entity.TryGetComponent<Health>(out Health componentData))
			{
				return componentData.MaxHealth._Value;
			}
			return 0f;
		}

		public static Blood GetBlood(this Entity entity)
		{
			//IL_0000: 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_0014: 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)
			if (entity.TryGetComponent<Blood>(out Blood componentData))
			{
				return componentData;
			}
			return default(Blood);
		}

		public static AiMoveSpeeds GetMoveSpeeds(this Entity entity)
		{
			//IL_0000: 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_0014: 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)
			if (entity.TryGetComponent<AiMoveSpeeds>(out AiMoveSpeeds componentData))
			{
				return componentData;
			}
			return default(AiMoveSpeeds);
		}

		public static EntityInput GetInput(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			ServerGameManager serverGameManager = ServerGameManager;
			return ((ServerGameManager)(ref serverGameManager)).GetInput(entity);
		}

		public static PrefabGUID GetEquipBuff(this Entity entity)
		{
			//IL_0000: 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_0019: 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