Decompiled source of KindredSacrifice v1.0.0
KindredSacrifice.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.Json.Serialization; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using KindredSacrifice.Data; using KindredSacrifice.Services; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Network; using ProjectM.Physics; using ProjectM.Scripting; using ProjectM.Shared; using ProjectM.Tiles; using Stunlock.Core; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; 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("Odjit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Offer the living, awaken the altar.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d74687832efd52516a09b2c4a1fffab9fbc50de3")] [assembly: AssemblyProduct("KindredSacrifice")] [assembly: AssemblyTitle("KindredSacrifice")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace KindredSacrifice { internal static class Core { private static World server; private static bool _hasInitialized = false; private static MonoBehaviour monoBehaviour; private static EntityQuery networkIdSystemQuery; public static World Server { get { object obj = server; if (obj == null) { obj = GetServerWorld() ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?"); server = (World)obj; } return (World)obj; } } public static EntityManager EntityManager => Server.EntityManager; public static bool IsServer => Application.productName == "VRisingServer"; public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; } public static DebugEventsSystem DebugEventsSystem { get; internal set; } public static ServerGameManager ServerGameManager { get; internal set; } public static ServerGameSettingsSystem ServerGameSettingsSystem { get; internal set; } public static SacrificeConfigService ConfigService { get; internal set; } public static SacrificeService SacrificeService { get; internal set; } public static BuffService BuffService { get; } = new BuffService(); public static ItemService ItemService { get; } = new ItemService(); public static bool HasInitialized => _hasInitialized; public static ManualLogSource Log { get; } = Plugin.PluginLog; private static World GetServerWorld() { Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (current.Name == "Server") { return current; } } return null; } public static void LogException(Exception e, string caller = "") { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(15, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Exception in "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message); } log.LogError(val); ManualLogSource log2 = Log; val = new BepInExErrorLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stack trace: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace); } log2.LogError(val); } public static bool TryGetEntityFromNetworkId(NetworkId networkId, out 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) entity = Entity.Null; if (!_hasInitialized) { return false; } Singleton singleton = ((EntityQuery)(ref networkIdSystemQuery)).GetSingleton<Singleton>(); NetworkIdLookupMap networkIdLookupRO = ((Singleton)(ref singleton)).GetNetworkIdLookupRO(); return ((NetworkIdLookupMap)(ref networkIdLookupRO)).TryGetValue(networkId, ref entity); } public static void InitializeAfterLoaded() { //IL_003f: 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_004e: 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_005f: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown if (!_hasInitialized) { PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>(); DebugEventsSystem = Server.GetExistingSystemManaged<DebugEventsSystem>(); ServerGameSettingsSystem = Server.GetExistingSystemManaged<ServerGameSettingsSystem>(); ServerGameManager = Server.GetExistingSystemManaged<ServerScriptMapper>().GetServerGameManager(); EntityManager entityManager = EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Singleton>() }); val.Options = (EntityQueryOptions)16; array[0] = val; networkIdSystemQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); ConfigService = new SacrificeConfigService(); ConfigService.LoadConfig(); SacrificeService = new SacrificeService(); _hasInitialized = true; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("InitializeAfterLoaded"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" completed"); } log.LogInfo(val2); } } public static Coroutine StartCoroutine(IEnumerator routine) { //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_0027: Expected O, but got Unknown if ((Object)(object)monoBehaviour == (Object)null) { GameObject val = new GameObject("KindredSacrifice"); monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>(); Object.DontDestroyOnLoad((Object)val); } return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine)); } } internal static class ECSExtensions { public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_003b: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); byte[] array = StructureToByteArray(componentData); int num = Marshal.SizeOf<T>(); fixed (byte* ptr = array) { EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num); } } public static byte[] StructureToByteArray<T>(T structure) where T : struct { int num = Marshal.SizeOf(structure); byte[] array = new byte[num]; IntPtr intPtr = Marshal.AllocHGlobal(num); Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true); Marshal.Copy(intPtr, array, 0, num); Marshal.FreeHGlobal(intPtr); return array; } public unsafe static T Read<T>(this Entity entity) where T : struct { //IL_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_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_0017: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; return Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex))); } public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct { //IL_0005: 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_000d: 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) EntityManager entityManager = Core.Server.EntityManager; return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false); } public static bool Has<T>(this Entity entity) { //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_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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, val); } public static string LookupName(this PrefabGUID prefabGuid) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>(); NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = existingSystemManaged._PrefabLookupMap.GuidToEntityMap; if (!guidToEntityMap.ContainsKey(prefabGuid)) { return "GUID Not Found"; } PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap; return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid) + " PrefabGuid(" + ((PrefabGUID)(ref prefabGuid)).GuidHash + ")"; } public static void Add<T>(this Entity entity) { //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_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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, val); } public static void Remove<T>(this Entity entity) { //IL_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_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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity, val); } public static float3 GetPosition(this Entity entity) { //IL_0000: 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_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) //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<LocalToWorld>()) { LocalToWorld val = entity.Read<LocalToWorld>(); return ((LocalToWorld)(ref val)).Position; } return float3.zero; } public static Entity GetCharacter(this Entity userEntity) { //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) //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) return userEntity.Read<User>().LocalCharacter._Entity; } public static bool ExistsAndValid(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) //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_0015: Unknown result type (might be due to invalid IL or missing references) if (entity != Entity.Null) { EntityManager entityManager = Core.EntityManager; return ((EntityManager)(ref entityManager)).Exists(entity); } return false; } } [BepInPlugin("odjit.KindredSacrifice", "KindredSacrifice", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal static Harmony Harmony; internal static ManualLogSource PluginLog; public override void Load() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown PluginLog = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("odjit.KindredSacrifice"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); Harmony = new Harmony("odjit.KindredSacrifice"); Harmony.PatchAll(Assembly.GetExecutingAssembly()); CommandRegistry.RegisterAll(); } public override bool Unload() { CommandRegistry.UnregisterAssembly(); Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "odjit.KindredSacrifice"; public const string PLUGIN_NAME = "KindredSacrifice"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace KindredSacrifice.Services { internal class BuffService { [CompilerGenerated] private sealed class <ApplyBuffCoroutine>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Entity charEntity; public PrefabGUID buffGuid; public BuffService <>4__this; public Entity userEntity; public float duration; private EntityManager <entityManager>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyBuffCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_0035: 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_0041: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; BuffService buffService = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; _ = Core.Log; <entityManager>5__2 = Core.Server.EntityManager; Entity val = default(Entity); if (BuffUtility.TryGetBuff<EntityManager>(<entityManager>5__2, charEntity, PrefabIdentifier.op_Implicit(buffGuid), ref val)) { DestroyUtility.Destroy(<entityManager>5__2, val, (DestroyDebugReason)13, (string)null, 0); } break; } case 1: <>1__state = -1; break; } if (BuffUtility.HasBuff<EntityManager>(<entityManager>5__2, charEntity, PrefabIdentifier.op_Implicit(buffGuid))) { <>2__current = null; <>1__state = 1; return true; } buffService.ApplyBuffInternal(userEntity, charEntity, buffGuid, duration); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public void ApplyBuff(Entity userEntity, Entity charEntity, PrefabGUID buffGuid, float duration = -1f) { //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_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_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_0033: 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_0021: Unknown result type (might be due to invalid IL or missing references) _ = Core.Log; if (BuffUtility.HasBuff<EntityManager>(Core.Server.EntityManager, charEntity, PrefabIdentifier.op_Implicit(buffGuid))) { Core.StartCoroutine(ApplyBuffCoroutine(userEntity, charEntity, buffGuid, duration)); } else { ApplyBuffInternal(userEntity, charEntity, buffGuid, duration); } } private void ApplyBuffInternal(Entity userEntity, Entity charEntity, PrefabGUID buffGuid, float duration) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) _ = Core.Log; EntityManager entityManager = Core.Server.EntityManager; DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>(); ApplyBuffDebugEvent val = new ApplyBuffDebugEvent { BuffPrefabGUID = buffGuid }; FromCharacter val2 = new FromCharacter { User = userEntity, Character = charEntity }; existingSystemManaged.ApplyBuff(val2, val); Entity entity = default(Entity); if (!BuffUtility.TryGetBuff<EntityManager>(entityManager, charEntity, PrefabIdentifier.op_Implicit(buffGuid), ref entity)) { return; } if (entity.Has<CreateGameplayEventsOnSpawn>()) { entity.Remove<CreateGameplayEventsOnSpawn>(); } if (entity.Has<GameplayEventListeners>()) { entity.Remove<GameplayEventListeners>(); } if (!entity.Has<Buff_Persists_Through_Death>()) { entity.Add<Buff_Persists_Through_Death>(); } if (duration > -1f && duration != 0f) { if (!entity.Has<LifeTime>()) { entity.Add<LifeTime>(); } LifeTime componentData = entity.Read<LifeTime>(); componentData.Duration = duration; componentData.EndAction = (LifeTimeEndAction)2; entity.Write<LifeTime>(componentData); } else if (duration == -1f) { if (entity.Has<LifeTime>()) { entity.Write<LifeTime>(new LifeTime { Duration = 0f, EndAction = (LifeTimeEndAction)0 }); } if (entity.Has<RemoveBuffOnGameplayEvent>()) { entity.Remove<RemoveBuffOnGameplayEvent>(); } if (entity.Has<RemoveBuffOnGameplayEventEntry>()) { entity.Remove<RemoveBuffOnGameplayEventEntry>(); } } } [IteratorStateMachine(typeof(<ApplyBuffCoroutine>d__2))] private IEnumerator ApplyBuffCoroutine(Entity userEntity, Entity charEntity, PrefabGUID buffGuid, float duration) { //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_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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyBuffCoroutine>d__2(0) { <>4__this = this, userEntity = userEntity, charEntity = charEntity, buffGuid = buffGuid, duration = duration }; } public void RemoveBuff(Entity charEntity, PrefabGUID buffGuid) { //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) //IL_0007: 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) Entity val = default(Entity); if (BuffUtility.TryGetBuff<EntityManager>(Core.EntityManager, charEntity, PrefabIdentifier.op_Implicit(buffGuid), ref val)) { DestroyUtility.Destroy(Core.EntityManager, val, (DestroyDebugReason)13, (string)null, 0); } } } internal class ItemService { private static readonly PrefabGUID BloodMerlotPrefab = new PrefabGUID(1223264867); private Entity CreateDropProxy(float3 position) { //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_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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; Entity val = ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<Translation>() }); val.Write<Translation>(new Translation { Value = position }); return val; } private void WithDropProxy(float3 position, Action<Entity> action) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) Entity val = CreateDropProxy(position); try { action(val); } finally { DestroyUtility.Destroy(Core.EntityManager, val, (DestroyDebugReason)0, (string)null, 0); } } public void DropItemWithModification(PrefabGUID itemPrefab, float3 dropPosition, int quantity = 1, Action<Entity> modifyItem = null) { //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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; try { ItemData val = default(ItemData); if (!Core.Server.GetExistingSystemManaged<GameDataSystem>().ItemHashLookupMap.TryGetValue(itemPrefab, ref val)) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Could not find ItemData for prefab "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((PrefabGUID)(ref itemPrefab)).GuidHash); } log.LogWarning(val2); } else { Entity entity = val.Entity; modifyItem?.Invoke(entity); WithDropProxy(dropPosition, delegate(Entity proxy) { //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_0008: 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_001b: Unknown result type (might be due to invalid IL or missing references) InventoryUtilitiesServer.CreateDropItem(entityManager, proxy, itemPrefab, quantity, default(Entity)); }); } } catch (Exception e) { Core.LogException(e, "DropItemWithModification"); } } public void DropItems(List<ItemDrop> itemDrops, float3 dropPosition, float qualityMultiplier = 1f) { //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_002b: Unknown result type (might be due to invalid IL or missing references) ManualLogSource logger = Core.Log; EntityManager entityManager = Core.EntityManager; try { WithDropProxy(dropPosition, delegate(Entity proxy) { //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_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) PrefabGUID val = default(PrefabGUID); bool flag = default(bool); foreach (ItemDrop itemDrop in itemDrops) { int num = Random.Range(itemDrop.MinQuantity, itemDrop.MaxQuantity + 1); if (qualityMultiplier != 1f) { num = (int)((float)num * qualityMultiplier); } if (num > 0) { ((PrefabGUID)(ref val))..ctor(itemDrop.ItemPrefabGuid); InventoryUtilitiesServer.CreateDropItem(entityManager, proxy, val, num, default(Entity)); ManualLogSource obj = logger; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Item drop reward: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("x "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(val.LookupName()); } obj.LogInfo(val2); } } }); } catch (Exception e) { Core.LogException(e, "DropItems"); } } public void DropBloodMerlots(PrefabGUID bloodType, float bloodQuality, int quantity, float3 dropPosition) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_0091: 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_0066: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = Core.Log; EntityManager entityManager = Core.EntityManager; try { ItemData val = default(ItemData); bool flag = default(bool); if (!Core.Server.GetExistingSystemManaged<GameDataSystem>().ItemHashLookupMap.TryGetValue(BloodMerlotPrefab, ref val)) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Could not find ItemData for BloodMerlot prefab "); PrefabGUID bloodMerlotPrefab = BloodMerlotPrefab; ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((PrefabGUID)(ref bloodMerlotPrefab)).GuidHash); } log2.LogWarning(val2); return; } Entity entity = val.Entity; if (!entity.Has<StoredBlood>()) { entity.Add<StoredBlood>(); } StoredBlood val3 = default(StoredBlood); val3.BloodQuality = bloodQuality; val3.PrimaryBloodType = bloodType; StoredBlood val4 = val3; ((EntityManager)(ref entityManager)).SetComponentData<StoredBlood>(entity, val4); WithDropProxy(dropPosition, delegate(Entity proxy) { //IL_0005: 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_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) for (int i = 0; i < quantity; i++) { InventoryUtilitiesServer.CreateDropItem(entityManager, proxy, BloodMerlotPrefab, 1, default(Entity)); } }); BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Reward dropped: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(quantity); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" blood merlots of "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(((PrefabGUID)(ref bloodType)).GuidHash); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" @ "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<float>(bloodQuality); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("%"); } log.LogInfo(val5); } catch (Exception e) { Core.LogException(e, "DropBloodMerlots"); } } } internal static class BloodTypeMapping { private static readonly Dictionary<int, string> GuidToName = new Dictionary<int, string> { { -516976528, "Warrior" }, { -1620185637, "Rogue" }, { 804798592, "Brute" }, { 1476452791, "Scholar" }, { -1776904174, "Worker" }, { 1821108694, "Mutant" }, { 524822543, "Creature" }, { -1382693416, "Corrupted" }, { 1328126535, "Draculin" } }; public static int GetGuid(string bloodTypeName) { foreach (KeyValuePair<int, string> item in GuidToName) { if (item.Value.Equals(bloodTypeName, StringComparison.OrdinalIgnoreCase)) { return item.Key; } } return 0; } public static string GetName(int guid) { if (!GuidToName.TryGetValue(guid, out var value)) { return $"Unknown_{guid}"; } return value; } } internal class SacrificeConfigService { private static readonly string ConfigDirectory = Path.Combine(Paths.ConfigPath, "KindredSacrifice"); private static readonly string SettingsPath = Path.Combine(ConfigDirectory, "Settings.json"); private static readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions { WriteIndented = true, Converters = { (JsonConverter)new JsonStringEnumConverter() } }; public SacrificeSettings Settings { get; private set; } public SacrificeWorldState WorldState { get; internal set; } private void EnsureConfigDirectory() { if (!Directory.Exists(ConfigDirectory)) { Directory.CreateDirectory(ConfigDirectory); } } public SacrificeConfigService() { Settings = new SacrificeSettings(); WorldState = new SacrificeWorldState(); } public void LoadConfig() { LoadSettings(); } private void LoadSettings() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown try { EnsureConfigDirectory(); if (File.Exists(SettingsPath)) { string json = File.ReadAllText(SettingsPath); Settings = JsonSerializer.Deserialize<SacrificeSettings>(json, JsonOptions) ?? new SacrificeSettings(); if (Settings.BloodMoonLockoutNights < 2) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BloodMoonLockoutNights was "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Settings.BloodMoonLockoutNights); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", clamping to minimum of 2"); } log.LogWarning(val); Settings.BloodMoonLockoutNights = 2; SaveSettings(); } } else { Settings = new SacrificeSettings(); SaveSettings(); } } catch (Exception e) { Core.LogException(e, "LoadSettings"); Settings = new SacrificeSettings(); } } public void SaveSettings() { try { EnsureConfigDirectory(); string contents = JsonSerializer.Serialize(Settings, JsonOptions); File.WriteAllText(SettingsPath, contents); } catch (Exception e) { Core.LogException(e, "SaveSettings"); } } public void SaveWorldState() { Core.SacrificeService?.SaveWorldStateToCage(); } public void ResetWorldState() { WorldState = new SacrificeWorldState(); SaveWorldState(); } } internal class SacrificeSettings { public bool EnableSacrificeMessages { get; set; } = true; public bool EnableBloodmoonAccumulation { get; set; } = true; public int BloodMoonLockoutNights { get; set; } = 3; public Dictionary<string, SacrificeReward> BloodTypeRewards { get; set; } = new Dictionary<string, SacrificeReward> { { "Warrior", SacrificeReward.CreateDefaultMerlot() }, { "Rogue", SacrificeReward.CreateDefaultMerlot() }, { "Brute", new SacrificeReward { RewardType = RewardType.Buff, BuffPrefabGuid = 1068709119, BuffDuration = 3600f } }, { "Scholar", new SacrificeReward { RewardType = RewardType.Buff, BuffPrefabGuid = -238197495, BuffDuration = 3600f } }, { "Worker", new SacrificeReward { RewardType = RewardType.Buff, BuffPrefabGuid = -1703886455, BuffDuration = 3600f } }, { "Mutant", SacrificeReward.CreateDefaultMerlot() }, { "Creature", SacrificeReward.CreateDefaultMerlot() }, { "Corrupted", SacrificeReward.CreateDefaultMerlot() }, { "Draculin", SacrificeReward.CreateDefaultMerlot() } }; } internal class SacrificeWorldState { public float AccumulatedBloodPoints { get; set; } public int LastBloodMoonDay { get; set; } = -1; } internal class ItemDrop { public int ItemPrefabGuid { get; set; } public int MinQuantity { get; set; } = 1; public int MaxQuantity { get; set; } = 1; } internal class SacrificeReward { public RewardType RewardType { get; set; } public int BuffPrefabGuid { get; set; } public float BuffDuration { get; set; } public List<ItemDrop> ItemDrops { get; set; } = new List<ItemDrop>(); public int MerlotMinQuantity { get; set; } = 1; public int MerlotMaxQuantity { get; set; } = 1; public bool UsePrisonerBloodType { get; set; } = true; public string MerlotBloodType { get; set; } = "Warrior"; public bool UsePrisonerQuality { get; set; } = true; public float MerlotQuality { get; set; } = 100f; public static SacrificeReward CreateDefaultMerlot() { return new SacrificeReward { RewardType = RewardType.DropBloodMerlots, MerlotMinQuantity = 1, MerlotMaxQuantity = 3, UsePrisonerBloodType = true, MerlotBloodType = "", UsePrisonerQuality = true, MerlotQuality = 100f }; } } internal enum RewardType { None, BloodMoon, Buff, DropItems, DropBloodMerlots } internal class SacrificeService { [CompilerGenerated] private sealed class <PerformSacrificeSequence>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SacrificeService <>4__this; public Entity cageEntity; public int roundedQuality; public Entity ownerUserEntity; public Entity prisonerEntity; public float bloodQuality; public PrefabGUID bloodType; private RitualElements <ritualElements>5__2; private int <numStrikes>5__3; private float <damagePerStrike>5__4; private float <cooldownTime>5__5; private float <cooldownElapsed>5__6; private int <i>5__7; private float <waitTime>5__8; private float <elapsed>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformSacrificeSequence>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <ritualElements>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: 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_0364: 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_0359: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: 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_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SacrificeService sacrificeService = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; <ritualElements>5__2 = sacrificeService.GetRitualElements(cageEntity); if (roundedQuality == 100) { if (<ritualElements>5__2.Table.ExistsAndValid()) { Core.BuffService.ApplyBuff(Entity.Null, <ritualElements>5__2.Table, Prefabs.Buff_PerfectSacrifice_Table); } if (cageEntity.ExistsAndValid()) { Core.BuffService.ApplyBuff(Entity.Null, cageEntity, Prefabs.Buff_PerfectSacrifice_Cage); Core.BuffService.ApplyBuff(Entity.Null, cageEntity, Prefabs.Buff_PerfectSacrifice_BloodRain); } if (ownerUserEntity.ExistsAndValid()) { Entity character = ownerUserEntity.GetCharacter(); if (character.ExistsAndValid()) { Core.BuffService.ApplyBuff(ownerUserEntity, character, Prefabs.Buff_PerfectSacrifice_Players); } } } else if (<ritualElements>5__2.Brazier.ExistsAndValid()) { Core.BuffService.ApplyBuff(Entity.Null, <ritualElements>5__2.Brazier, Prefabs.Buff_SacrificeFlames); } Core.BuffService.ApplyBuff(Entity.Null, prisonerEntity, Prefabs.Buff_General_Ignite); if (!prisonerEntity.Has<Health>()) { return false; } Health val = prisonerEntity.Read<Health>(); ModifiableFloat maxHealth = val.MaxHealth; <numStrikes>5__3 = 5; <damagePerStrike>5__4 = ModifiableFloat.op_Implicit(maxHealth) / (float)<numStrikes>5__3; <i>5__7 = 0; goto IL_0257; } case 1: <>1__state = -1; goto IL_0237; case 2: <>1__state = -1; <>2__current = null; <>1__state = 3; return true; case 3: <>1__state = -1; DestroyUtility.Destroy(Core.EntityManager, prisonerEntity, (DestroyDebugReason)13, (string)null, 0); goto IL_02db; case 4: { <>1__state = -1; break; } IL_0237: if (<elapsed>5__9 < <waitTime>5__8) { <elapsed>5__9 += 0.016f; <>2__current = null; <>1__state = 1; return true; } <i>5__7++; goto IL_0257; IL_0257: if (<i>5__7 < <numStrikes>5__3 && prisonerEntity.ExistsAndValid()) { Health val = prisonerEntity.Read<Health>(); val.Value = Math.Max(0f, val.Value - <damagePerStrike>5__4); prisonerEntity.Write<Health>(val); <waitTime>5__8 = 1.5f; <elapsed>5__9 = 0f; goto IL_0237; } if (prisonerEntity.ExistsAndValid()) { Health val = prisonerEntity.Read<Health>(); val.Value = 0f; prisonerEntity.Write<Health>(val); <>2__current = null; <>1__state = 2; return true; } goto IL_02db; IL_02db: <cooldownTime>5__5 = 2f; <cooldownElapsed>5__6 = 0f; break; } if (<cooldownElapsed>5__6 < <cooldownTime>5__5) { <cooldownElapsed>5__6 += 0.016f; <>2__current = null; <>1__state = 4; return true; } if (roundedQuality == 100) { if (<ritualElements>5__2.Table.ExistsAndValid()) { Core.BuffService.RemoveBuff(<ritualElements>5__2.Table, Prefabs.Buff_PerfectSacrifice_Table); } if (cageEntity.ExistsAndValid()) { Core.BuffService.RemoveBuff(cageEntity, Prefabs.Buff_PerfectSacrifice_Cage); Core.BuffService.RemoveBuff(cageEntity, Prefabs.Buff_PerfectSacrifice_BloodRain); } if (ownerUserEntity.ExistsAndValid()) { Entity character2 = ownerUserEntity.GetCharacter(); if (character2.ExistsAndValid()) { Core.BuffService.RemoveBuff(character2, Prefabs.Buff_PerfectSacrifice_Players); } } } else if (<ritualElements>5__2.Brazier.ExistsAndValid()) { Core.BuffService.RemoveBuff(<ritualElements>5__2.Brazier, Prefabs.Buff_SacrificeFlames); } sacrificeService.ProcessSacrificeRewards(prisonerEntity, ownerUserEntity, bloodQuality, roundedQuality, bloodType, cageEntity); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float DropOffset = 2f; private const string CageNamePrefix = "KindredSacrifice|"; private SacrificeCageData activeCage; private RitualElements ritualElements = new RitualElements(); private EntityQuery dayNightCycleQuery; public SacrificeService() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) EntityManager entityManager = Core.EntityManager; dayNightCycleQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadWrite<DayNightCycle>(), ComponentType.ReadOnly<PrefabGUID>() }); } private static string EncodeCageName(float accumulatedPoints) { return $"{"KindredSacrifice|"}{accumulatedPoints:F0}"; } private static bool TryDecodeCageName(string name, out float accumulatedPoints) { accumulatedPoints = 0f; if (!name.StartsWith("KindredSacrifice|")) { return false; } return float.TryParse(name.Substring("KindredSacrifice|".Length), out accumulatedPoints); } public void SaveWorldStateToCage() { //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_003b: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0043: Unknown result type (might be due to invalid IL or missing references) if (activeCage == null) { return; } Entity entity = activeCage.Entity; EntityManager entityManager = Core.EntityManager; if (((EntityManager)(ref entityManager)).Exists(entity)) { string text = EncodeCageName(Core.ConfigService.WorldState.AccumulatedBloodPoints); if (!entity.Has<NameableInteractable>()) { entity.Add<NameableInteractable>(); } entity.Write<NameableInteractable>(new NameableInteractable { Name = new FixedString64Bytes(text) }); } } private static Entity TryDestroyAndClear(Entity entity) { //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) //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) if (entity.ExistsAndValid()) { DestroyUtility.Destroy(Core.EntityManager, entity, (DestroyDebugReason)0, (string)null, 0); } return Entity.Null; } public void LoadExistingSacrificeCage() { //IL_0017: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) try { FindSacrificeCage(); float3 referencePosition = activeCage?.Position ?? float3.zero; FindRitualElements(referencePosition); if (activeCage == null) { if (HasAnyRitualElements()) { Core.Log.LogWarning((object)"Found ritual elements without a cage. Cleaning up orphaned elements."); DestroyRitualElements(); } return; } float3 basePosition = default(float3); ((float3)(ref basePosition))..ctor(activeCage.Position.x, 0f, activeCage.Position.z); EnsureRitualElements(activeCage.Entity, basePosition); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded sacrifice cage at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float3>(activeCage.Position); } log.LogInfo(val); } catch (Exception e) { Core.LogException(e, "LoadExistingSacrificeCage"); } } private void FindSacrificeCage() { //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_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_0018: 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_0025: 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_002d: 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_0036: 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_003c: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_011f: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<NameableInteractable>()); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<PrefabGUID>()); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<PrisonCell>()); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); ((EntityQueryBuilder)(ref val2)).Dispose(); NativeArray<Entity> val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val4.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (current.Read<PrefabGUID>() != Prefabs.TM_SpecialStation_PrisonCell) { continue; } NameableInteractable val5 = current.Read<NameableInteractable>(); string text = ((object)(FixedString64Bytes)(ref val5.Name)).ToString(); if (!text.StartsWith("KindredSacrifice|")) { continue; } if (activeCage != null) { ManualLogSource log = Core.Log; BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("Multiple sacrifice cages found! Destroying duplicate: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<Entity>(current); } log.LogError(val6); TryDestroyAndClear(current); continue; } float3 position = (current.Has<Translation>() ? current.Read<Translation>().Value : float3.zero); activeCage = new SacrificeCageData { Entity = current, Position = position, OwnerUserEntity = Entity.Null, CreatedTime = DateTime.UtcNow }; if (TryDecodeCageName(text, out var accumulatedPoints)) { Core.ConfigService.WorldState.AccumulatedBloodPoints = accumulatedPoints; ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val7 = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("Restored world state from cage: "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<float>(accumulatedPoints, "F0"); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(" points"); } log2.LogInfo(val7); } } val4.Dispose(); ((EntityQuery)(ref val3)).Dispose(); } private void FindRitualElements(float3 referencePosition) { //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_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_0018: 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_0025: 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_002d: 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_0036: 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_003c: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<NameableInteractable>()); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<PrefabGUID>()); val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<Immortal>()); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); ((EntityQueryBuilder)(ref val2)).Dispose(); NativeArray<Entity> val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val4.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (current.Has<Translation>()) { NameableInteractable val5 = current.Read<NameableInteractable>(); switch (((object)(FixedString64Bytes)(ref val5.Name)).ToString()) { case "KindredSacrifice_Pyre": ritualElements.Pyre = HandleFoundElement(current, ritualElements.Pyre, referencePosition, "Pyre", Prefabs.TM_Wilderness_Pyre); break; case "KindredSacrifice_Brazier": ritualElements.Brazier = HandleFoundElement(current, ritualElements.Brazier, referencePosition, "Brazier", Prefabs.TM_Castle_ObjectDecor_Gothic_Brazier03_Orange); break; case "KindredSacrifice_Table": ritualElements.Table = HandleFoundElement(current, ritualElements.Table, referencePosition, "Table", Prefabs.TM_Castle_Module_Parent_RoundTable_3x3_Cabal01); break; case "KindredSacrifice_MapIcon": ritualElements.MapIcon = HandleFoundElement(current, ritualElements.MapIcon, referencePosition, "MapIcon", Prefabs.MapIcon_ProxyObject_POI_Unknown); break; } } } val4.Dispose(); ((EntityQuery)(ref val3)).Dispose(); } private Entity HandleFoundElement(Entity entity, Entity currentElement, float3 referencePosition, string elementName, PrefabGUID expectedPrefab) { //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) //IL_0006: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) PrefabGUID val = entity.Read<PrefabGUID>(); bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2; if (((PrefabGUID)(ref val)).GuidHash != ((PrefabGUID)(ref expectedPrefab)).GuidHash) { ManualLogSource log = Core.Log; val2 = new BepInExErrorLogInterpolatedStringHandler(65, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(elementName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" has wrong PrefabGUID ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((PrefabGUID)(ref val)).GuidHash); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" vs expected "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((PrefabGUID)(ref expectedPrefab)).GuidHash); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("). Destroying invalid entity."); } log.LogError(val2); TryDestroyAndClear(entity); return currentElement; } float3 value = entity.Read<Translation>().Value; if (currentElement == Entity.Null) { return entity; } float num = math.distance(currentElement.Has<Translation>() ? currentElement.Read<Translation>().Value : float3.zero, referencePosition); float num2 = math.distance(value, referencePosition); ManualLogSource log2 = Core.Log; val2 = new BepInExErrorLogInterpolatedStringHandler(63, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Multiple "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(elementName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" elements found! Destroying the one further from cage."); } log2.LogError(val2); if (num2 < num) { TryDestroyAndClear(currentElement); return entity; } TryDestroyAndClear(entity); return currentElement; } private bool HasAnyRitualElements() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!(ritualElements.Pyre != Entity.Null) && !(ritualElements.Brazier != Entity.Null) && !(ritualElements.Table != Entity.Null)) { return ritualElements.MapIcon != Entity.Null; } return true; } private void DestroyRitualElements() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ritualElements.Pyre = TryDestroyAndClear(ritualElements.Pyre); ritualElements.Brazier = TryDestroyAndClear(ritualElements.Brazier); ritualElements.Table = TryDestroyAndClear(ritualElements.Table); DestroyMapIcon(ritualElements.MapIcon); ritualElements.MapIcon = Entity.Null; } private Entity SpawnRitualElement(PrefabGUID prefab, float3 position, Rotation rotation, string markerName) { //IL_0005: 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) //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity val = default(Entity); if (!guidToEntityMap.TryGetValue(prefab, ref val)) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Prefab not found! GUID: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((PrefabGUID)(ref prefab)).GuidHash); } log.LogError(val2); return Entity.Null; } EntityManager entityManager = Core.EntityManager; Entity val3 = ((EntityManager)(ref entityManager)).Instantiate(val); val3.Write<Translation>(new Translation { Value = position }); val3.Write<Rotation>(rotation); MakeImmortalAndNonDismantleable(val3, markerName); return val3; } private void EnsureRitualElements(Entity cageEntity, float3 basePosition) { //IL_0000: 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_000a: 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_001c: 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_002c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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) Rotation val2; if (!cageEntity.Has<Rotation>()) { Rotation val = default(Rotation); val.Value = quaternion.identity; val2 = val; } else { val2 = cageEntity.Read<Rotation>(); } Rotation rotation = val2; if (ritualElements.Pyre == Entity.Null) { ritualElements.Pyre = SpawnRitualElement(Prefabs.TM_Wilderness_Pyre, new float3(basePosition.x, basePosition.y + 0.05f, basePosition.z), rotation, "KindredSacrifice_Pyre"); } if (ritualElements.Brazier == Entity.Null) { ritualElements.Brazier = SpawnRitualElement(Prefabs.TM_Castle_ObjectDecor_Gothic_Brazier03_Orange, new float3(basePosition.x, basePosition.y - 0.7f, basePosition.z), rotation, "KindredSacrifice_Brazier"); } if (ritualElements.Table == Entity.Null) { ritualElements.Table = SpawnRitualElement(Prefabs.TM_Castle_Module_Parent_RoundTable_3x3_Cabal01, new float3(basePosition.x, basePosition.y, basePosition.z), rotation, "KindredSacrifice_Table"); } if (ritualElements.MapIcon == Entity.Null) { ritualElements.MapIcon = CreateMapIcon(cageEntity.Read<Translation>().Value); } } public Entity SpawnSacrificeCage(float3 cursorPosition, Entity ownerUserEntity, Entity charEntity) { //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_0018: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_0048: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) try { if (activeCage != null) { throw new Exception("A sacrifice cage already exists! Only one cage can be active at a time. Use '.sac remove' to remove the existing cage first."); } EntityManager entityManager = Core.EntityManager; NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity val = default(Entity); if (!guidToEntityMap.TryGetValue(Prefabs.TM_SpecialStation_PrisonCell, ref val)) { throw new Exception("Prison cell prefab not found!"); } Entity val2 = ((EntityManager)(ref entityManager)).Instantiate(val); float3 val3 = default(float3); ((float3)(ref val3))..ctor(cursorPosition.x, cursorPosition.y + 1.6f, cursorPosition.z); val2.Write<Translation>(new Translation { Value = val3 }); float3 val4 = charEntity.Read<Translation>().Value - cursorPosition; val4.y = 0f; if (math.lengthsq(val4) > 0.001f) { val4 = math.normalize(val4); float num = math.atan2(val4.x, val4.z); if (num < 0f) { num += 2f * math.PI; } TileRotation val5 = (TileRotation)(byte)((int)math.round(num / (math.PI / 2f)) % 4); if (val2.Has<TilePosition>()) { TilePosition componentData = val2.Read<TilePosition>(); componentData.TileRotation = val5; val2.Write<TilePosition>(componentData); } if (val2.Has<StaticTransformCompatible>()) { StaticTransformCompatible componentData2 = val2.Read<StaticTransformCompatible>(); componentData2.NonStaticTransform_Rotation = val5; val2.Write<StaticTransformCompatible>(componentData2); } val2.Write<Rotation>(new Rotation { Value = quaternion.RotateY(math.radians((float)(90 * val5))) }); } MakeImmortalAndNonDismantleable(val2, EncodeCageName(Core.ConfigService.WorldState.AccumulatedBloodPoints)); activeCage = new SacrificeCageData { Entity = val2, Position = val3, OwnerUserEntity = ownerUserEntity, CreatedTime = DateTime.UtcNow }; EnsureRitualElements(val2, cursorPosition); return val2; } catch (Exception e) { Core.LogException(e, "SpawnSacrificeCage"); return Entity.Null; } } public bool IsSacrificeCage(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) if (activeCage != null) { return activeCage.Entity == entity; } return false; } private bool TryGetDayNightCycleEntity(out 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_000d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) entity =