using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; using System.Threading; using System.Timers; using Animation; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BloodCraftEZLife; using BloodCraftEZLife.Behaviors; using BloodCraftEZLife.Config; using BloodCraftEZLife.Patches; using BloodCraftEZLife.Services; using BloodCraftEZLife.Services.Data; using BloodCraftEZLife.UI; using BloodCraftEZLife.UI.ModContent; using BloodCraftEZLife.UI.ModContent.Controls; using BloodCraftEZLife.UI.ModContent.CustomElements; using BloodCraftEZLife.UI.ModContent.CustomElements.Handlers; using BloodCraftEZLife.UI.ModContent.Data; using BloodCraftEZLife.UI.ModContent.Externsion; using BloodCraftEZLife.UI.ModContent.Input; using BloodCraftEZLife.UI.ModContent.Util; using BloodCraftEZLife.UI.ModernLib; using BloodCraftEZLife.UI.UniverseLib.UI; using BloodCraftEZLife.UI.UniverseLib.UI.Models; using BloodCraftEZLife.UI.UniverseLib.UI.ObjectPool; using BloodCraftEZLife.UI.UniverseLib.UI.Panels; using BloodCraftEZLife.UI.UniverseLib.UI.Widgets; using BloodCraftEZLife.UI.UniverseLib.UI.Widgets.ScrollView; using BloodCraftEZLife.Utils; using Bloody.Core; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Behaviours; using ProjectM.CastleBuilding; using ProjectM.CastleBuilding.AssetSwapping; using ProjectM.CastleBuilding.Placement; using ProjectM.CastleBuilding.Rebuilding; using ProjectM.Contest; using ProjectM.Contest.Arena; using ProjectM.Contest.Duel; using ProjectM.Gameplay; using ProjectM.Gameplay.Clan; using ProjectM.Gameplay.Scripting; using ProjectM.Gameplay.Systems; using ProjectM.Haptics; using ProjectM.Hybrid; using ProjectM.LightningStorm; using ProjectM.Network; using ProjectM.Pathfinding; using ProjectM.Physics; using ProjectM.Portrait; using ProjectM.Roofs; using ProjectM.Scripting; using ProjectM.Sequencer; using ProjectM.Shared; using ProjectM.Shared.WarEvents; using ProjectM.Shared.WorldEvents; using ProjectM.SunBlocker; using ProjectM.Terrain; using ProjectM.Tiles; using ProjectM.Transmog; using ProjectM.UI; using ProjectM.WeaponCoating; using Rukhanka; using Stunlock.Core; using Stunlock.Core.Authoring; using Stunlock.Localization; using Stunlock.Sequencer; using TMPro; using Tests; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Physics; using Unity.Physics.Systems; using Unity.Scenes; using Unity.Transforms; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("TiBen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BloodCraft plugins to help in pve servers")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7133b2fbd43eef166ea38eed8cdf942451b8a445")] [assembly: AssemblyProduct("BloodCraftEZLife.Plugins")] [assembly: AssemblyTitle("BloodCraftEZLife.Plugins")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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; } } } internal class CommandInput : PanelBase { private bool _isInitialized; public GameObject Root; public InputFieldRef Input; public Action _onCommand; private Hotkey _currentHotkey; public override string PanelId => "SettingsList"; public override int MinWidth => 480; public override int MinHeight => 240; public override int MaxWidth => 3840; public override Vector2 DefaultAnchorMin => new Vector2(0.5f, 0.5f); public override Vector2 DefaultAnchorMax => new Vector2(0.5f, 0.5f); public override Vector2 DefaultPivot => new Vector2(0.5f, 0.5f); public override bool CanDrag => false; public override PanelDragger.ResizeTypes CanResize => PanelDragger.ResizeTypes.None; public override PanelType PanelType => PanelType.SettingsPanel; public CommandInput(UIBase owner) : base(owner) { SetTitle("InputBox"); } protected override void ConstructPanelContent() { //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) GameObject val = UIFactory.CreateVerticalGroup(base.ContentRoot, "CommandPanel", forceWidth: true, forceHeight: true, childControlWidth: true, childControlHeight: true); UIFactory.SetLayoutElement(val, minHeight: 100, minWidth: 250); LabelRef labelRef = UIFactory.CreateLabel(val, "CommandTitle", "Enter Command you can make 2 command in one if you separate with |", (TextAlignmentOptions)514); TextMeshProUGUI component = labelRef.GameObject.GetComponent(); ((TMP_Text)component).fontSize = 22f; ((TMP_Text)component).alignment = (TextAlignmentOptions)4098; Input = UIFactory.CreateInputField(val, "CommandInput", ""); GameObject gameObject = Input.GameObject; int? minHeight = 30; int? flexibleWidth = 9999; UIFactory.SetLayoutElement(gameObject, null, minHeight, flexibleWidth); Input.Component.textComponent.fontSize = 22f; ((UnityEvent)(object)Input.Component.onSubmit).AddListener(delegate(string cmd) { Debug.Log(Object.op_Implicit("Command submitted: " + cmd)); _currentHotkey.action = cmd; _onCommand?.Invoke(_currentHotkey); }); } protected override void OnClosePanelClicked() { SetActive(active: false); } protected override void LateConstructUI() { //IL_0013: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) base.LateConstructUI(); float num = base.Owner.Scaler.referenceResolution.x / 1920f; float num2 = base.Owner.Scaler.referenceResolution.y / 1080f; FullscreenSettingService.ResFactor = new Vector2(num, num2); Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(FullscreenSettingService.DeltaRect.x * num * 0.5f, FullscreenSettingService.DeltaRect.y * num2 * 0.5f); base.Rect.sizeDelta = sizeDelta; base.Rect.anchoredPosition = FullscreenSettingService.AnchorRect; EnsureValidSize(); EnsureValidPosition(); } public void Show(Hotkey oldcommand) { _currentHotkey = oldcommand; Input.Text = oldcommand.action; Input.Component.ActivateInputField(); Input.Component.selectionAnchorPosition = Input.Text.Length; Input.Component.selectionFocusPosition = Input.Text.Length; } } namespace Bloody.Core { public static class ECSExtensions { private static EntityManager GetEntityManager() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Plugin.EntityManager; } public unsafe static void Write(this Entity entity, T componentData) where T : struct { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); byte[] array = StructureToByteArray(componentData); int num = Marshal.SizeOf(); fixed (byte* ptr = array) { EntityManager entityManager = GetEntityManager(); ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num); } } public static byte[] StructureToByteArray(T structure) where T : struct { int num = Marshal.SizeOf(structure); byte[] array = new byte[num]; IntPtr intPtr = Marshal.AllocHGlobal(num); Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true); Marshal.Copy(intPtr, array, 0, num); Marshal.FreeHGlobal(intPtr); return array; } public unsafe static T Read(this Entity entity) where T : struct { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); EntityManager entityManager = GetEntityManager(); void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex); return Marshal.PtrToStructure(new IntPtr(componentDataRawRO)); } public static DynamicBuffer ReadBuffer(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_0013: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = GetEntityManager(); return ((EntityManager)(ref entityManager)).GetBuffer(entity, false); } public static string JsonPrefabName(this PrefabGUID prefabGuid) { //IL_0006: 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) string prefabName = Plugin.Localization.GetPrefabName(prefabGuid); return string.IsNullOrEmpty(prefabName) ? prefabGuid.LookupName() : prefabName; } public static string LookupName(this PrefabGUID prefabGuid) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) PrefabCollectionSystem existingSystemManaged = Plugin._client.GetExistingSystemManaged(); NativeParallelHashMap guidToEntityMap = existingSystemManaged._PrefabLookupMap.GuidToEntityMap; object result; if (!guidToEntityMap.ContainsKey(prefabGuid)) { result = "GUID Not Found"; } else { PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap; result = ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid) + " PrefabGuid(" + ((PrefabGUID)(ref prefabGuid)).GuidHash + ")"; } return (string)result; } public static void Add(this Entity entity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); EntityManager entityManager = GetEntityManager(); ((EntityManager)(ref entityManager)).AddComponent(entity, val); } public static void Remove(this Entity entity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); EntityManager entityManager = GetEntityManager(); ((EntityManager)(ref entityManager)).RemoveComponent(entity, val); } public static bool Exists(this Entity entity) { //IL_0001: 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_0012: Unknown result type (might be due to invalid IL or missing references) int result; if (entity.Index > 0) { EntityManager entityManager = GetEntityManager(); result = (((EntityManager)(ref entityManager)).Exists(entity) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } } } namespace BloodCraftEZLife { [BepInProcess("VRising.exe")] [BepInPlugin("BloodCraftEZLife.PluginsUI", "BloodCraftEZLife", "0.8.2")] public class Plugin : BasePlugin { public static World _client; public const bool IS_TESTING = false; private static Harmony _harmonyChatPatch; private static Harmony _harmonyPlayerlistPatch; private static Harmony _harmonyInitPatch; internal static Harmony HarmonyVersionStringPatch; public static Plugin Instance { get; private set; } public static ManualLogSource LogInstance => ((BasePlugin)Instance).Log; public static Settings Settings { get; private set; } public static EntityManager EntityManager => _client.EntityManager; public static LocalizationService Localization { get; private set; } = new LocalizationService(); public static bool IsInitialized { get; private set; } public static Core Core { get { if (!IsGameDataInitialized) { throw new InvalidOperationException("Core is not initialized"); } return Core.Instance; } } public static bool IsGameDataInitialized { get; set; } public static BCUIManager UIManager { get; set; } public static BloodCraftEZLife.UI.ModernLib.CoreUpdateBehavior CoreUpdateBehavior { get; set; } public static bool IsClient { get; private set; } public static Entity LocalCharacter { get; set; } public static bool IsClientNull() { return _client == null; } public static void Reset() { _client = null; IsInitialized = false; IsGameDataInitialized = false; } public override void Load() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown IsClient = Application.productName != "VRisingServer"; LogUtils.Init(((BasePlugin)this).Log); Instance = this; if (!IsClient) { LogUtils.LogInfo($"{"BloodCraftEZLife"}[{"0.8.2"}] is a client mod! ({Application.productName})"); return; } Settings = new Settings().InitConfig(); Theme.Opacity = Settings.UITransparency; UIManager = new BCUIManager(); CoreUpdateBehavior = new BloodCraftEZLife.UI.ModernLib.CoreUpdateBehavior(); CoreUpdateBehavior.Setup(); IsInitialized = true; HarmonyVersionStringPatch = Harmony.CreateAndPatchAll(typeof(VersionStringPatch), (string)null); _harmonyChatPatch = Harmony.CreateAndPatchAll(typeof(ClientChatPatch), (string)null); _harmonyPlayerlistPatch = Harmony.CreateAndPatchAll(typeof(FullscreenPatch), (string)null); _harmonyInitPatch = Harmony.CreateAndPatchAll(typeof(InitializationPatch), (string)null); HotkeyService.Initialise(); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("BloodCraftEZLife.PluginsUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("0.8.2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); Localization = new LocalizationService(); } public override bool Unload() { HarmonyVersionStringPatch.UnpatchSelf(); _harmonyChatPatch.UnpatchSelf(); _harmonyPlayerlistPatch.UnpatchSelf(); _harmonyInitPatch.UnpatchSelf(); return true; } public static void GameDataOnInitialize(World world) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!IsGameDataInitialized && IsClient) { _client = world; FullscreenSettingService.InitialiseVbloodData(Client.GetServerId(EntityManager)); IsGameDataInitialized = true; UIManager.ClientActivate(active: true); } } public static void UIOnInitialize() { UIManager.SetupAndShowUI(); BloodCraftStateService.Initialize(); LogUtils.LogInfo("UI Manager initialized"); } } public static class PluginInfo { public const string PLUGIN_GUID = "BloodCraftEZLife.PluginsUI"; public const string PLUGIN_NAME = "BloodCraftEZLife"; public const string PLUGIN_VERSION = "0.8.2"; } } namespace BloodCraftEZLife.Utils { public class Core { private static Core _instance; internal static Core Instance => _instance ?? (_instance = new Core()); public PrefabCollectionSystem PrefabCollectionSystem => Plugin._client.GetExistingSystemManaged(); public GameDataSystem GameDataSystem => Plugin._client.GetExistingSystemManaged(); public ManagedDataRegistry ManagedDataRegistry => GameDataSystem.ManagedDataRegistry; public DebugEventsSystem DebugEventsSystem => Plugin._client.GetExistingSystemManaged(); public UnitSpawnerUpdateSystem UnitSpawnerUpdateSystem => Plugin._client.GetExistingSystemManaged(); public ClientScriptMapper ClientScriptMapper => Plugin._client.GetExistingSystemManaged(); } public static class ExtensionMethods { public static string GetPrefabName(this PrefabGUID prefabGuid) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) try { return prefabGuid.LookupName(); } catch { return null; } } public static IEnumerable ToEnumerable(this EntityQuery entityQuery) { //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) Enumerator enumerator = ((EntityQuery)(ref entityQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); while (enumerator.MoveNext()) { yield return new BaseEntityModel(entity: enumerator.Current, world: Plugin._client); } } public static DateTime ToDateTime(this long unixDateTime) { return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(unixDateTime); } public static double Distance(this float3 pos1, float3 pos2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) return Math.Sqrt(Math.Pow(pos1.x - pos2.x, 2.0) + Math.Pow(pos1.z - pos2.z, 2.0)); } } internal static class Extensions { public delegate void WithRefHandler(ref T item); private const string EMPTY_KEY = "LocalizationKey.Empty"; private const string PREFIX = "Entity("; private const int LENGTH = 7; private static EntityManager EntityManager => Plugin.EntityManager; public static string GetText(this SimpleStunButton helper) { TextMeshProUGUI componentInChildren = ((Component)helper).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { return ((TMP_Text)componentInChildren).text; } return ""; } public static void SetText(this SimpleStunButton helper, string text) { TextMeshProUGUI componentInChildren = ((Component)helper).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = text; } } public static bool IsEnabled(this TextMeshProUGUI entity) { bool? obj; if (entity == null) { obj = null; } else { GameObject gameObject = ((Component)entity).gameObject; obj = ((gameObject != null) ? new bool?(gameObject.activeSelf) : ((bool?)null)); } bool? flag = obj; return flag == true; } public static Color GetTransparent(this Color baseColor, float alpha = 0.7f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) return new Color(baseColor.r, baseColor.g, baseColor.b, alpha); } public static void With(this Entity entity, WithRefHandler action) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) T item = entity.ReadRW(); action(ref item); EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentData(entity, item); } public static void AddWith(this Entity entity, WithRefHandler action) where T : struct { //IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references) if (!entity.Has()) { entity.Add(); } entity.With(action); } public unsafe static void Write(this Entity entity, T componentData) where T : struct { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; byte[] array = StructureToByteArray(componentData); int num = Marshal.SizeOf(); fixed (byte* ptr = array) { EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, typeIndex, (void*)ptr, num); } } private static byte[] StructureToByteArray(T structure) where T : struct { int num = Marshal.SizeOf(structure); byte[] array = new byte[num]; IntPtr intPtr = Marshal.AllocHGlobal(num); Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true); Marshal.Copy(intPtr, array, 0, num); Marshal.FreeHGlobal(intPtr); return array; } private unsafe static T ReadRW(this Entity entity) where T : struct { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; EntityManager entityManager = EntityManager; void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, typeIndex); return Marshal.PtrToStructure(new IntPtr(componentDataRawRW)); } public unsafe static T Read(this Entity entity) where T : struct { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; EntityManager entityManager = EntityManager; void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex); return Marshal.PtrToStructure(new IntPtr(componentDataRawRO)); } public static DynamicBuffer ReadBuffer(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_0013: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBuffer(entity, false); } public static DynamicBuffer AddBuffer(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).AddBuffer(entity); } public unsafe static void* GetComponentData(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex); } public unsafe static void SetComponentData(this Entity entity, TypeIndex typeIndex, void* byteData, int size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, typeIndex, byteData, size); } public unsafe static void* GetBufferData(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBufferRawRO(entity, typeIndex); } public static int GetBufferLength(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBufferLength(entity, typeIndex); } public static void SetBufferData(Entity prefabSource, T[] bufferArray) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) DynamicBuffer val = (prefabSource.Has() ? prefabSource.ReadBuffer() : prefabSource.AddBuffer()); val.Clear(); foreach (T val2 in bufferArray) { val.Add(val2); } } public static bool TryGetComponent(this Entity entity, out T componentData) where T : struct { //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) componentData = default(T); if (entity.Has()) { componentData = entity.Read(); return true; } return false; } public static bool TryGetComponentObject(this Entity entity, EntityManager entityManager, out T componentObject) where T : class { //IL_000a: 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) componentObject = null; if (((EntityManager)(ref entityManager)).HasComponent(entity)) { componentObject = ((EntityManager)(ref entityManager)).GetComponentObject(entity); return componentObject != null; } return false; } public static bool TryRemoveComponent(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (entity.Has()) { entity.Remove(); return true; } return false; } public static bool HasComponentInternal(this EntityManager entityManager, Entity entity) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) try { return ((EntityManager)(ref entityManager)).HasComponent(entity); } catch { return false; } } public static bool TryGetComponentDataInternal(this EntityManager entityManager, Entity entity, out T value) where T : new() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) try { value = ((EntityManager)(ref entityManager)).GetComponentData(entity); return true; } catch { value = default(T); return false; } } public static List ToList(this DynamicBuffer bufferList) where T : new() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (bufferList.Length == 0) { return null; } List list = new List(); Enumerator enumerator = bufferList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static List GetBufferInternal(this EntityManager entityManager, Entity entity) where T : struct { //IL_0004: 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) try { return ((EntityManager)(ref entityManager)).GetBuffer(entity, false).ToList(); } catch (Exception) { return null; } } public static T GetManagedComponentDataInternal(this World world, BaseEntityModel entity) where T : class { //IL_0033: Unknown result type (might be due to invalid IL or missing references) PrefabGUID? prefabGUID = entity.PrefabGUID; if (!prefabGUID.HasValue) { return null; } ManagedDataRegistry managedDataRegistry = world.GetExistingSystemManaged().ManagedDataRegistry; return managedDataRegistry.GetOrDefault(prefabGUID.Value, (T)null); } public static bool Has(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of(), (AccessMode)0)); } public static bool Has(this Entity entity, ComponentType componentType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, componentType); } public static void Add(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, new ComponentType(Il2CppType.Of(), (AccessMode)0)); } public static void Add(this Entity entity, ComponentType componentType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, componentType); } public static void Remove(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity, new ComponentType(Il2CppType.Of(), (AccessMode)0)); } public static bool TryGetFollowedPlayer(this Entity entity, out Entity player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) player = Entity.Null; if (entity.TryGetComponent(out Follower componentData) && componentData.Followed._Value.TryGetPlayer(out player)) { return true; } return false; } public static bool TryGetPlayer(this Entity entity, out Entity player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) player = Entity.Null; if (entity.Has()) { player = entity; return true; } return false; } public static bool IsPlayer(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (entity.Has()) { return true; } return false; } public static bool IsDifferentPlayer(this Entity entity, Entity target) { //IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references) if (entity.IsPlayer() && target.IsPlayer() && !((Entity)(ref entity)).Equals(target)) { return true; } return false; } public static bool IsFollowingPlayer(this Entity entity) { //IL_0001: 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_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) if (entity.TryGetComponent(out Follower componentData) && componentData.Followed._Value.IsPlayer()) { return true; } return false; } public static string GetLocalizedName(this PrefabGUID prefabGuid) { //IL_0006: 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) string text = default(string); if (PrefabNames.LocalizedNameKeys.TryGetValue(prefabGuid, out var value) && Localization.LocalizedStrings.TryGetValue(AssetGuid.FromString(value), ref text) && !string.IsNullOrEmpty(text)) { return text; } return "LocalizationKey.Empty"; } public static int GetUnitLevel(this Entity entity) { //IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out UnitLevel componentData)) { return componentData.Level._Value; } return 0; } public static Entity GetBuffTarget(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity); } public static Entity GetSpellTarget(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity); } public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) teamEntity = Entity.Null; if (entity.TryGetComponent(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_0001: 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_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) int result; if (entity.HasValue() && entity.IndexWithinCapacity()) { EntityManager entityManager = EntityManager; result = (((EntityManager)(ref entityManager)).Exists(entity) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } public static bool IsDisabled(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity.Has(); } public static bool IsVBlood(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity.Has(); } public static ulong GetSteamId(this Entity entity) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out PlayerCharacter componentData)) { return componentData.UserEntity.Read().PlatformId; } if (entity.TryGetComponent(out User componentData2)) { return componentData2.PlatformId; } return 0uL; } public static NetworkId GetNetworkId(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out NetworkId componentData)) { return componentData; } return NetworkId.Empty; } public static void ForEach(this IEnumerable source, Action action) { foreach (T item in source) { action(item); } } public static PrefabGUID GetPrefabGUID(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out PrefabGUID componentData)) { return componentData; } return PrefabGUID.Empty; } public static Entity GetUserEntity(this Entity character) { //IL_0001: 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_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references) if (character.TryGetComponent(out PlayerCharacter componentData)) { return componentData.UserEntity; } return Entity.Null; } public static User GetUser(this Entity entity) { //IL_0001: 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_000c: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out PlayerCharacter componentData) && componentData.UserEntity.TryGetComponent(out User componentData2)) { return componentData2; } if (entity.TryGetComponent(out componentData2)) { return componentData2; } return User.Empty; } public static float3 GetAimPosition(this Entity entity) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out EntityInput componentData)) { return componentData.AimPosition; } return float3.zero; } public static bool TryGetPosition(this Entity entity, out float3 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) position = float3.zero; if (entity.TryGetComponent(out Translation componentData)) { position = componentData.Value; return true; } return false; } public static float3 GetPosition(this Entity entity) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent(out Translation componentData)) { return componentData.Value; } return float3.zero; } public static bool TryGetMatch(this HashSet<(ulong, ulong)> hashSet, ulong value, out (ulong, ulong) matchingPair) { matchingPair = default((ulong, ulong)); foreach (var item in hashSet) { if (item.Item1 == value || item.Item2 == value) { matchingPair = item; return true; } } return false; } public static bool IsCustomSpawned(this Entity entity) { //IL_0001: 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(out IsMinion componentData) && componentData.Value) { return true; } return false; } public static void Destroy(this Entity entity) { //IL_0001: 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) if (entity.Exists()) { DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)0, (string)null, 0); } } public static void SetTeam(this Entity entity, Entity teamSource) { //IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) if (entity.Has() && entity.Has() && teamSource.TryGetComponent(out Team componentData) && teamSource.TryGetComponent(out TeamReference componentData2)) { Entity teamRefEntity = componentData2.Value._Value; int teamId = componentData.Value; entity.With((WithRefHandler)delegate(ref TeamReference teamReference) { //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) teamReference.Value._Value = teamRefEntity; }); entity.With((WithRefHandler)delegate(ref Team team) { team.Value = teamId; }); } } public static void SetFaction(this Entity entity, PrefabGUID factionPrefabGUID) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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.Has()) { entity.With((WithRefHandler)delegate(ref FactionReference factionReference) { //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) factionReference.FactionGuid._Value = factionPrefabGUID; }); } } public static bool HasKeyValue(this Dictionary dic, T key, int value) { return dic.ContainsKey(key) && dic[key] == value; } public static void SetValue(this Dictionary dic, T key, int value) { dic[key] = value; } public static bool TryGetBuffer(this Entity entity, out DynamicBuffer dynamicBuffer) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Plugin.EntityManager; if (((EntityManager)(ref entityManager)).TryGetBuffer(entity, ref dynamicBuffer)) { return true; } dynamicBuffer = default(DynamicBuffer); return false; } public static bool HasValue(this Entity entity) { //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) return entity != Entity.Null; } public unsafe static bool IndexWithinCapacity(this Entity entity) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) string text = ((object)(*(Entity*)(&entity))/*cast due to .constrained prefix*/).ToString(); ReadOnlySpan span = text.AsSpan(); if (!span.StartsWith("Entity(")) { return false; } ref ReadOnlySpan 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 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; bool flag = (uint)result2 < (uint)entityCapacity; if (!flag) { } return flag; } } internal static class FamHelper { public static Entity FindActiveFamiliar(Entity playerCharacter) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0040: Unknown result type (might be due to invalid IL or missing references) if (playerCharacter.TryGetBuffer(out DynamicBuffer dynamicBuffer) && !dynamicBuffer.IsEmpty) { Enumerator enumerator = dynamicBuffer.GetEnumerator(); if (enumerator.MoveNext()) { FollowerBuffer current = enumerator.Current; return current.Entity._Entity; } } return Entity.Null; } } internal static class GameHelper { public class ColorNameData { public Color Color { get; set; } public string Name { get; set; } } internal static ColorNameData GetColorNameFromSchool(AbilitySchoolType? schoolType) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected I4, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0083: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (!schoolType.HasValue) { return new ColorNameData { Name = "Normal", Color = Color.white }; } AbilitySchoolType? val = schoolType; AbilitySchoolType? val2 = val; if (val2.HasValue) { AbilitySchoolType valueOrDefault = val2.GetValueOrDefault(); if ((int)valueOrDefault <= 8) { switch (valueOrDefault - 1) { default: if ((int)valueOrDefault != 8) { break; } return new ColorNameData { Name = "Frost", Color = new Color(0f, 255f, 255f) }; case 0: return new ColorNameData { Name = "Blood", Color = new Color(255f, 0f, 0f) }; case 1: return new ColorNameData { Name = "Unholy", Color = new Color(0f, 255f, 0f) }; case 3: return new ColorNameData { Name = "Illusion", Color = new Color(0f, 128f, 128f) }; case 2: break; } } else { if ((int)valueOrDefault == 16) { return new ColorNameData { Name = "Chaos", Color = new Color(160f, 32f, 240f) }; } if ((int)valueOrDefault == 32) { return new ColorNameData { Name = "Storm", Color = new Color(255f, 215f, 0f) }; } } } throw new ArgumentOutOfRangeException("schoolType"); } internal static AbilitySchoolType? GetSchoolFromHexColor(string colorText) { return colorText switch { "#008080" => (AbilitySchoolType)4, "#00FFFF" => (AbilitySchoolType)8, "#FF0000" => (AbilitySchoolType)1, "#FFD700" => (AbilitySchoolType)32, "#A020F0" => (AbilitySchoolType)16, "#00FF00" => (AbilitySchoolType)2, _ => null, }; } } public static class LogUtils { private static ManualLogSource Log; public static void LogDebugError(Exception exception) { ManualLogSource log = Log; if (log != null) { log.LogError((object)exception); } } public static void Init(ManualLogSource log) { Log = log; } public static void LogInfo(string text) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("BloodCraftEZLife: " + text)); } } public static void LogError(string text) { ManualLogSource log = Log; if (log != null) { log.LogError((object)text); } } public static void LogWarning(string text) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)text); } } } internal static class TimerHelper { public static void OneTickTimer(float interval, Action action) { System.Timers.Timer timer = new System.Timers.Timer(interval); timer.Elapsed += delegate { action(); timer.Stop(); timer.Dispose(); }; timer.AutoReset = false; timer.Enabled = true; } } public static class UnityHelper { public static void HideObject(GameObject obj) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) Image component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { Color color = ((Graphic)component).color; color.a = 0f; ((Graphic)component).color = color; } } public static void ListAllComponentsWithChildren(GameObject root) { Component[] array = Il2CppArrayBase.op_Implicit(root.GetComponentsInChildren(true)); Component[] array2 = array; foreach (Component val in array2) { if (!((Object)(object)val == (Object)null)) { LogUtils.LogInfo($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]"); } } } public static void DeleteComponentNamed(GameObject root, string compname) { Component[] array = Il2CppArrayBase.op_Implicit(root.GetComponentsInChildren(true)); for (int i = 0; i < array.Count() - 1; i++) { Component val = array[i]; if (!((Object)(object)val == (Object)null)) { if (((Object)val).name == compname) { Object.Destroy((Object)(object)val.gameObject); break; } LogUtils.LogInfo($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]"); } } } public static void ListAllComponents(GameObject root) { Component[] array = Il2CppArrayBase.op_Implicit(root.GetComponents()); Component[] array2 = array; foreach (Component val in array2) { if (!((Object)(object)val == (Object)null)) { Debug.Log(Object.op_Implicit($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]")); } } } public static GameObject FindInHierarchy(string path) { if (string.IsNullOrEmpty(path)) { return null; } string[] array = path.Split('|'); if (array.Length == 0) { return null; } GameObject val = GameObject.Find(array[0]); if ((Object)(object)val == (Object)null) { return null; } for (int i = 1; i < array.Length; i++) { Transform val2 = val.transform.Find(array[i]); if ((Object)(object)val2 == (Object)null) { return null; } val = ((Component)val2).gameObject; } return val; } public static void LogShader(Material material) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected I4, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) int propertyCount = material.shader.GetPropertyCount(); for (int i = 0; i < propertyCount; i++) { string propertyName = material.shader.GetPropertyName(i); string propertyDescription = material.shader.GetPropertyDescription(i); Il2CppStringArray propertyAttributes = material.shader.GetPropertyAttributes(i); ShaderPropertyFlags propertyFlags = material.shader.GetPropertyFlags(i); ShaderPropertyType propertyType = material.shader.GetPropertyType(i); object value = null; Vector2 val = (((int)propertyType == 3) ? material.shader.GetPropertyRangeLimits(i) : Vector2.zero); ShaderPropertyType val2 = propertyType; ShaderPropertyType val3 = val2; switch (val3 - 1) { case 0: value = material.shader.GetPropertyDefaultVectorValue(i); break; case 1: value = material.shader.GetPropertyDefaultFloatValue(i); break; case 4: value = material.shader.GetPropertyDefaultIntValue(i); break; } LogUtils.LogInfo($"Property {i}: {propertyName} - {propertyDescription} - {((propertyAttributes != null) ? string.Join(',', ((IEnumerable)propertyAttributes).Select((string a) => a)) : null)} - {propertyFlags} - {propertyType} - {value} - {val.x}:{val.y}"); } } public static void PrintParents(Transform t) { int num = 0; Transform val = t; while ((Object)(object)val != (Object)null) { string text = new string('-', num); Debug.Log(Object.op_Implicit(text + ((Object)((Component)val).gameObject).name)); val = val.parent; num++; } } public static void PrintChilds(Transform t, int depth, bool withcomponent = false) { string text = new string('-', depth); Debug.Log(Object.op_Implicit(text + ((Object)((Component)t).gameObject).name + GetLabelValue(((Component)t).gameObject))); if (withcomponent) { ListAllComponentsWithChildren(((Component)t).gameObject); } for (int i = 0; i < t.childCount; i++) { Transform child = t.GetChild(i); PrintChilds(child, depth + 1); } } public static string GetLabelValue(GameObject obj) { TextMeshProUGUI componentInChildren = obj.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { return " Text: " + ((TMP_Text)componentInChildren).text; } return ""; } public static void DumpUI(GameObject go, int depth = 0) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { string text = new string('-', depth); Debug.Log(Object.op_Implicit(text + " GameObject: " + ((Object)go).name)); RectTransform component = go.GetComponent(); if ((Object)(object)component != (Object)null) { Debug.Log(Object.op_Implicit($"{text} RectTransform: Pos={component.anchoredPosition}, Size={component.sizeDelta}, Pivot={component.pivot}")); } Image component2 = go.GetComponent(); if ((Object)(object)component2 != (Object)null) { Debug.Log(Object.op_Implicit($"{text} Image: Color={((Graphic)component2).color}, Sprite={(((Object)(object)component2.sprite != (Object)null) ? ((Object)component2.sprite).name : "None")}, Type={component2.type}")); } TextMeshProUGUI component3 = go.GetComponent(); if ((Object)(object)component3 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(52, 6); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" TMP_Text: Text='"); defaultInterpolatedStringHandler.AppendFormatted(((TMP_Text)component3).text); defaultInterpolatedStringHandler.AppendLiteral("', Font="); TMP_FontAsset font = ((TMP_Text)component3).font; defaultInterpolatedStringHandler.AppendFormatted((font != null) ? ((Object)font).name : null); defaultInterpolatedStringHandler.AppendLiteral(", Size="); defaultInterpolatedStringHandler.AppendFormatted(((TMP_Text)component3).fontSize); defaultInterpolatedStringHandler.AppendLiteral(", Color="); defaultInterpolatedStringHandler.AppendFormatted(((Graphic)component3).color); defaultInterpolatedStringHandler.AppendLiteral(", Alignment="); defaultInterpolatedStringHandler.AppendFormatted(((TMP_Text)component3).alignment); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Text component4 = go.GetComponent(); if ((Object)(object)component4 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(48, 6); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" Text: Text='"); defaultInterpolatedStringHandler.AppendFormatted(component4.text); defaultInterpolatedStringHandler.AppendLiteral("', Font="); Font font2 = component4.font; defaultInterpolatedStringHandler.AppendFormatted((font2 != null) ? ((Object)font2).name : null); defaultInterpolatedStringHandler.AppendLiteral(", Size="); defaultInterpolatedStringHandler.AppendFormatted(component4.fontSize); defaultInterpolatedStringHandler.AppendLiteral(", Color="); defaultInterpolatedStringHandler.AppendFormatted(((Graphic)component4).color); defaultInterpolatedStringHandler.AppendLiteral(", Alignment="); defaultInterpolatedStringHandler.AppendFormatted(component4.alignment); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Button component5 = go.GetComponent