using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.CastleBuilding; using ProjectM.Network; using ProjectM.Scripting; using ProjectM.Shared; using ProjectM.Tiles; using Stunlock.Core; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using UnityEngine; using Uriel.Config; using Uriel.Services; 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("kdpen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Kristopher Penland")] [assembly: AssemblyDescription("Uriel, Lord of Hosts — a host of server-side quality-of-life enhancements and structural fixes for V Rising dedicated servers.")] [assembly: AssemblyFileVersion("0.19.0.0")] [assembly: AssemblyInformationalVersion("0.19.0+47f1964947395f94341b3d5decbaedb9e82465fd")] [assembly: AssemblyProduct("Uriel")] [assembly: AssemblyTitle("Uriel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.19.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] internal sealed class IsUnmanagedAttribute : Attribute { } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Uriel { internal static class Core { private static bool _initInProgress; private static int _initAttempts; public static World Server { get; private set; } public static EntityManager EntityManager { get; private set; } public static PrefabCollectionSystem PrefabCollectionSystem { get; private set; } public static ServerScriptMapper ServerScriptMapper { get; private set; } public static DebugEventsSystem DebugEventsSystem { get; private set; } public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager(); public static PublicStorageService PublicStorage { get; private set; } public static ItemCatalogService ItemCatalog { get; private set; } public static StairSwapService StairSwap { get; private set; } public static ObjectSpawnService ObjectSpawn { get; private set; } public static ObjectConditionsService ObjectConditions { get; private set; } public static PlayerUnlockService PlayerUnlock { get; private set; } public static ManualLogSource Log => Plugin.PluginLog; public static bool IsReady { get; private set; } internal static void TryInitialize(string trigger) { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (IsReady || _initInProgress) { return; } _initInProgress = true; _initAttempts++; bool flag = default(bool); try { World val = FindServerWorld(); BepInExInfoLogInterpolatedStringHandler val2; if (val == null) { if (_initAttempts == 1) { ManualLogSource log = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Uriel init ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(trigger); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("): Server world not yet present; will retry."); } log.LogInfo(val2); } return; } PrefabCollectionSystem existingSystemManaged = val.GetExistingSystemManaged(); if (existingSystemManaged == null || existingSystemManaged.SpawnableNameToPrefabGuidDictionary.Count == 0) { if (_initAttempts == 1) { ManualLogSource log2 = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(68, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Uriel init ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(trigger); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("): PrefabCollectionSystem not yet populated; will retry."); } log2.LogInfo(val2); } return; } Server = val; EntityManager = val.EntityManager; PrefabCollectionSystem = existingSystemManaged; ServerScriptMapper = val.GetExistingSystemManaged(); DebugEventsSystem = val.GetExistingSystemManaged(); Tick.StartDriver(); ItemCatalog = new ItemCatalogService(); ItemCatalog.Build(); StairSwap = new StairSwapService(); PlayerUnlock = new PlayerUnlockService(); PlayerUnlock.Load(); ObjectConditions = new ObjectConditionsService(); ObjectConditions.Load(); ObjectSpawn = new ObjectSpawnService(); ObjectSpawn.Load(); try { ObjectSpawn.ReapplySpawned(); } catch (Exception ex) { ManualLogSource log3 = Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SPAWN] boot re-apply failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log3.LogWarning(val3); } try { ObjectSpawn.StartRespawnLoop(); } catch (Exception ex2) { ManualLogSource log4 = Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SPAWN] respawn loop start failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex2); } log4.LogWarning(val3); } try { ObjectSpawn.StartOrphanSweepLoop(); } catch (Exception ex3) { ManualLogSource log5 = Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SPAWN] orphan sweep start failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex3); } log5.LogWarning(val3); } PublicStorage = new PublicStorageService(); PublicStorage.Load(); try { PublicStorage.ReapplyAll(); } catch (Exception ex4) { ManualLogSource log6 = Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] re-apply failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex4); } log6.LogWarning(val3); } IsReady = true; ManualLogSource log7 = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(60, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Uriel initialized via "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(trigger); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (attempt #"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_initAttempts); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("). Prefab map has "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(existingSystemManaged.SpawnableNameToPrefabGuidDictionary.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" entries."); } log7.LogInfo(val2); } catch (Exception ex5) { ManualLogSource log8 = Log; BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(35, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Uriel init ("); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(trigger); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(") FAILED on attempt #"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(_initAttempts); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex5); } log8.LogError(val4); } finally { _initInProgress = false; } } private static World FindServerWorld() { Enumerator enumerator = World.s_AllWorlds.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (current.Name == "Server") { return current; } } return null; } } internal static class EntityExtensions { public delegate void RefAction(ref T value) where T : unmanaged; public static bool Exists(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; } public static bool Has(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (entity.Exists()) { EntityManager entityManager = Core.EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity); } return false; } public static T Read(this Entity entity) where T : unmanaged { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; return ((EntityManager)(ref entityManager)).GetComponentData(entity); } public static bool TryGetComponent(this Entity entity, out T component) where T : unmanaged { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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_002a: Unknown result type (might be due to invalid IL or missing references) if (entity.Exists()) { EntityManager entityManager = Core.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent(entity)) { entityManager = Core.EntityManager; component = ((EntityManager)(ref entityManager)).GetComponentData(entity); return true; } } component = default(T); return false; } public static void With(this Entity entity, RefAction mutator) where T : unmanaged { //IL_0000: 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_005c: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!entity.Has()) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel] Entity.With<"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(typeof(T).Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">: component missing on "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(entity); } log.LogWarning(val); } else { EntityManager entityManager = Core.EntityManager; T value = ((EntityManager)(ref entityManager)).GetComponentData(entity); mutator(ref value); entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData(entity, value); } } public static void AddOrSet(this Entity entity, T value) where T : unmanaged { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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_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) if (entity.Exists()) { EntityManager entityManager = Core.EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent(entity)) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity); } entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData(entity, value); } } public static void RemoveIfPresent(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (entity.Has()) { EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity); } } public static ulong GetSteamId(this Entity playerCharacter) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (playerCharacter.TryGetComponent(out PlayerCharacter component) && component.UserEntity.TryGetComponent(out User component2)) { return component2.PlatformId; } return 0uL; } public static PrefabGUID GetPrefabGuid(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) if (!entity.TryGetComponent(out PrefabGUID component)) { return default(PrefabGUID); } return component; } public unsafe static bool TryResolvePlayer(string nameOrId, out ulong steamId, out string resolvedName, out string error) { //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) steamId = 0uL; resolvedName = null; error = null; if (string.IsNullOrWhiteSpace(nameOrId)) { error = "Provide a character name or steamId."; return false; } if (ulong.TryParse(nameOrId, out var result) && result > 1000) { steamId = result; resolvedName = result.ToString(); return true; } EntityManager entityManager = Core.EntityManager; EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly() }); NativeArray val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); int num = 0; try { for (int i = 0; i < val2.Length; i++) { if (!val2[i].TryGetComponent(out User component)) { continue; } string text = ((object)(*(FixedString64Bytes*)(&component.CharacterName))/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrEmpty(text) && text.Contains(nameOrId, StringComparison.OrdinalIgnoreCase)) { num++; steamId = component.PlatformId; resolvedName = text; if (string.Equals(text, nameOrId, StringComparison.OrdinalIgnoreCase)) { num = 1; break; } } } } finally { val2.Dispose(); } if (num == 0) { error = "No player matches '" + nameOrId + "'."; return false; } if (num > 1) { error = "'" + nameOrId + "' matches multiple players — be more specific or use the steamId."; steamId = 0uL; return false; } return true; } public static string GetPrefabName(this PrefabGUID prefabGuid) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) try { PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; NativeParallelHashMap guidToEntityMap = prefabLookupMap.GuidToEntityMap; if (guidToEntityMap.ContainsKey(prefabGuid)) { return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid); } } catch { } return $"PrefabGuid({prefabGuid._Value})"; } } [BepInPlugin("kdpen.Uriel", "Uriel", "0.19.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal static Harmony Harmony; internal static ManualLogSource PluginLog; internal static Plugin Instance { get; private set; } public override void Load() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown if (!(Application.productName != "VRisingServer")) { Instance = this; PluginLog = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("kdpen.Uriel"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("0.19.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loading..."); } log.LogInfo(val); Settings.Initialize(((BasePlugin)this).Config); Harmony = new Harmony("kdpen.Uriel"); Harmony.PatchAll(Assembly.GetExecutingAssembly()); int num = Harmony.GetPatchedMethods().Count(); ManualLogSource log2 = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(44, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Harmony patches applied: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" method(s) patched."); } log2.LogInfo(val); CommandRegistry.RegisterAll(); ManualLogSource log3 = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("kdpen.Uriel"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("0.19.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded. Awaiting game data init."); } log3.LogInfo(val); } } public override bool Unload() { CommandRegistry.UnregisterAssembly(); Core.PublicStorage?.SaveSync(); Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "kdpen.Uriel"; public const string PLUGIN_NAME = "Uriel"; public const string PLUGIN_VERSION = "0.19.0"; } } namespace Uriel.Services { internal static class ChatNotify { public static void ToUserEntity(Entity userEntity, string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (userEntity.TryGetComponent(out User component)) { FixedString512Bytes val = default(FixedString512Bytes); ((FixedString512Bytes)(ref val))..ctor(message); ServerChatUtils.SendSystemMessageToClient(Core.EntityManager, component, ref val); } } public static void ToCharacter(Entity characterEntity, string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (characterEntity.TryGetComponent(out PlayerCharacter component)) { ToUserEntity(component.UserEntity, message); } } } internal sealed class ItemCatalogService { private readonly List<(string Name, int Guid)> _items = new List<(string, int)>(); private readonly HashSet _guids = new HashSet(); public int Count => _items.Count; public void Build() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_004a: 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_00b7: Expected O, but got Unknown _items.Clear(); _guids.Clear(); bool flag = default(bool); try { Enumerator enumerator = Core.PrefabCollectionSystem.SpawnableNameToPrefabGuidDictionary.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; string text = current.Key.ToString(); if (text.StartsWith("Item_", StringComparison.OrdinalIgnoreCase)) { int value = current.Value._Value; _items.Add((text, value)); _guids.Add(value); } } _items.Sort(((string Name, int Guid) a, (string Name, int Guid) b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel ITEMS] catalog built: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_items.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" item prefab(s)."); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel ITEMS] catalog build failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } public bool IsKnownItem(int guid) { return _guids.Contains(guid); } public string NameOf(int guid) { foreach (var item in _items) { var (result, _) = item; if (item.Guid == guid) { return result; } } return $"PrefabGuid({guid})"; } public List<(string Name, int Guid)> Search(string fragment, int max, out int totalMatches) { List<(string, int)> list = new List<(string, int)>(); totalMatches = 0; if (string.IsNullOrWhiteSpace(fragment)) { return list; } foreach (var (text, item) in _items) { if (text.Contains(fragment, StringComparison.OrdinalIgnoreCase)) { totalMatches++; if (list.Count < max) { list.Add((text, item)); } } } return list; } } internal sealed class ObjectConditionsService { internal sealed class Cond { public int? MaxPerPlot { get; set; } public int? CostItem { get; set; } public int? CostAmount { get; set; } public bool? PermitIndestructible { get; set; } public bool? PermitRespawn { get; set; } public bool IsEmpty { get { if (!MaxPerPlot.HasValue && !CostItem.HasValue && !CostAmount.HasValue && !PermitIndestructible.HasValue) { return !PermitRespawn.HasValue; } return false; } } } internal readonly struct Effective { public readonly int MaxPerPlot; public readonly bool CostSpecified; public readonly int CostItem; public readonly int CostAmount; public readonly bool PermitIndestructible; public readonly bool PermitRespawn; public Effective(int max, bool costSpec, int costItem, int costAmt, bool permitInd, bool permitResp) { MaxPerPlot = max; CostSpecified = costSpec; CostItem = costItem; CostAmount = costAmt; PermitIndestructible = permitInd; PermitRespawn = permitResp; } } private sealed class SaveFile { public int SchemaVersion { get; set; } = 1; public Cond Global { get; set; } = new Cond(); public Dictionary Objects { get; set; } = new Dictionary(); } private readonly Cond _global = new Cond(); private readonly Dictionary _byGuid = new Dictionary(); private static string SaveDir => Path.Combine(Paths.ConfigPath, "Uriel"); private static string SavePath => Path.Combine(SaveDir, "object_conditions.json"); public bool HasAnyConditions { get { if (_byGuid.Count <= 0) { return !_global.IsEmpty; } return true; } } public void Load() { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePath)) { return; } SaveFile saveFile = JsonSerializer.Deserialize(File.ReadAllText(SavePath)); if (saveFile == null) { return; } CopyInto(saveFile.Global ?? new Cond(), _global); _byGuid.Clear(); if (saveFile.Objects != null) { foreach (KeyValuePair @object in saveFile.Objects) { if (int.TryParse(@object.Key, out var result)) { Cond value = @object.Value; if (value != null && !value.IsEmpty) { _byGuid[result] = value; } } } } if (_byGuid.Count > 0 || !_global.IsEmpty) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(61, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] loaded object conditions: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_byGuid.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" per-object, global "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_global.IsEmpty ? "unset" : "set"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private void SaveSync() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); SaveFile saveFile = new SaveFile { Global = _global }; foreach (KeyValuePair item in _byGuid) { if (!item.Value.IsEmpty) { saveFile.Objects[item.Key.ToString()] = item.Value; } } File.WriteAllText(SavePath, JsonSerializer.Serialize(saveFile, new JsonSerializerOptions { WriteIndented = true })); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private static void CopyInto(Cond src, Cond dst) { dst.MaxPerPlot = src.MaxPerPlot; dst.CostItem = src.CostItem; dst.CostAmount = src.CostAmount; dst.PermitIndestructible = src.PermitIndestructible; dst.PermitRespawn = src.PermitRespawn; } public Effective Resolve(int guid) { _byGuid.TryGetValue(guid, out var value); int max = value?.MaxPerPlot ?? _global.MaxPerPlot.GetValueOrDefault(); Cond obj = ((value?.CostItem).HasValue ? value : (_global.CostItem.HasValue ? _global : null)); bool costSpec = obj != null; int valueOrDefault = (obj?.CostItem).GetValueOrDefault(); int valueOrDefault2 = (obj?.CostAmount).GetValueOrDefault(); bool permitInd = value?.PermitIndestructible ?? _global.PermitIndestructible ?? true; bool permitResp = value?.PermitRespawn ?? _global.PermitRespawn ?? true; return new Effective(max, costSpec, valueOrDefault, valueOrDefault2, permitInd, permitResp); } private Cond LayerFor(int? guid, bool create) { if (!guid.HasValue) { return _global; } if (_byGuid.TryGetValue(guid.Value, out var value)) { return value; } if (!create) { return null; } return _byGuid[guid.Value] = new Cond(); } public void SetMax(int? guid, int? max) { LayerFor(guid, create: true).MaxPerPlot = ((max.HasValue && max.GetValueOrDefault() > 0) ? max : ((int?)null)); Prune(guid); SaveSync(); } public void SetCost(int? guid, int? item, int amount) { Cond cond = LayerFor(guid, create: true); if ((!item.HasValue || item.GetValueOrDefault() == 0) ? true : false) { cond.CostItem = null; cond.CostAmount = null; } else { cond.CostItem = item; cond.CostAmount = Math.Max(0, amount); } Prune(guid); SaveSync(); } public void SetPermitIndestructible(int? guid, bool? permit) { LayerFor(guid, create: true).PermitIndestructible = permit; Prune(guid); SaveSync(); } public void SetPermitRespawn(int? guid, bool? permit) { LayerFor(guid, create: true).PermitRespawn = permit; Prune(guid); SaveSync(); } public void Clear(int? guid) { if (!guid.HasValue) { CopyInto(new Cond(), _global); } else { _byGuid.Remove(guid.Value); } SaveSync(); } private void Prune(int? guid) { if (guid.HasValue && _byGuid.TryGetValue(guid.Value, out var value) && value.IsEmpty) { _byGuid.Remove(guid.Value); } } public string DescribeLayer(int? guid, string label) { Cond cond = LayerFor(guid, create: false); if (cond == null || cond.IsEmpty) { return label + ": no conditions set (uses defaults — unlimited, server cost config, indestructible/respawn allowed)."; } return label + ": " + Render(cond); } private static string Render(Cond c) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int? maxPerPlot = c.MaxPerPlot; if (maxPerPlot.HasValue) { int valueOrDefault = maxPerPlot.GetValueOrDefault(); list.Add($"max {valueOrDefault}/plot"); } maxPerPlot = c.CostItem; if (maxPerPlot.HasValue) { int valueOrDefault2 = maxPerPlot.GetValueOrDefault(); list.Add((valueOrDefault2 == 0) ? "free" : $"cost {c.CostAmount.GetValueOrDefault()}x {EntityExtensions.GetPrefabName(new PrefabGUID(valueOrDefault2))}"); } bool? permitIndestructible = c.PermitIndestructible; if (permitIndestructible.HasValue) { bool valueOrDefault3 = permitIndestructible == true; list.Add("indestructible=" + (valueOrDefault3 ? "allowed" : "denied")); } permitIndestructible = c.PermitRespawn; if (permitIndestructible.HasValue) { bool valueOrDefault4 = permitIndestructible == true; list.Add("respawn=" + (valueOrDefault4 ? "allowed" : "denied")); } if (list.Count != 0) { return string.Join(", ", list); } return "(none)"; } public string DescribeAll() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(8, 1, stringBuilder2); handler.AppendLiteral("Global: "); handler.AppendFormatted(_global.IsEmpty ? "(unset)" : Render(_global)); stringBuilder3.Append(ref handler); if (_byGuid.Count == 0) { stringBuilder.Append("\nNo per-object conditions set."); return stringBuilder.ToString(); } stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder2); handler.AppendLiteral("\nPer-object ("); handler.AppendFormatted(_byGuid.Count); handler.AppendLiteral("):"); stringBuilder4.Append(ref handler); foreach (KeyValuePair item in _byGuid) { string text = $"\n {EntityExtensions.GetPrefabName(new PrefabGUID(item.Key))} ({item.Key}): {Render(item.Value)}"; if (stringBuilder.Length + text.Length > 460) { stringBuilder.Append("\n ...(more — edit object_conditions.json to see all)"); break; } stringBuilder.Append(text); } return stringBuilder.ToString(); } } internal sealed class ObjectSpawnService { internal sealed class SpawnRecord { public int PrefabGuid { get; set; } public int TileX { get; set; } public int TileY { get; set; } public float PosX { get; set; } public float PosY { get; set; } public float PosZ { get; set; } public bool Indestructible { get; set; } public int TerritoryIndex { get; set; } = -1; public bool HasHeart { get; set; } public int HeartTileX { get; set; } public int HeartTileY { get; set; } public ulong SpawnedBySteamId { get; set; } public string SpawnedAtUtc { get; set; } public int PaidCostItem { get; set; } public int PaidCostAmount { get; set; } public int Rot { get; set; } public bool RespawnOnDestroy { get; set; } public bool PlayerBreakable { get; set; } } private sealed class SaveFile { public int SchemaVersion { get; set; } = 3; public List Objects { get; set; } = new List(); } private sealed class LiveIndex { public readonly Dictionary<(int, int, int), Entity> ByTile = new Dictionary<(int, int, int), Entity>(); public readonly Dictionary> ByGuid = new Dictionary>(); public Entity Resolve(SpawnRecord r) { //IL_0026: 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_011c: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b1: 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_00c6: 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_00f1: 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_011a: Unknown result type (might be due to invalid IL or missing references) if (ByTile.TryGetValue((r.PrefabGuid, r.TileX, r.TileY), out var value) && value.Exists()) { return value; } if ((r.PosX != 0f || r.PosY != 0f || r.PosZ != 0f) && ByGuid.TryGetValue(r.PrefabGuid, out var value2)) { Entity val = Entity.Null; float num = 4f; foreach (Entity item in value2) { if (item.TryGetComponent(out Translation component)) { float num2 = component.Value.x - r.PosX; float num3 = component.Value.y - r.PosY; float num4 = component.Value.z - r.PosZ; float num5 = num2 * num2 + num3 * num3 + num4 * num4; if (num5 < num) { num = num5; val = item; } } } if (val != Entity.Null) { return val; } } return Entity.Null; } } private readonly struct CatalogEntry { public readonly string Name; public readonly PrefabGUID Guid; public readonly string Label; public readonly string Cat; public CatalogEntry(string name, PrefabGUID guid, string label, string cat) { //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) Name = name; Guid = guid; Label = label; Cat = cat; } } private sealed class PendingForce { public int Guid; public int TileX; public int TileY; public float PosX; public float PosY; public float PosZ; public string Name; public DateTime ExpiresUtc; } private const int TileGridOffset = 6400; private const float BlockSize = 10f; private readonly List _records = new List(); private readonly HashSet _liveSpawns = new HashSet(); private readonly HashSet _blocked = new HashSet(); private readonly Dictionary> _bossUnlocks = new Dictionary>(); private const float HerePlacementForward = 1.5f; private List _placeable; private HashSet _placeableGuids; private HashSet _discoverableGuids; private Dictionary _byGuid; private static readonly string[] NonObjectPrefixes = new string[8] { "CHAR_", "AB_", "GM_", "Liquid_", "Summon", "USB_", "PrefabVariant", "MicroPOI" }; private static readonly string[] InvisibleMarkerFragments = new string[2] { "InvisibleObject", "IdleInteractionLocation" }; private static bool _dropInInvUsable = true; private static readonly Random _rng = new Random(); private const int DraculaGuid = -327335305; private HashSet _bossRoster; private const int ApiPageSize = 20; private static readonly string[] DebugMarkers = new string[6] { "Debug", "Benchmark", "ArtQuality", "Placeholder", "DELETE", "_TBD" }; private const int ReplyByteBudget = 480; private const float OverlapHeightBand = 2.5f; private readonly Dictionary _pendingForce = new Dictionary(); private static readonly TimeSpan ForceConfirmWindow = TimeSpan.FromSeconds(30.0); private static string SaveDir => Path.Combine(Paths.ConfigPath, "Uriel"); private static string SavePath => Path.Combine(SaveDir, "spawned_objects.json"); private static string SavePathBlocked => Path.Combine(SaveDir, "blocked_prefabs.json"); private static string SavePathBossMap => Path.Combine(SaveDir, "boss_unlocks.json"); public bool TracksKills { get { bool flag = Settings.ObjectSpawn_Enabled.Value && Settings.ObjectSpawn_CollectionEnabled.Value && !Settings.ObjectSpawn_AdminOnly.Value && IsDiscoveryMode(); if (flag) { bool flag2 = Settings.ObjectSpawn_DiscoveryChancePercent.Value > 0 || Settings.ObjectSpawn_BossUnlocksEnabled.Value; if (!flag2) { bool flag3; switch (NonDestructibleMode()) { case "collection": case "finalboss": case "allbosses": flag3 = true; break; default: flag3 = false; break; } flag2 = flag3; } flag = flag2; } return flag; } } public void Load() { LoadRecords(); LoadBlocked(); LoadBossMap(); } private void LoadBossMap() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePathBossMap)) { return; } Dictionary> dictionary = JsonSerializer.Deserialize>>(File.ReadAllText(SavePathBossMap)); if (dictionary == null) { return; } _bossUnlocks.Clear(); foreach (KeyValuePair> item in dictionary) { if (int.TryParse(item.Key, out var result)) { _bossUnlocks[result] = new List(item.Value); } } if (_bossUnlocks.Count > 0) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] loaded boss-unlock map for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_bossUnlocks.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" V-blood(s)."); } log.LogInfo(val); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePathBossMap); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private void SaveBossMap() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); Dictionary> dictionary = new Dictionary>(); foreach (KeyValuePair> bossUnlock in _bossUnlocks) { dictionary[bossUnlock.Key.ToString()] = bossUnlock.Value; } File.WriteAllText(SavePathBossMap, JsonSerializer.Serialize(dictionary, new JsonSerializerOptions { WriteIndented = true })); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePathBossMap); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private void LoadRecords() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePath)) { return; } SaveFile saveFile = JsonSerializer.Deserialize(File.ReadAllText(SavePath)); if (saveFile?.Objects != null) { _records.Clear(); _records.AddRange(saveFile.Objects); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_records.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" spawned-object record(s)."); } log.LogInfo(val); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private void LoadBlocked() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePathBlocked)) { return; } List list = JsonSerializer.Deserialize>(File.ReadAllText(SavePathBlocked)); if (list == null) { return; } _blocked.Clear(); foreach (int item in list) { _blocked.Add(item); } if (_blocked.Count > 0) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_blocked.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" blocked prefab(s)."); } log.LogInfo(val); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePathBlocked); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private void SaveBlocked() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); File.WriteAllText(SavePathBlocked, JsonSerializer.Serialize(new List(_blocked), new JsonSerializerOptions { WriteIndented = true })); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePathBlocked); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private void SaveSync() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); string contents = JsonSerializer.Serialize(new SaveFile { Objects = _records }, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(SavePath, contents); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private void RegisterRecord(Entity e, bool indestructible, int territoryIndex, Entity heart, ulong bySteamId, int paidItem = 0, int paidAmount = 0, int rot = 0, bool respawnOnDestroy = false, bool playerBreakable = false) { //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0076: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0028: Expected O, but got Unknown //IL_012d: 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_010c: 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_011d: 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_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) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) _liveSpawns.Add(e); if (!e.TryGetComponent(out TilePosition component)) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(65, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has no TilePosition; not persisted (session-only)."); } log.LogWarning(val); return; } SpawnRecord spawnRecord = new SpawnRecord { PrefabGuid = e.GetPrefabGuid()._Value, TileX = component.Tile.x, TileY = component.Tile.y, Indestructible = indestructible, TerritoryIndex = territoryIndex, SpawnedBySteamId = bySteamId, SpawnedAtUtc = DateTime.UtcNow.ToString("u"), PaidCostItem = paidItem, PaidCostAmount = paidAmount, Rot = (rot & 3), RespawnOnDestroy = respawnOnDestroy, PlayerBreakable = playerBreakable }; if (e.TryGetComponent(out Translation component2)) { spawnRecord.PosX = component2.Value.x; spawnRecord.PosY = component2.Value.y; spawnRecord.PosZ = component2.Value.z; } if (heart.Exists() && heart.TryGetComponent(out TilePosition component3)) { spawnRecord.HasHeart = true; spawnRecord.HeartTileX = component3.Tile.x; spawnRecord.HeartTileY = component3.Tile.y; } _records.Add(spawnRecord); SaveSync(); } private LiveIndex BuildLiveIndex() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b7: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) LiveIndex liveIndex = new LiveIndex(); EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; if (val5.TryGetComponent(out PrefabGUID component) && val5.TryGetComponent(out TilePosition component2)) { liveIndex.ByTile[(component._Value, component2.Tile.x, component2.Tile.y)] = val5; if (!liveIndex.ByGuid.TryGetValue(component._Value, out var value)) { value = (liveIndex.ByGuid[component._Value] = new List()); } value.Add(val5); } } return liveIndex; } finally { val4.Dispose(); } } private (Entity Entity, SpawnRecord Record) NearestSpawnedRecord(float3 pos, float maxDist) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0092: 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_009e: 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_00c1: Unknown result type (might be due to invalid IL or missing references) if (_records.Count == 0) { return (Entity: Entity.Null, Record: null); } LiveIndex liveIndex = BuildLiveIndex(); float num = maxDist * maxDist; Entity item = Entity.Null; SpawnRecord item2 = null; foreach (SpawnRecord record in _records) { Entity val = liveIndex.Resolve(record); if (!(val == Entity.Null) && val.TryGetComponent(out Translation component)) { float num2 = component.Value.x - pos.x; float num3 = component.Value.y - pos.y; float num4 = component.Value.z - pos.z; float num5 = num2 * num2 + num3 * num3 + num4 * num4; if (num5 < num) { num = num5; item = val; item2 = record; } } } return (Entity: item, Record: item2); } public void ReapplySpawned() { //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_00d2: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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) if (_records.Count == 0) { return; } LiveIndex liveIndex = BuildLiveIndex(); bool value = Settings.ObjectSpawn_PurgeOrphansOnBoot.Value; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; bool flag = false; foreach (SpawnRecord item in new List(_records)) { if (!IsTileModelObject(item.PrefabGuid)) { _records.Remove(item); num4++; flag = true; continue; } Entity val = liveIndex.Resolve(item); if (val == Entity.Null) { num3++; continue; } if (item.PosX == 0f && item.PosY == 0f && item.PosZ == 0f && val.TryGetComponent(out Translation component)) { item.PosX = component.Value.x; item.PosY = component.Value.y; item.PosZ = component.Value.z; flag = true; } if (value && item.HasHeart && !HeartExistsByTile(item.HeartTileX, item.HeartTileY)) { DestroySpawned(val); _records.Remove(item); num2++; flag = true; continue; } _liveSpawns.Add(val); if (item.Indestructible) { val.AddOrSet(new Immortal { IsImmortal = true }); if (val.Has()) { val.With((EntityExtensions.RefAction)delegate(ref CastleDecayAndRegen d) { d.CanDieFromDecay = false; }); } else { val.AddOrSet(new CastleDecayAndRegen { CanDieFromDecay = false }); } } num++; } if (flag) { SaveSync(); } ManualLogSource log = Core.Log; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(155, 4, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] re-applied "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" object(s); "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" orphan(s) purged (castle gone); "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num4); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" now-blocked record(s) dropped; "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num3); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" not resolved this boot (KEPT — may be streaming in)."); } log.LogInfo(val2); } public void StartRespawnLoop() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (!Settings.ObjectSpawn_RespawnEnabled.Value) { return; } if (!Tick.IsRunning) { Core.Log.LogWarning((object)"[Uriel SPAWN] auto-respawn loop NOT started (tick driver unavailable)."); return; } int num = Math.Max(5, Settings.ObjectSpawn_RespawnPollSeconds.Value); Tick.RunRepeating(num * 60, RespawnTick); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] auto-respawn loop started (~"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s cadence)."); } log.LogInfo(val); } private void RespawnTick() { //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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown if (!Settings.ObjectSpawn_RespawnEnabled.Value) { return; } bool flag = false; foreach (SpawnRecord record in _records) { if (record.RespawnOnDestroy) { flag = true; break; } } if (!flag) { return; } LiveIndex liveIndex = BuildLiveIndex(); int num = 0; foreach (SpawnRecord item in new List(_records)) { if (item.RespawnOnDestroy && !(liveIndex.Resolve(item) != Entity.Null) && item.HasHeart && HeartExistsByTile(item.HeartTileX, item.HeartTileY) && TryRespawnRecord(item)) { num++; } } if (num > 0) { ManualLogSource log = Core.Log; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] auto-respawned "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" destroyed object(s)."); } log.LogInfo(val); } } private bool TryRespawnRecord(SpawnRecord r) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006f: 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_0083: 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_0099: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_0103: Expected O, but got Unknown //IL_00c2: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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) bool flag = default(bool); try { float3 val = default(float3); ((float3)(ref val))..ctor(r.PosX, r.PosY, r.PosZ); if (((float3)(ref val)).Equals(default(float3))) { return false; } if (!TryResolvePlot(val, out var heart, out var territoryIndex)) { return false; } NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity val2 = default(Entity); if (!guidToEntityMap.TryGetValue(new PrefabGUID(r.PrefabGuid), ref val2) || !val2.Exists()) { return false; } string adoptNote; Entity val3 = ExecuteSpawn(val2, val, r.Rot, r.Indestructible, heart, out adoptNote, r.PlayerBreakable); if (val3 == Entity.Null) { return false; } if (val3.TryGetComponent(out TilePosition component)) { r.TileX = component.Tile.x; r.TileY = component.Tile.y; } r.TerritoryIndex = territoryIndex; SaveSync(); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(33, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel SPAWN] respawned "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(EntityExtensions.GetPrefabName(new PrefabGUID(r.PrefabGuid))); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" at ("); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.x, "F1"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.y, "F1"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.z, "F1"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(")."); } log.LogInfo(val4); return true; } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(34, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel SPAWN] respawn of "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(EntityExtensions.GetPrefabName(new PrefabGUID(r.PrefabGuid))); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" failed: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(ex.Message); } log2.LogWarning(val5); return false; } } private bool TryResolvePlot(float3 pos, out Entity heart, out int territoryIndex) { //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_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_002a: Unknown result type (might be due to invalid IL or missing references) heart = Entity.Null; territoryIndex = GetTerritoryIndex(pos); if (territoryIndex < 0) { return false; } heart = GetHeartForTerritory(territoryIndex); return heart.Exists(); } private static int2 ConvertPosToBlockCoord(float3 pos) { //IL_0000: 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_004c: Unknown result type (might be due to invalid IL or missing references) int num = (int)math.floor(pos.x * 2f) + 6400; int num2 = (int)math.floor(pos.z * 2f) + 6400; return new int2((int)math.floor((float)num / 10f), (int)math.floor((float)num2 / 10f)); } private static float3 InFrontOf(Entity character, float3 feet) { //IL_0000: 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_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_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_0029: 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_0043: 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_004a: 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_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (character.TryGetComponent(out Rotation component)) { float3 val = math.mul(component.Value, new float3(0f, 0f, 1f)); val.y = 0f; if (math.lengthsq(val) > 0.0001f) { val = math.normalize(val); return new float3(feet.x + val.x * 1.5f, feet.y, feet.z + val.z * 1.5f); } } return feet; } private static int2 ConvertPosToTile(float3 pos) { //IL_0000: 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_0030: Unknown result type (might be due to invalid IL or missing references) return new int2((int)math.floor(pos.x * 2f) + 6400, (int)math.floor(pos.z * 2f) + 6400); } private int GetTerritoryIndex(float3 pos) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_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_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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0061: 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_0071: 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_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a8: 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) int2 val = ConvertPosToBlockCoord(pos); EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3); NativeArray val5 = ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val5.Length; i++) { Entity val6 = val5[i]; if (!val6.TryGetComponent(out CastleTerritory component)) { continue; } entityManager = Core.EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent(val6)) { continue; } entityManager = Core.EntityManager; DynamicBuffer buffer = ((EntityManager)(ref entityManager)).GetBuffer(val6, false); for (int j = 0; j < buffer.Length; j++) { CastleTerritoryBlocks val7 = buffer[j]; if (((int2)(ref val7.BlockCoordinate)).Equals(val)) { return component.CastleTerritoryIndex; } } } } finally { val5.Dispose(); } return -1; } private Entity GetHeartForTerritory(int territoryIndex) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006f: 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_007d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (territoryIndex < 0) { return Entity.Null; } EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; if (val5.TryGetComponent(out CastleHeart component) && component.CastleTerritoryEntity.TryGetComponent(out CastleTerritory component2) && component2.CastleTerritoryIndex == territoryIndex) { return val5; } } } finally { val4.Dispose(); } return Entity.Null; } private static bool OwnsHeart(Entity character, Entity heart) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!heart.TryGetComponent(out Team component)) { return false; } if (!character.TryGetComponent(out Team component2)) { return false; } return component2.Value == component.Value; } private static bool CastleClaimedAndAlive(Entity heart) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0030: Unknown result type (might be due to invalid IL or missing references) if (!heart.Exists()) { return false; } if (heart.TryGetComponent(out CastleHeart component) && component.FuelEndTime - Core.ServerGameManager.ServerTime <= 0.0 && component.FuelQuantity <= 0) { return false; } if (heart.TryGetComponent(out UserOwner component2) && !((NetworkedEntity)(ref component2.Owner)).GetEntityOnServer().Exists()) { return false; } return true; } private static bool HeartExistsByTile(int x, int y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0050: 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_0064: 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_0074: 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_0083: 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(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { if (val4[i].TryGetComponent(out TilePosition component) && component.Tile.x == x && component.Tile.y == y) { return true; } } } finally { val4.Dispose(); } return false; } private bool CheckPlacement(Entity character, bool isAdmin, float3 pos, string verb, out Entity heart, out int territory, out string error) { //IL_0005: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) error = null; if (!TryResolvePlot(pos, out heart, out territory)) { error = "Objects can only be " + verb + " inside a castle plot — stand/aim inside a castle."; return false; } if (!CastleClaimedAndAlive(heart)) { error = "That castle plot has been abandoned or is decaying — objects can't be " + verb + " there."; return false; } if (!isAdmin && !OwnsHeart(character, heart)) { error = "You can only " + verb.Replace("placed", "place").Replace("moved", "move") + " objects in your own castle plot."; return false; } return true; } private void EnsureCatalog() { //IL_003d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0144: 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_0160: Unknown result type (might be due to invalid IL or missing references) if (_placeable != null) { return; } List list = new List(); HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; bool value = Settings.ObjectSpawn_IncludeCastleBuildables.Value; NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Enumerator enumerator = Core.PrefabCollectionSystem.SpawnableNameToPrefabGuidDictionary.GetEnumerator(); Entity val = default(Entity); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; num6++; string name = current.Key.ToString(); if (IsDebugPrefab(name)) { num2++; } else if (_blocked.Contains(current.Value._Value)) { num3++; } else { if (!guidToEntityMap.TryGetValue(current.Value, ref val) || !val.Exists()) { continue; } if (IsSpawnChainController(val)) { num++; } else if (IsNonObject(name, val)) { num4++; } else if (!value && val.Has()) { num5++; } else if (IsPlaceableObject(val)) { list.Add(new CatalogEntry(name, current.Value, SafeToken(Humanize(name)), Categorize(name, val))); hashSet.Add(current.Value._Value); if (IsDiscoverable(val)) { hashSet2.Add(current.Value._Value); } } } } list.Sort((CatalogEntry a, CatalogEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); _placeable = list; _placeableGuids = hashSet; _discoverableGuids = hashSet2; _byGuid = new Dictionary(list.Count); foreach (CatalogEntry item in list) { _byGuid[item.Guid._Value] = item; } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(169, 8, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] object catalog built: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_placeable.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" placeable objects "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_discoverableGuids.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" discoverable by destruction; "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" chains, "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num4); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" units/NPCs, "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num5); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" castle-buildables, "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" debug, "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num3); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" blocked skipped) of "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num6); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" spawnables."); } log.LogInfo(val2); } private static bool IsNonObject(string name, Entity prefab) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0061: 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) string[] nonObjectPrefixes = NonObjectPrefixes; foreach (string value in nonObjectPrefixes) { if (name.StartsWith(value, StringComparison.OrdinalIgnoreCase)) { return true; } } nonObjectPrefixes = InvisibleMarkerFragments; foreach (string value2 in nonObjectPrefixes) { if (name.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } if (!prefab.Has() && !prefab.Has() && !prefab.Has() && !prefab.Has()) { return HasDropInInventoryOnSpawn(prefab); } return true; } private static bool HasDropInInventoryOnSpawn(Entity prefab) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!_dropInInvUsable) { return false; } try { return prefab.Has(); } catch (Exception ex) { _dropInInvUsable = false; Core.Log.LogWarning((object)("[Uriel SPAWN] DropInInventoryOnSpawn check unavailable (" + ex.Message + "); container crash-filter disabled this session (catalog still builds).")); return false; } } private bool IsRealPlaceableObject(int guid) { //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_001e: 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) if (!IsTileModelObject(guid)) { return false; } NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity entity = default(Entity); if (guidToEntityMap.TryGetValue(new PrefabGUID(guid), ref entity)) { return entity.Has(); } return false; } private bool IsTileModelObject(int guid) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003f: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) PrefabGUID val = default(PrefabGUID); ((PrefabGUID)(ref val))..ctor(guid); NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity val2 = default(Entity); if (!guidToEntityMap.TryGetValue(val, ref val2) || !val2.Exists()) { return false; } string prefabName = val.GetPrefabName(); if (IsDebugPrefab(prefabName)) { return false; } if (IsSpawnChainController(val2)) { return false; } if (IsNonObject(prefabName, val2)) { return false; } if (!Settings.ObjectSpawn_IncludeCastleBuildables.Value && val2.Has()) { return false; } return HasTileComponent(val2); } private void PruneStaleUnlocks(ulong steamId) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown int num = Core.PlayerUnlock.PruneUnlocked(steamId, IsRealPlaceableObject); if (num > 0) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(81, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] pruned "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" stale non-object unlock(s) (characters/V Bloods/etc.) for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } } private static bool IsDiscoverable(Entity prefab) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001e: 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) if (!prefab.Has()) { return false; } if (prefab.Has()) { return false; } if (prefab.TryGetComponent(out Immortal component) && component.IsImmortal) { return false; } if (prefab.TryGetComponent(out HealthConstants component2)) { return component2.DestroyOnDeath; } return false; } public bool IsPlaceableGuid(int guid) { EnsureCatalog(); return _placeableGuids.Contains(guid); } public bool IsDiscoverableGuid(int guid) { EnsureCatalog(); return _discoverableGuids.Contains(guid); } private static bool IsDiscoveryMode() { return string.Equals(Settings.ObjectSpawn_PlayerAccessMode.Value?.Trim(), "Discovery", StringComparison.OrdinalIgnoreCase); } private static string NonDestructibleMode() { return Settings.ObjectSpawn_NonDestructibleUnlock.Value?.Trim().ToLowerInvariant() ?? "off"; } private static bool IsVBlood(Entity e) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return e.Has(); } public void HandleKill(Entity killer, Entity died) { //IL_0009: 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_006a: 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_0073: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (!TracksKills) { return; } ulong steamId = killer.GetSteamId(); if (steamId == 0L) { return; } int value = died.GetPrefabGuid()._Value; if (value == 0) { return; } if (Settings.ObjectSpawn_BossUnlocksEnabled.Value && _bossUnlocks.TryGetValue(value, out var value2)) { GrantBossObjects(killer, steamId, value, value2); } string text = NonDestructibleMode(); if ((text == "finalboss" || text == "allbosses") && IsVBlood(died)) { HandleBossCompletion(killer, steamId, value, text); } int value3 = Settings.ObjectSpawn_DiscoveryChancePercent.Value; if (value3 > 0 && IsDiscoverableGuid(value) && !Core.PlayerUnlock.IsUnlocked(steamId, value) && _rng.Next(100) < value3 && Core.PlayerUnlock.Unlock(steamId, value)) { string prefabName = EntityExtensions.GetPrefabName(new PrefabGUID(value)); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] player "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" discovered "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(prefabName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); if (Core.PlayerUnlock.WantsNotify(steamId, Settings.ObjectSpawn_DiscoveryNotify.Value)) { Notify(killer, $"Uriel: you can now build {prefabName}! Use '.uriel spawn {prefabName}'."); } if (text == "collection" && IsDiscoverableComplete(steamId)) { GrantIndestructibles(killer, steamId, "collecting everything"); } } } private void GrantBossObjects(Entity killer, ulong steamId, int vbloodGuid, List objects) { //IL_0044: 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_0060: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (int @object in objects) { if (Core.PlayerUnlock.Unlock(steamId, @object)) { num++; } } if (num != 0) { string prefabName = EntityExtensions.GetPrefabName(new PrefabGUID(vbloodGuid)); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(58, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] player "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" unlocked "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" object(s) from defeating "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(prefabName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); if (Core.PlayerUnlock.WantsNotify(steamId, Settings.ObjectSpawn_DiscoveryNotify.Value)) { Notify(killer, $"Uriel: defeating {prefabName} unlocked {num} new object(s) to build!"); } } } private void HandleBossCompletion(Entity killer, ulong steamId, int vbloodGuid, string mode) { //IL_0017: 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) if (mode == "finalboss") { if (vbloodGuid == -327335305) { GrantIndestructibles(killer, steamId, "defeating Dracula"); } return; } EnsureBossRoster(); if (!_bossRoster.Contains(vbloodGuid)) { return; } Core.PlayerUnlock.RecordBossDefeat(steamId, vbloodGuid); foreach (int item in _bossRoster) { if (!Core.PlayerUnlock.HasDefeatedBoss(steamId, item)) { return; } } GrantIndestructibles(killer, steamId, "defeating every V-blood"); } private bool IsDiscoverableComplete(ulong steamId) { EnsureCatalog(); foreach (int discoverableGuid in _discoverableGuids) { if (!Core.PlayerUnlock.IsUnlocked(steamId, discoverableGuid)) { return false; } } return true; } private void GrantIndestructibles(Entity killer, ulong steamId, string reason) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) EnsureCatalog(); int num = 0; foreach (int placeableGuid in _placeableGuids) { if (!_discoverableGuids.Contains(placeableGuid) && Core.PlayerUnlock.Unlock(steamId, placeableGuid)) { num++; } } if (num != 0) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(64, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] player "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" unlocked "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" non-destructible object(s) via "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); if (Core.PlayerUnlock.WantsNotify(steamId, Settings.ObjectSpawn_DiscoveryNotify.Value)) { Notify(killer, $"Uriel: {reason} unlocked all {num} remaining (non-destructible) objects to build!"); } } } private void EnsureBossRoster() { //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_001e: 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_00c9: Expected O, but got Unknown //IL_0077: 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_008e: 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) if (_bossRoster != null) { return; } HashSet hashSet = new HashSet(); NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Enumerator enumerator = Core.PrefabCollectionSystem.SpawnableNameToPrefabGuidDictionary.GetEnumerator(); Entity entity = default(Entity); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; string text = current.Key.ToString(); if (text.StartsWith("CHAR_", StringComparison.OrdinalIgnoreCase) && text.IndexOf("VBlood", StringComparison.OrdinalIgnoreCase) >= 0 && text.IndexOf("GateBoss", StringComparison.OrdinalIgnoreCase) < 0 && guidToEntityMap.TryGetValue(current.Value, ref entity) && entity.Exists() && entity.Has()) { hashSet.Add(current.Value._Value); } } _bossRoster = hashSet; ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(66, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] V-blood roster for AllBosses unlock: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_bossRoster.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" main boss(es)."); } log.LogInfo(val); } public bool GrantAll(ulong steamId, string mode, out string message) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown EnsureCatalog(); mode = (mode ?? "all").Trim().ToLowerInvariant(); List list = new List(); string text; switch (mode) { case "all": list.AddRange(_placeableGuids); text = "all"; break; case "destructible": case "discoverable": list.AddRange(_discoverableGuids); text = "destructible"; break; case "indestructible": case "nondestructible": case "non-destructible": foreach (int placeableGuid in _placeableGuids) { if (!_discoverableGuids.Contains(placeableGuid)) { list.Add(placeableGuid); } } text = "non-destructible"; break; default: message = "Mode must be: all | destructible | indestructible."; return false; } int num = 0; foreach (int item in list) { if (Core.PlayerUnlock.Unlock(steamId, item)) { num++; } } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] grantall "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" new of "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(list.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); message = $"Granted {text} objects to {steamId}: {num} newly unlocked ({list.Count} in that set)."; return true; } private bool TryResolveAnyPrefab(string input, out int guid, out string name, out string error) { //IL_0042: 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_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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) guid = 0; name = null; error = null; if (string.IsNullOrWhiteSpace(input)) { error = "Give a V-blood name or GUID."; return false; } input = input.Trim(); if (int.TryParse(input, out var result)) { guid = result; name = EntityExtensions.GetPrefabName(new PrefabGUID(result)); return true; } PrefabGUID val = default(PrefabGUID); bool flag = false; List<(string, int)> list = new List<(string, int)>(); Enumerator enumerator = Core.PrefabCollectionSystem.SpawnableNameToPrefabGuidDictionary.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; string text = current.Key.ToString(); if (string.Equals(text, input, StringComparison.OrdinalIgnoreCase)) { val = current.Value; flag = true; break; } if (text.Contains(input, StringComparison.OrdinalIgnoreCase)) { list.Add((text, current.Value._Value)); } } if (flag) { guid = val._Value; name = input; return true; } if (list.Count == 1) { guid = list[0].Item2; name = list[0].Item1; return true; } if (list.Count == 0) { error = "No prefab matches '" + input + "'."; return false; } error = $"'{input}' matches {list.Count} prefabs — be more specific or use the GUID."; return false; } public bool BossMapAdd(string vbloodRef, string objectRef, out string message) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!TryResolveAnyPrefab(vbloodRef, out var guid, out var name, out var error)) { message = error; return false; } if (!TryResolvePrefab(objectRef, out var guid2, out var _, out var resolvedName, out var error2)) { message = error2; return false; } if (!_bossUnlocks.TryGetValue(guid, out var value)) { value = (_bossUnlocks[guid] = new List()); } if (value.Contains(guid2._Value)) { message = resolvedName + " is already mapped to " + name + "."; return false; } value.Add(guid2._Value); SaveBossMap(); message = $"Boss map: defeating {name} now unlocks {resolvedName} ({value.Count} object(s) total)."; return true; } public bool BossMapRemove(string vbloodRef, string objectRef, out string message) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!TryResolveAnyPrefab(vbloodRef, out var guid, out var name, out var error)) { message = error; return false; } int result; PrefabGUID guid2; Entity prefab; string resolvedName; string error2; int item = (int.TryParse(objectRef?.Trim(), out result) ? result : (TryResolvePrefab(objectRef, out guid2, out prefab, out resolvedName, out error2) ? guid2._Value : 0)); if (!_bossUnlocks.TryGetValue(guid, out var value) || !value.Remove(item)) { message = "That object wasn't mapped to " + name + "."; return false; } if (value.Count == 0) { _bossUnlocks.Remove(guid); } SaveBossMap(); message = "Boss map: removed an object from " + name + "."; return true; } public string DescribeBossMap() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (_bossUnlocks.Count == 0) { return "Boss-unlock map is empty. Add with '.uriel bossmap add '."; } StringBuilder stringBuilder = new StringBuilder($"Boss-unlock map ({_bossUnlocks.Count} boss(es)):"); foreach (KeyValuePair> bossUnlock in _bossUnlocks) { string text = $"\n {EntityExtensions.GetPrefabName(new PrefabGUID(bossUnlock.Key))} -> {bossUnlock.Value.Count} object(s)"; if (stringBuilder.Length + text.Length > 440) { stringBuilder.Append("\n ...(more)"); break; } stringBuilder.Append(text); } return Clamp(stringBuilder.ToString()); } public bool GrantUnlock(ulong steamId, string prefabRef, out string message) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!TryResolvePrefab(prefabRef, out var guid, out var _, out var resolvedName, out var error)) { message = error; return false; } bool flag = Core.PlayerUnlock.Unlock(steamId, guid._Value); message = (flag ? $"Granted '{resolvedName}' to {steamId}." : $"{steamId} already had '{resolvedName}' unlocked."); return true; } public bool RevokeUnlock(ulong steamId, string prefabRef, out string message) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!TryResolvePrefab(prefabRef, out var guid, out var _, out var resolvedName, out var error)) { message = error; return false; } bool flag = Core.PlayerUnlock.Revoke(steamId, guid._Value); message = (flag ? $"Revoked '{resolvedName}' from {steamId}." : $"{steamId} did not have '{resolvedName}' unlocked."); return true; } public string DescribeUnlocks(ulong steamId) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) EnsureCatalog(); PruneStaleUnlocks(steamId); IReadOnlyCollection unlocked = Core.PlayerUnlock.GetUnlocked(steamId); int count = _discoverableGuids.Count; int num = 0; foreach (int item in unlocked) { if (_discoverableGuids.Contains(item)) { num++; } } int value = ((count > 0) ? ((int)Math.Round(100.0 * (double)num / (double)count)) : 0); if (unlocked.Count == 0) { return $"No objects unlocked yet — 0% of {count} discoverable. " + "In Discovery mode, destroy world objects for a chance to unlock them."; } List list = new List(); foreach (int item2 in unlocked) { list.Add(EntityExtensions.GetPrefabName(new PrefabGUID(item2))); } list.Sort(StringComparer.OrdinalIgnoreCase); StringBuilder stringBuilder = new StringBuilder($"Unlocked {unlocked.Count} ({num}/{count} discoverable = {value}%):"); foreach (string item3 in list) { string text = "\n " + item3; if (stringBuilder.Length + text.Length > 440) { stringBuilder.Append("\n ...(more — .uriel unlocks shows all)"); break; } stringBuilder.Append(text); } return Clamp(stringBuilder.ToString()); } public string BrowseCatalog(int page) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) EnsureCatalog(); int count = _placeable.Count; int num = Math.Max(1, (count + 6 - 1) / 6); page = Math.Clamp(page, 1, num); StringBuilder stringBuilder = new StringBuilder($"Catalog: {count} placeable ({_discoverableGuids.Count} discoverable), pg {page}/{num}"); for (int i = (page - 1) * 6; i < Math.Min(page * 6, count); i++) { CatalogEntry catalogEntry = _placeable[i]; string text = $"\n {catalogEntry.Name} ({catalogEntry.Guid._Value})"; if (stringBuilder.Length + text.Length > 440) { break; } stringBuilder.Append(text); } if (num > 1 && page < num) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(26, 1, stringBuilder2); handler.AppendLiteral("\n(.uriel catalog "); handler.AppendFormatted(page + 1); handler.AppendLiteral(" -> more)"); stringBuilder2.Append(ref handler); } return Clamp(stringBuilder.ToString()); } public bool IsBlocked(int guid) { return _blocked.Contains(guid); } public bool Block(string prefabRef, out string message) { //IL_0018: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown int num; string text; if (int.TryParse(prefabRef?.Trim(), out var result)) { num = result; text = EntityExtensions.GetPrefabName(new PrefabGUID(result)); } else { if (!TryResolvePrefab(prefabRef, out var guid, out var _, out var resolvedName, out var error)) { message = error; return false; } num = guid._Value; text = resolvedName; } if (!_blocked.Add(num)) { message = $"{text} ({num}) is already blocked."; return false; } SaveBlocked(); _placeable = null; ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] blocked prefab "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")."); } log.LogInfo(val); message = $"Blocked {text} ({num}) — it can no longer be spawned, discovered, or granted."; return true; } public bool Unblock(string prefabRef, out string message) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) int result; PrefabGUID guid; Entity prefab; string resolvedName; string error; int num = (int.TryParse(prefabRef?.Trim(), out result) ? result : (TryResolvePrefab(prefabRef, out guid, out prefab, out resolvedName, out error) ? guid._Value : 0)); if (num == 0) { message = "Give the blocked prefab's GUID (see '.uriel blocklist')."; return false; } if (!_blocked.Remove(num)) { message = $"{num} wasn't blocked."; return false; } SaveBlocked(); _placeable = null; ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] unblocked prefab "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); message = $"Unblocked {EntityExtensions.GetPrefabName(new PrefabGUID(num))} ({num})."; return true; } public string DescribeBlocked() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (_blocked.Count == 0) { return "No prefabs are blocked."; } StringBuilder stringBuilder = new StringBuilder($"{_blocked.Count} blocked prefab(s):"); foreach (int item in _blocked) { string text = $"\n {EntityExtensions.GetPrefabName(new PrefabGUID(item))} ({item})"; if (stringBuilder.Length + text.Length > 440) { stringBuilder.Append("\n ...(more)"); break; } stringBuilder.Append(text); } return Clamp(stringBuilder.ToString()); } public string ApiVersion(int apiVersion) { EnsureCatalog(); return $"[URIEL:version] api={apiVersion} plugin={"0.19.0"} ready=1 objectspawn={Settings.ObjectSpawn_Enabled.Value} adminonly={Settings.ObjectSpawn_AdminOnly.Value} collection={Settings.ObjectSpawn_CollectionEnabled.Value} mode={(IsDiscoveryMode() ? "Discovery" : "Full")} chance={Settings.ObjectSpawn_DiscoveryChancePercent.Value} total={_placeable.Count} discoverable={_discoverableGuids.Count} blocked={_blocked.Count}"; } public List ApiCatalogPage(int page) { //IL_00dc: 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) EnsureCatalog(); int count = _placeable.Count; int num = Math.Max(1, (count + 20 - 1) / 20); page = Math.Clamp(page, 1, num); List list = new List { $"[URIEL:catalog] page={page}/{num} total={count} discoverable={_discoverableGuids.Count}" }; int num2 = 0; for (int i = (page - 1) * 20; i < Math.Min(page * 20, count); i++) { CatalogEntry catalogEntry = _placeable[i]; list.Add($"[URIEL:object] guid={catalogEntry.Guid._Value} disc={_discoverableGuids.Contains(catalogEntry.Guid._Value)} label={catalogEntry.Label} cat={catalogEntry.Cat}"); num2++; } list.Add($"[URIEL:end] cmd=catalog page={page}/{num} count={num2}"); return list; } public List ApiUnlockedPage(ulong steamId, int page) { //IL_019e: Unknown result type (might be due to invalid IL or missing references) EnsureCatalog(); PruneStaleUnlocks(steamId); List list = new List(Core.PlayerUnlock.GetUnlocked(steamId)); list.Sort(); int count = _discoverableGuids.Count; int num = 0; foreach (int item in list) { if (_discoverableGuids.Contains(item)) { num++; } } int value = ((count > 0) ? ((int)Math.Round(100.0 * (double)num / (double)count)) : 0); int count2 = list.Count; int num2 = Math.Max(1, (count2 + 20 - 1) / 20); page = Math.Clamp(page, 1, num2); List list2 = new List { $"[URIEL:unlocked] page={page}/{num2} steam={steamId} n={count2} discoverable={count} pct={value}" }; int num3 = 0; for (int i = (page - 1) * 20; i < Math.Min(page * 20, count2); i++) { int num4 = list[i]; string value3; string value4; int value5; if (_byGuid.TryGetValue(num4, out var value2)) { value3 = value2.Label; value4 = value2.Cat; value5 = (_discoverableGuids.Contains(num4) ? 1 : 0); } else { value3 = SafeToken(Humanize(EntityExtensions.GetPrefabName(new PrefabGUID(num4)))); value4 = "other"; value5 = 0; } list2.Add($"[URIEL:object] guid={num4} disc={value5} label={value3} cat={value4}"); num3++; } list2.Add($"[URIEL:end] cmd=unlocked page={page}/{num2} count={num3}"); return list2; } private static bool HasInventoryItems(Entity character, int itemGuid, int amount) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Entity val = default(Entity); if (!InventoryUtilities.TryGetInventoryEntity(Core.EntityManager, character, ref val, 0)) { return false; } ServerGameManager serverGameManager = Core.ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).GetInventoryItemCount(val, new PrefabGUID(itemGuid)) >= amount; } private static bool ChargeInventory(Entity character, int itemGuid, int amount) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Entity val = default(Entity); if (!InventoryUtilities.TryGetInventoryEntity(Core.EntityManager, character, ref val, 0)) { return false; } ServerGameManager serverGameManager = Core.ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).TryRemoveInventoryItem(val, new PrefabGUID(itemGuid), amount); } private static void RefundInventory(Entity character, int itemGuid, int amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown try { ServerGameManager serverGameManager = Core.ServerGameManager; ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(character, new PrefabGUID(itemGuid), amount); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] refund failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); } } private static void Notify(Entity character, string text) { //IL_0000: 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_0061: Expected O, but got Unknown //IL_000c: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) try { if (character.TryGetComponent(out PlayerCharacter component) && component.UserEntity.TryGetComponent(out User component2)) { FixedString512Bytes val = default(FixedString512Bytes); ((FixedString512Bytes)(ref val))..ctor((text.Length > 500) ? text.Substring(0, 500) : text); ServerChatUtils.SendSystemMessageToClient(Core.EntityManager, component2, ref val); } } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] notify failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } } private static bool IsDebugPrefab(string name) { string[] debugMarkers = DebugMarkers; foreach (string value in debugMarkers) { if (name.Contains(value, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static bool IsSpawnChainController(Entity prefab) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!prefab.Has()) { return prefab.Has(); } return true; } private static bool HasTileComponent(Entity prefab) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!prefab.Has() && !prefab.Has()) { return prefab.Has(); } return true; } private static bool IsPlaceableObject(Entity prefab) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (HasTileComponent(prefab)) { return prefab.Has(); } return false; } private static string DiscoveryHint(string name) { string result = name; int num = 0; string[] array = name.Split('_'); foreach (string text in array) { if (text.Length > num && !int.TryParse(text, out var _)) { result = text; num = text.Length; } } return result; } private static string Humanize(string name) { int num = name.IndexOf('_'); string text = ((num >= 1 && num <= 3) ? name.Substring(num + 1) : name); StringBuilder stringBuilder = new StringBuilder(text.Length + 8); for (int i = 0; i < text.Length; i++) { char c = text[i]; if (c == '_') { stringBuilder.Append(' '); continue; } if (i > 0 && char.IsDigit(c) && char.IsLetter(text[i - 1])) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString().Trim(); } private static string SafeToken(string s) { if (!string.IsNullOrEmpty(s)) { return s.Replace(' ', '_'); } return "-"; } private static string Categorize(string name, Entity prefab) { //IL_0007: 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_023c: Unknown result type (might be due to invalid IL or missing references) string text = name.ToLowerInvariant(); if (prefab.Has()) { return "buildable"; } if (text.Contains("chest") || text.Contains("container") || text.Contains("stash") || prefab.Has()) { return "container"; } if (text.Contains("tree") || text.Contains("plant") || text.Contains("flower") || text.Contains("bush") || text.Contains("shrub") || text.Contains("mushroom")) { return "plant"; } if (text.Contains("rock") || text.Contains("ore") || text.Contains("vein") || text.Contains("stone") || text.Contains("mineral") || text.Contains("crystal") || text.Contains("gem")) { return "ore"; } if (text.Contains("crate") || text.Contains("barrel") || text.Contains("urn") || text.Contains("vase") || text.Contains("pot") || text.Contains("sack") || text.Contains("box") || text.Contains("breakable")) { return "breakable"; } if (text.Contains("chandelier") || text.Contains("candle") || text.Contains("lamp") || text.Contains("torch") || text.Contains("brazier") || text.Contains("lantern") || text.Contains("light")) { return "light"; } if (text.Contains("bench") || text.Contains("chair") || text.Contains("table") || text.Contains("stool") || text.Contains("shelf") || text.Contains("desk") || text.Contains("cabinet") || text.Contains("bed")) { return "furniture"; } if (prefab.Has()) { return "resource"; } return "decor"; } private bool TryResolvePrefab(string input, out PrefabGUID guid, out Entity prefab, out string resolvedName, out string error) { //IL_000e: 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_006b: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) guid = default(PrefabGUID); prefab = Entity.Null; resolvedName = null; error = null; if (string.IsNullOrWhiteSpace(input)) { error = "Give a prefab name or GUID. Try '.uriel findprefab '."; return false; } input = input.Trim(); PrefabLookupMap prefabLookupMap; if (int.TryParse(input, out var result)) { PrefabGUID val = default(PrefabGUID); ((PrefabGUID)(ref val))..ctor(result); prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; Entity val2 = default(Entity); if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(val, ref val2) || !val2.Exists()) { error = $"No prefab with GUID {result}."; return false; } guid = val; prefab = val2; resolvedName = val.GetPrefabName(); return true; } EnsureCatalog(); CatalogEntry catalogEntry = default(CatalogEntry); bool flag = false; List list = new List(); foreach (CatalogEntry item in _placeable) { if (string.Equals(item.Name, input, StringComparison.OrdinalIgnoreCase)) { catalogEntry = item; flag = true; break; } if (item.Name.Contains(input, StringComparison.OrdinalIgnoreCase)) { list.Add(item); } } CatalogEntry catalogEntry2; if (flag) { catalogEntry2 = catalogEntry; } else if (list.Count == 1) { catalogEntry2 = list[0]; } else { if (list.Count == 0) { error = $"No placeable object matches '{input}'. Try '.uriel findprefab {input}'."; return false; } List list2 = list.FindAll((CatalogEntry c) => c.Name.StartsWith(input, StringComparison.OrdinalIgnoreCase)); if (list2.Count != 1) { list.Sort((CatalogEntry a, CatalogEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); StringBuilder stringBuilder = new StringBuilder($"'{input}' matches {list.Count} objects — be more specific:"); for (int num = 0; num < Math.Min(5, list.Count); num++) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(3, 1, stringBuilder2); handler.AppendLiteral("\n "); handler.AppendFormatted(list[num].Name); stringBuilder3.Append(ref handler); } if (list.Count > 5) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(39, 2, stringBuilder2); handler.AppendLiteral("\n ...and "); handler.AppendFormatted(list.Count - 5); handler.AppendLiteral(" more ('.uriel findprefab "); handler.AppendFormatted(input); handler.AppendLiteral("')."); stringBuilder4.Append(ref handler); } error = Clamp(stringBuilder.ToString()); return false; } catalogEntry2 = list2[0]; } guid = catalogEntry2.Guid; resolvedName = catalogEntry2.Name; prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(guid, ref prefab) || !prefab.Exists()) { error = "'" + resolvedName + "' did not resolve to a live prefab."; return false; } return true; } public string FindPrefabs(string fragment, int page = 1) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(fragment)) { return "Usage: .uriel findprefab [page]"; } fragment = fragment.Trim(); if (fragment.Length < 3) { return "Search needs at least 3 characters (shorter fragments match too much noise)."; } EnsureCatalog(); List<(int, string, int)> list = new List<(int, string, int)>(); foreach (CatalogEntry item2 in _placeable) { int num = item2.Name.IndexOf(fragment, StringComparison.OrdinalIgnoreCase); if (num >= 0) { int item = ((!string.Equals(item2.Name, fragment, StringComparison.OrdinalIgnoreCase)) ? ((num == 0) ? 1 : 2) : 0); list.Add((item, item2.Name, item2.Guid._Value)); } } if (list.Count == 0) { return "No placeable object matches '" + fragment + "'."; } list.Sort(((int Rank, string Name, int Guid) a, (int Rank, string Name, int Guid) b) => (a.Rank == b.Rank) ? string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase) : a.Rank.CompareTo(b.Rank)); int num2 = (list.Count + 6 - 1) / 6; page = Math.Clamp(page, 1, num2); StringBuilder stringBuilder = new StringBuilder($"'{fragment}': {list.Count} object(s), pg {page}/{num2}"); for (int num3 = (page - 1) * 6; num3 < Math.Min(page * 6, list.Count); num3++) { string text = $"\n {list[num3].Item2} ({list[num3].Item3})"; if (stringBuilder.Length + text.Length > 440) { break; } stringBuilder.Append(text); } if (num2 > 1 && page < num2) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(30, 2, stringBuilder2); handler.AppendLiteral("\n(.uriel findprefab "); handler.AppendFormatted(fragment); handler.AppendLiteral(" "); handler.AppendFormatted(page + 1); handler.AppendLiteral(" -> more)"); stringBuilder2.Append(ref handler); } return Clamp(stringBuilder.ToString()); } private static string Clamp(string s) { if (s.Length > 480) { return s.Substring(0, 477) + "..."; } return s; } private bool WouldOverlap(float3 pos, Entity ignore, out string blockerName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_009e: 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_00b4: 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_00b8: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00f7: 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_0103: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0163: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) blockerName = null; if (!Settings.ObjectSpawn_PreventOverlap.Value) { return false; } float num = math.max(0f, Settings.ObjectSpawn_OverlapMinDistance.Value); int2 val = ConvertPosToTile(pos); EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3); NativeArray val5 = ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); bool result = false; try { int2 val7 = default(int2); for (int i = 0; i < val5.Length; i++) { Entity val6 = val5[i]; if (val6 == ignore || val6.Has() || val6.Has() || !val6.TryGetComponent(out TilePosition component) || !val6.TryGetComponent(out Translation component2) || math.abs(component2.Value.y - pos.y) > 2.5f) { continue; } int2 tile = component.Tile; int2 tile2 = component.Tile; if (val6.TryGetComponent(out TileBounds component3)) { ((int2)(ref val7))..ctor(math.abs(component3.Value.Max.x - component3.Value.Min.x), math.abs(component3.Value.Max.y - component3.Value.Min.y)); ((int2)(ref tile2))..ctor(component.Tile.x + val7.x, component.Tile.y + val7.y); } bool flag = val.x >= tile.x && val.x <= tile2.x && val.y >= tile.y && val.y <= tile2.y; if (!flag && num > 0f && !val6.Has()) { float num2 = component2.Value.x - pos.x; float num3 = component2.Value.z - pos.z; if (num2 * num2 + num3 * num3 < num * num) { flag = true; } } if (flag) { blockerName = val6.GetPrefabGuid().GetPrefabName(); result = true; break; } } } finally { val5.Dispose(); } return result; } public bool Spawn(Entity character, bool isAdmin, string prefabRef, int rotation, bool? breakable, bool playerBreakable, bool respawn, bool atFeet, bool force, out string message) { //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Expected O, but got Unknown //IL_001a: 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_00dc: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Expected O, but got Unknown //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) if (!TryResolvePrefab(prefabRef, out var guid, out var prefab, out var resolvedName, out var error)) { message = error; return false; } bool flag = false; if (IsSpawnChainController(prefab)) { message = Clamp($"{resolvedName} is a spawn-chain controller, not a placeable object — Uriel can't make it indestructible or stable (edits hit the invisible controller, not what you see). Spawn the real object instead: '.uriel findprefab {DiscoveryHint(resolvedName)}'."); return false; } if (_blocked.Contains(guid._Value)) { message = $"{resolvedName} ({guid._Value}) is blocked by an admin and can't be spawned."; return false; } if (!IsRealPlaceableObject(guid._Value)) { if (!IsTileModelObject(guid._Value)) { if (Core.PlayerUnlock.Revoke(character.GetSteamId(), guid._Value)) { ManualLogSource log = Core.Log; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] removed stale non-object unlock "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(resolvedName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(guid._Value); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } message = resolvedName + " can't be spawned — it's a character, V Blood, ability, or internal prefab, not a placeable world object. (If it was in your unlock list from an older version, it's now been removed.)"; return false; } if (!(isAdmin && force)) { message = Clamp(resolvedName + " is a NON-NETWORKED object — it would spawn INVISIBLE (you'd feel its effect, e.g. an area buff/debuff zone, but not see a model), so it's kept out of the normal catalog. " + (isAdmin ? ("To place it anyway for testing, add 'force': '.uriel spawn " + prefabRef + " force'.") : "Ask an admin to spawn it for testing.")); return false; } flag = true; } float3 val2; EntityAimData component; if (atFeet) { if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { message = "Could not read your position."; return false; } val2 = InFrontOf(character, position); } else if (character.TryGetComponent(out component) && !((float3)(ref component.AimPosition)).Equals(default(float3))) { val2 = component.AimPosition; } else { if (!PublicStorageService.TryGetCharacterPosition(character, out var position2)) { message = "Could not read your position."; return false; } val2 = position2; } if (!CheckPlacement(character, isAdmin, val2, "placed", out var heart, out var territory, out var error2)) { message = error2; return false; } if (WouldOverlap(val2, Entity.Null, out var blockerName)) { message = Clamp($"Can't place {resolvedName} there — it would overlap {blockerName}. Objects can't be placed " + "inside walls, stations, or other spawned objects (only floors may sit under them). Aim at a clear spot. (Admins can disable ObjectSpawn.PreventOverlap to allow stacking.)"); return false; } ObjectConditionsService.Effective effective = Core.ObjectConditions.Resolve(guid._Value); int num = 0; int num2 = 0; if (!isAdmin) { ulong steamId = character.GetSteamId(); if (IsDiscoveryMode() && !Core.PlayerUnlock.IsUnlocked(steamId, guid._Value)) { message = (IsDiscoverableGuid(guid._Value) ? ("You haven't discovered " + resolvedName + " yet — destroy one in the world for a chance to unlock it.") : ("You haven't unlocked " + resolvedName + ", and it isn't destroyable in the world — ask an admin to grant it ('.uriel grant').")); return false; } if (effective.MaxPerPlot > 0) { int num3 = 0; foreach (SpawnRecord record in _records) { if (record.PrefabGuid == guid._Value && record.TerritoryIndex == territory) { num3++; } } if (num3 >= effective.MaxPerPlot) { message = $"You can have at most {effective.MaxPerPlot}x {resolvedName} on this plot ({num3} already placed). Remove one first ('.uriel despawn')."; return false; } } if (effective.CostSpecified) { num = effective.CostItem; num2 = effective.CostAmount; } else { num = Settings.ObjectSpawn_PrefabCostItem.Value; num2 = Settings.ObjectSpawn_PrefabCostStack.Value; } if (num != 0 && num2 > 0 && !HasInventoryItems(character, num, num2)) { message = $"Building {resolvedName} costs {num2}x {EntityExtensions.GetPrefabName(new PrefabGUID(num))} — you don't have enough in your inventory."; return false; } } bool flag3 = !(breakable ?? (!Settings.ObjectSpawn_Indestructible.Value)); if (!isAdmin) { if (flag3 && !effective.PermitIndestructible) { if (breakable == false) { message = resolvedName + " can't be spawned indestructible on this server — try '.uriel spawn " + prefabRef + " breakable'."; return false; } flag3 = false; } if (respawn && !effective.PermitRespawn) { message = resolvedName + " can't be spawned with auto-respawn on this server."; return false; } } if (flag3) { playerBreakable = false; respawn = false; } if (respawn && !Settings.ObjectSpawn_RespawnEnabled.Value) { message = "Auto-respawn is disabled on this server (ObjectSpawn.RespawnEnabled)."; return false; } bool flag4 = default(bool); try { string adoptNote; Entity val3 = ExecuteSpawn(prefab, val2, rotation & 3, flag3, heart, out adoptNote, playerBreakable); if (val3 == Entity.Null) { message = "Failed to spawn " + resolvedName + " (prefab did not resolve)."; return false; } int num4 = 0; int num5 = 0; if (!isAdmin && num != 0 && num2 > 0) { if (!ChargeInventory(character, num, num2)) { DestroyUtility.Destroy(Core.EntityManager, val3, (DestroyDebugReason)0, (string)null, 0); message = "Payment failed — nothing was built."; return false; } num4 = num; num5 = num2; } RegisterRecord(val3, flag3, territory, heart, character.GetSteamId(), num4, num5, rotation & 3, respawn, playerBreakable); ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(85, 13, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(resolvedName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(guid._Value); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") at ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.x, "F1"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.y, "F1"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.z, "F1"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") rot="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(rotation & 3); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" immortal="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(flag3); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" playerBreakable="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(playerBreakable); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" respawn="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(respawn); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" territory="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(territory); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cost="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num5); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num4); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(adoptNote); } log2.LogInfo(val); string value = ((num5 > 0) ? $" Paid {num5}x {EntityExtensions.GetPrefabName(new PrefabGUID(num4))}." : ""); string value2 = (atFeet ? " at your location" : ""); string value3 = (flag3 ? "indestructible" : (playerBreakable ? "breakable by anyone (you included)" : "breakable by raid/decay")); string value4 = (respawn ? " Auto-respawns when destroyed (until the castle is gone or you '.uriel despawn' it)." : ""); string value5 = (flag ? " NOTE: non-networked — it likely renders INVISIBLE; you'll feel its effect but won't see a model. '.uriel despawn' still removes it." : ""); message = $"Spawned {resolvedName}{value2} ({value3}, rot {rotation & 3}).{value}{value4}{value5} {adoptNote} " + "Manage it with '.uriel move' / '.uriel rotate' / '.uriel despawn'."; return true; } catch (Exception ex) { ManualLogSource log3 = Core.Log; BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(32, 2, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel SPAWN] spawn of "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(resolvedName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex); } log3.LogError(val4); message = "Spawn failed unexpectedly — check the server log."; return false; } } private Entity ExecuteSpawn(Entity prefab, float3 pos, int rot, bool indestructible, Entity heart, out string adoptNote, bool playerBreakable = false) { //IL_0007: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_00a3: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_014c: 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_00b1: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) adoptNote = ""; if (!prefab.Exists()) { return Entity.Null; } EntityManager entityManager = Core.EntityManager; Entity val = ((EntityManager)(ref entityManager)).Instantiate(prefab); if (val.Has()) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(val); } ApplyTransform(val, pos, rot); if (heart.Exists() && !playerBreakable) { if (!val.Has()) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponent(val); } val.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) c.CastleHeartEntity = NetworkedEntity.op_Implicit(heart); }); if (heart.TryGetComponent(out Team component)) { val.AddOrSet(component); } if (heart.TryGetComponent(out TeamReference component2)) { val.AddOrSet(component2); } if (heart.TryGetComponent(out UserOwner component3)) { val.AddOrSet(component3); } adoptNote = "Adopted into the castle."; } else if (playerBreakable) { adoptNote = "Placed un-owned so you can break it yourself."; } if (indestructible) { val.AddOrSet(new Immortal { IsImmortal = true }); if (val.Has()) { val.With((EntityExtensions.RefAction)delegate(ref CastleDecayAndRegen d) { d.CanDieFromDecay = false; }); } else { val.AddOrSet(new CastleDecayAndRegen { CanDieFromDecay = false }); } if (val.Has()) { val.With((EntityExtensions.RefAction)delegate(ref HealthConstants hc) { hc.DestroyOnDeath = false; }); } StripAutoDestroyTimers(val); } else { if (val.Has()) { val.With((EntityExtensions.RefAction)delegate(ref Immortal im) { im.IsImmortal = false; }); } if (val.Has()) { val.With((EntityExtensions.RefAction)delegate(ref HealthConstants hc) { hc.DestroyOnDeath = true; }); } StripAutoDestroyTimers(val); } PublicStorageService.ForceResync(val); return val; } private static void StripAutoDestroyTimers(Entity e) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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) EntityManager entityManager; if (e.Has()) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(e); } if (e.Has()) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(e); } } private static void ApplyTransform(Entity e, float3 pos, int rot) { //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_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_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_005d: 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_0077: 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_0091: 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) rot &= 3; TileRotation tileRot = (TileRotation)(byte)rot; quaternion q = quaternion.RotateY(math.radians(90f * (float)rot)); int2 tile = ConvertPosToTile(pos); e.With((EntityExtensions.RefAction)delegate(ref Translation t) { //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) t.Value = pos; }); if (e.Has()) { e.With((EntityExtensions.RefAction)delegate(ref Rotation r) { //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) r.Value = q; }); } if (e.Has()) { e.With((EntityExtensions.RefAction)delegate(ref TilePosition tp) { //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_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) tp.Tile = tile; tp.TileRotation = tileRot; tp.CompressedHeight = 0; }); } if (e.Has()) { e.With((EntityExtensions.RefAction)delegate(ref TileBounds tb) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) tb.Value = new BoundsMinMax { Min = tile, Max = tile }; }); } if (e.Has()) { e.With((EntityExtensions.RefAction)delegate(ref StaticTransformCompatible s) { //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_003b: 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) s.UseStaticTransform = false; s.NonStaticTransform_Pos = new float2(pos.x, pos.z); s.NonStaticTransform_Height = pos.y; s.NonStaticTransform_Rotation = tileRot; }); } } public bool Despawn(Entity character, bool isAdmin, out string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_00e3: 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_0134: Unknown result type (might be due to invalid IL or missing references) if (!TryGetTargetPosition(character, out var pos)) { message = "Could not read your position."; return false; } var (val, spawnRecord) = NearestSpawnedRecord(pos, Settings.ObjectSpawn_MaxTargetDistance.Value); if (val == Entity.Null) { message = $"No Uriel-spawned object within {Settings.ObjectSpawn_MaxTargetDistance.Value:F0}m. " + "(despawn/move/rotate target objects spawned by Uriel; '.uriel purgeplot' clears a whole plot; admins can '.uriel forcedespawn' an untracked object.)"; return false; } if (!isAdmin && !CallerOwnsObject(character, val)) { message = "You can only remove objects in your own castle plot."; return false; } string prefabName = val.GetPrefabGuid().GetPrefabName(); string text = ""; if (spawnRecord != null && Settings.ObjectSpawn_RefundOnRemove.Value && spawnRecord.PaidCostItem != 0 && spawnRecord.PaidCostAmount > 0 && spawnRecord.SpawnedBySteamId == character.GetSteamId()) { RefundInventory(character, spawnRecord.PaidCostItem, spawnRecord.PaidCostAmount); text = $" Refunded {spawnRecord.PaidCostAmount}x {EntityExtensions.GetPrefabName(new PrefabGUID(spawnRecord.PaidCostItem))}."; } if (spawnRecord != null) { _records.Remove(spawnRecord); SaveSync(); } DestroySpawned(val); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] despawned "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(prefabName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } log.LogInfo(val2); message = "Removed " + prefabName + "." + text; return true; } public bool Move(Entity character, bool isAdmin, bool toFeet, out string message) { //IL_0000: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0094: 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_00a7: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00b8: 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_00e7: 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_00f5: 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_0152: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { message = "Could not read your position."; return false; } var (val, old) = NearestSpawnedRecord(position, Settings.ObjectSpawn_MaxTargetDistance.Value); if (val == Entity.Null) { message = $"No Uriel-spawned object within {Settings.ObjectSpawn_MaxTargetDistance.Value:F0}m to move. " + "(Stand near it.)"; return false; } float3 val2; if (toFeet) { val2 = position; } else { if (!character.TryGetComponent(out EntityAimData component) || ((float3)(ref component.AimPosition)).Equals(default(float3))) { message = "Aim where you want it, then run '.uriel move' — or use '.uriel move here' to bring it to your location."; return false; } val2 = component.AimPosition; } if (!CheckPlacement(character, isAdmin, val2, "moved", out var heart, out var territory, out var error)) { message = error; return false; } string prefabName = val.GetPrefabGuid().GetPrefabName(); if (WouldOverlap(val2, val, out var blockerName)) { message = Clamp($"Can't move {prefabName} there — it would overlap {blockerName}. Aim at a clear spot."); return false; } if (!RespawnAt(val, old, val2, CurrentRot(val), heart, territory, out var _, out var error2)) { message = error2; return false; } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(29, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SPAWN] moved "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(prefabName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to ("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.x, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.y, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.z, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(toFeet ? " [at player]" : ""); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("."); } log.LogInfo(val3); message = (toFeet ? ("Moved " + prefabName + " to your location.") : ("Moved " + prefabName + " to your aim point.")); return true; } public bool Rotate(Entity character, bool isAdmin, int? rotation, out string message) { //IL_0000: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0083: 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_009a: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00ea: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown if (!TryGetTargetPosition(character, out var pos)) { message = "Could not read your position."; return false; } var (val, old) = NearestSpawnedRecord(pos, Settings.ObjectSpawn_MaxTargetDistance.Value); if (val == Entity.Null) { message = $"No Uriel-spawned object within {Settings.ObjectSpawn_MaxTargetDistance.Value:F0}m to rotate."; return false; } if (!val.TryGetComponent(out Translation component)) { message = "Object has no position to preserve."; return false; } if (!CheckPlacement(character, isAdmin, component.Value, "moved", out var heart, out var territory, out var error)) { message = error; return false; } int num = (rotation ?? (CurrentRot(val) + 1)) & 3; string prefabName = val.GetPrefabGuid().GetPrefabName(); if (!RespawnAt(val, old, component.Value, num, heart, territory, out var _, out var error2)) { message = error2; return false; } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] rotated "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(prefabName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to rot "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } log.LogInfo(val2); message = $"Rotated {prefabName} to rotation {num}."; return true; } private bool RespawnAt(Entity target, SpawnRecord old, float3 pos, int rot, Entity heart, int territory, out Entity result, out string error) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c5: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) result = Entity.Null; error = null; PrefabGUID prefabGuid = target.GetPrefabGuid(); NativeParallelHashMap guidToEntityMap = Core.PrefabCollectionSystem._PrefabLookupMap.GuidToEntityMap; Entity val = default(Entity); if (!guidToEntityMap.TryGetValue(prefabGuid, ref val) || !val.Exists()) { error = "Could not re-resolve the object's prefab."; return false; } bool playerBreakable = old?.PlayerBreakable ?? false; bool respawnOnDestroy = old?.RespawnOnDestroy ?? false; Immortal component; bool indestructible = old?.Indestructible ?? (target.TryGetComponent(out component) && component.IsImmortal); ulong bySteamId = old?.SpawnedBySteamId ?? 0; int paidItem = old?.PaidCostItem ?? 0; int paidAmount = old?.PaidCostAmount ?? 0; try { if (old != null) { _records.Remove(old); } DestroySpawned(target); string adoptNote; Entity val2 = ExecuteSpawn(val, pos, rot, indestructible, heart, out adoptNote, playerBreakable); if (val2 == Entity.Null) { error = "Re-spawn failed (prefab did not resolve)."; SaveSync(); return false; } RegisterRecord(val2, indestructible, territory, heart, bySteamId, paidItem, paidAmount, rot, respawnOnDestroy, playerBreakable); result = val2; return true; } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SPAWN] move/rotate respawn failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log.LogError(val3); error = "Move/rotate failed unexpectedly — check the server log."; return false; } } private static int CurrentRot(Entity e) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0015: Expected I4, but got Unknown if (!e.TryGetComponent(out TilePosition component)) { return 0; } return component.TileRotation & 3; } public string ListOnPlot(Entity character) { //IL_0006: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { return "Could not read your position."; } if (!TryResolvePlot(position, out var _, out var territory)) { return "You're not standing in a castle plot."; } List list = _records.FindAll((SpawnRecord r) => r.TerritoryIndex == territory); if (list.Count == 0) { return "No Uriel-spawned objects on this plot."; } Dictionary dictionary = new Dictionary(); foreach (SpawnRecord item in list) { string prefabName = EntityExtensions.GetPrefabName(new PrefabGUID(item.PrefabGuid)); dictionary[prefabName] = ((!dictionary.TryGetValue(prefabName, out var value)) ? 1 : (value + 1)); } StringBuilder stringBuilder = new StringBuilder($"{list.Count} Uriel object(s) on this plot:"); foreach (KeyValuePair item2 in dictionary) { string text = $"\n {item2.Value}x {item2.Key}"; if (stringBuilder.Length + text.Length > 420) { stringBuilder.Append("\n ...(more)"); break; } stringBuilder.Append(text); } stringBuilder.Append("\n'.uriel purgeplot' clears them all."); return Clamp(stringBuilder.ToString()); } private (int marker, int tracked) PurgePlotCore(Entity heart, int territory) { //IL_0001: 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) //IL_0032: 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_00ca: 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_00ce: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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) HashSet plotBlocks = GetPlotBlocks(heart); int num = 0; int num2 = 0; if (plotBlocks.Count > 0) { foreach (Entity item in new List(_liveSpawns)) { Translation component; if (!item.Exists()) { _liveSpawns.Remove(item); } else if (item.TryGetComponent(out component) && plotBlocks.Contains(BlockKey(ConvertPosToBlockCoord(component.Value)))) { DestroySpawned(item); num++; } } } LiveIndex liveIndex = BuildLiveIndex(); foreach (SpawnRecord item2 in new List(_records)) { if (item2.TerritoryIndex == territory) { Entity val = liveIndex.Resolve(item2); if (val != Entity.Null && val.Exists()) { DestroySpawned(val); num2++; } _records.Remove(item2); } } SaveSync(); return (marker: num, tracked: num2); } public bool PurgePlot(Entity character, out string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0056: Expected O, but got Unknown if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { message = "Could not read your position."; return false; } if (!TryResolvePlot(position, out var heart, out var territoryIndex)) { message = "You're not standing in a castle plot."; return false; } (int marker, int tracked) tuple = PurgePlotCore(heart, territoryIndex); int item = tuple.marker; int item2 = tuple.tracked; int num = item + item2; ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(68, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] purged "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" object(s) ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" marker + "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" record) from territory "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(territoryIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); message = ((num == 0) ? "No Uriel-spawned objects on this plot to purge. (For one specific untracked object, aim at it and use '.uriel forcedespawn'.)" : $"Purged {num} Uriel-spawned object(s) from this plot. Native objects were left untouched."); return true; } public string DescribeNearest(Entity character) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00cd: 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_0132: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if (!TryGetTargetPosition(character, out var pos)) { return "Could not read your position."; } var (val, spawnRecord) = NearestSpawnedRecord(pos, Settings.ObjectSpawn_MaxTargetDistance.Value); if (val == Entity.Null) { return $"No Uriel-spawned object within {Settings.ObjectSpawn_MaxTargetDistance.Value:F0}m ({_records.Count} persisted). " + "If you spawned it in an older build it may be untracked — admins can '.uriel forcedespawn' it."; } StringBuilder stringBuilder = new StringBuilder($"{val.GetPrefabGuid().GetPrefabName()} ({val.GetPrefabGuid()._Value})"); if (val.TryGetComponent(out Immortal component)) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(12, 1, stringBuilder2); handler.AppendLiteral(" | immortal="); handler.AppendFormatted(component.IsImmortal); stringBuilder3.Append(ref handler); } if (val.TryGetComponent(out CastleDecayAndRegen component2)) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(12, 1, stringBuilder2); handler.AppendLiteral(" | canDecay="); handler.AppendFormatted(component2.CanDieFromDecay); stringBuilder4.Append(ref handler); } if (val.TryGetComponent(out CastleHeartConnection component3)) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 1, stringBuilder2); handler.AppendLiteral(" | heart="); handler.AppendFormatted(((NetworkedEntity)(ref component3.CastleHeartEntity)).GetEntityOnServer().Exists() ? "owned" : "unowned"); stringBuilder5.Append(ref handler); } if (spawnRecord != null) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(8, 1, stringBuilder2); handler.AppendLiteral(" | plot="); handler.AppendFormatted(spawnRecord.TerritoryIndex); stringBuilder6.Append(ref handler); } return Clamp(stringBuilder.ToString()); } private bool CallerOwnsObject(Entity character, Entity obj) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!obj.TryGetComponent(out Translation component)) { return false; } if (!TryResolvePlot(component.Value, out var heart, out var _)) { return false; } return OwnsHeart(character, heart); } private static bool TryGetTargetPosition(Entity character, out float3 pos) { //IL_0000: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) if (character.TryGetComponent(out EntityAimData component) && !((float3)(ref component.AimPosition)).Equals(default(float3))) { pos = component.AimPosition; return true; } return PublicStorageService.TryGetCharacterPosition(character, out pos); } private void DestroySpawned(Entity e) { //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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_0017: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_003e: Expected O, but got Unknown //IL_0085: 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_008b: 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_004e: 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_0065: Unknown result type (might be due to invalid IL or missing references) _liveSpawns.Remove(e); if (!e.Exists()) { return; } bool flag = default(bool); try { if (e.TryGetComponent(out SpawnChainChild component) && component.SpawnChain.Exists()) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(81, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] destroying spawn-chain controller "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(component.SpawnChain); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" that loops "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (stops the respawn)."); } log.LogInfo(val); DestroyUtility.Destroy(Core.EntityManager, component.SpawnChain, (DestroyDebugReason)0, (string)null, 0); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] chain-controller teardown failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log2.LogWarning(val2); } if (e.Exists()) { DestroyUtility.Destroy(Core.EntityManager, e, (DestroyDebugReason)0, (string)null, 0); } } private static long BlockKey(int2 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return ((long)b.x << 32) ^ (uint)b.y; } private HashSet GetPlotBlocks(Entity heart) { //IL_0006: 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_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_0019: 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_002a: 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_003d: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); if (!heart.TryGetComponent(out CastleHeart component)) { return hashSet; } Entity castleTerritoryEntity = component.CastleTerritoryEntity; if (castleTerritoryEntity.Exists()) { EntityManager entityManager = Core.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent(castleTerritoryEntity)) { entityManager = Core.EntityManager; DynamicBuffer buffer = ((EntityManager)(ref entityManager)).GetBuffer(castleTerritoryEntity, false); for (int i = 0; i < buffer.Length; i++) { hashSet.Add(BlockKey(buffer[i].BlockCoordinate)); } return hashSet; } } return hashSet; } private Entity NearestTileObject(float3 pos, float maxDist) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008d: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b4: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) float num = maxDist * maxDist; Entity result = Entity.Null; EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; if (!val5.Has() && val5.TryGetComponent(out Translation component)) { float num2 = component.Value.x - pos.x; float num3 = component.Value.y - pos.y; float num4 = component.Value.z - pos.z; float num5 = num2 * num2 + num3 * num3 + num4 * num4; if (num5 < num) { num = num5; result = val5; } } } return result; } finally { val4.Dispose(); } } public bool ForceDespawn(Entity character, bool confirm, out string message) { //IL_0000: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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_00fe: 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_0102: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown ulong steamId = character.GetSteamId(); if (!TryGetTargetPosition(character, out var pos)) { message = "Could not read your position."; return false; } float value = Settings.ObjectSpawn_MaxTargetDistance.Value; if (confirm) { if (!_pendingForce.TryGetValue(steamId, out var pend) || pend.ExpiresUtc < DateTime.UtcNow) { _pendingForce.Remove(steamId); message = "Nothing armed (or it expired). Run '.uriel forcedespawn' first to target an object."; return false; } _pendingForce.Remove(steamId); Entity val = BuildLiveIndex().Resolve(new SpawnRecord { PrefabGuid = pend.Guid, TileX = pend.TileX, TileY = pend.TileY, PosX = pend.PosX, PosY = pend.PosY, PosZ = pend.PosZ }); if (val == Entity.Null) { message = "The armed " + pend.Name + " is no longer there."; return false; } _records.RemoveAll((SpawnRecord r) => r.PrefabGuid == pend.Guid && r.TileX == pend.TileX && r.TileY == pend.TileY); SaveSync(); DestroySpawned(val); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(56, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] force-despawned "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(pend.Name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(pend.Guid); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") at tile ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(pend.TileX); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(pend.TileY); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") by admin "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(steamId); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } log.LogInfo(val2); message = "Force-removed " + pend.Name + "."; return true; } Entity val3 = NearestTileObject(pos, value); if (val3 == Entity.Null) { message = $"No object within {value:F0}m to force-remove. Aim directly at it and try again."; return false; } string prefabName = val3.GetPrefabGuid().GetPrefabName(); val3.TryGetComponent(out TilePosition component); val3.TryGetComponent(out Translation component2); _pendingForce[steamId] = new PendingForce { Guid = val3.GetPrefabGuid()._Value, TileX = component.Tile.x, TileY = component.Tile.y, PosX = component2.Value.x, PosY = component2.Value.y, PosZ = component2.Value.z, Name = prefabName, ExpiresUtc = DateTime.UtcNow + ForceConfirmWindow }; message = "About to FORCE-REMOVE " + prefabName + " (ignores Uriel ownership; irreversible). Run '.uriel forcedespawn confirm' within 30s to delete it. Re-aim and re-run to retarget."; return true; } public bool ForcePurgePlot(Entity character, out string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0056: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { message = "Could not read your position."; return false; } if (!TryResolvePlot(position, out var heart, out var territoryIndex)) { message = "You're not standing in a castle plot."; return false; } (int marker, int tracked) tuple = PurgePlotCore(heart, territoryIndex); int item = tuple.marker; int item2 = tuple.tracked; int num = item + item2; ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(84, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] force-purged "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" object(s) ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" marker + "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" record) from territory "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(territoryIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by admin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); message = ((num == 0) ? "No Uriel objects found on this plot (nothing native was touched). For one specific untracked object, aim at it and use '.uriel forcedespawn'." : $"Removed {num} Uriel object(s) on this plot ({item} marker + {item2} record). Native objects, plants, trees, and build pieces were left untouched."); return true; } public bool PurgeOrphans(Entity character, out string message) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!PurgeOrphansCore(out var removed, out var loaded, out var unresolved, out var heartCount, out var livingBlockCount)) { message = $"Aborted — couldn't resolve any living castle plots ({heartCount} heart(s) seen). " + "Nothing was removed (safety guard). Try again once castles are loaded."; return false; } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(143, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] server-wide orphan scan by admin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": removed "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(removed); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" orphan(s) of "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(loaded); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded object(s); "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(unresolved); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not loaded (kept). "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(livingBlockCount); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" living plot block(s), "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(heartCount); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" heart(s)."); } log.LogInfo(val); string value = ((unresolved > 0) ? $" {unresolved} object(s) weren't loaded and were skipped — re-run after they load if needed." : ""); message = ((removed == 0) ? $"Orphan scan complete — no orphaned Uriel objects found ({loaded} checked).{value}" : $"Orphan scan complete — removed {removed} orphaned Uriel object(s) (castle gone / no living heart governing them); {loaded} checked. Native objects were never touched.{value}"); return true; } private bool PurgeOrphansCore(out int removed, out int loaded, out int unresolved, out int heartCount, out int livingBlockCount) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0060: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) removed = (loaded = (unresolved = 0)); HashSet hashSet = new HashSet(); EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { heartCount = val4.Length; for (int i = 0; i < val4.Length; i++) { foreach (long plotBlock in GetPlotBlocks(val4[i])) { hashSet.Add(plotBlock); } } } finally { val4.Dispose(); } livingBlockCount = hashSet.Count; if (hashSet.Count == 0) { return false; } LiveIndex liveIndex = BuildLiveIndex(); foreach (SpawnRecord item in new List(_records)) { Entity val5 = liveIndex.Resolve(item); if (val5 == Entity.Null) { unresolved++; continue; } loaded++; Translation component; float3 pos = (float3)(val5.TryGetComponent(out component) ? component.Value : new float3(item.PosX, item.PosY, item.PosZ)); if (!hashSet.Contains(BlockKey(ConvertPosToBlockCoord(pos)))) { DestroySpawned(val5); _records.Remove(item); removed++; } } if (removed > 0) { SaveSync(); } return true; } public void StartOrphanSweepLoop() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown if (!Settings.ObjectSpawn_AutoPurgeOrphans.Value) { return; } if (!Tick.IsRunning) { Core.Log.LogWarning((object)"[Uriel SPAWN] orphan sweep NOT started (tick driver unavailable)."); return; } int num = Math.Max(30, Settings.ObjectSpawn_OrphanPollSeconds.Value); Tick.RunRepeating(num * 60, OrphanSweepTick); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(60, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] mid-session orphan sweep started (~"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s cadence)."); } log.LogInfo(val); } private void OrphanSweepTick() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (Settings.ObjectSpawn_AutoPurgeOrphans.Value && _records.Count != 0 && PurgeOrphansCore(out var removed, out var _, out var _, out var _, out var _) && removed > 0) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(91, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] mid-session orphan sweep removed "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(removed); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" object(s) on abandoned/destroyed castle(s)."); } log.LogInfo(val); } } public bool ConfigureObject(string prefabRef, string field, string v1, string v2, out string message) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!TryResolvePrefab(prefabRef, out var guid, out var _, out var resolvedName, out var error)) { message = error; return false; } return ApplyCondition(guid._Value, resolvedName, field, v1, v2, out message); } public bool ConfigureGlobal(string field, string v1, string v2, out string message) { return ApplyCondition(null, "Global default", field, v1, v2, out message); } public string DescribeAllConditions() { return Clamp(Core.ObjectConditions.DescribeAll()); } private bool ApplyCondition(int? guid, string label, string field, string v1, string v2, out string message) { //IL_02f0: Unknown result type (might be due to invalid IL or missing references) switch (field?.Trim().ToLowerInvariant()) { case "show": case "": case null: message = Core.ObjectConditions.DescribeLayer(guid, label); return true; case "max": case "maxbaseunits": case "maxperplot": { if (!int.TryParse(v1?.Trim(), out var result3)) { message = "Usage: max (0 = unlimited)."; return false; } Core.ObjectConditions.SetMax(guid, result3); message = ((result3 > 0) ? $"{label}: max {result3} per plot." : (label + ": per-plot limit cleared (unlimited).")); return true; } case "cost": { if (!int.TryParse(v1?.Trim(), out var result)) { message = "Usage: cost (amount 0 = free)."; return false; } int result2 = 0; if (result > 0 && (!int.TryParse(v2?.Trim(), out result2) || result2 == 0)) { message = "Usage: cost — give the item's PrefabGUID (e.g. '.uriel finditem ...')."; return false; } Core.ObjectConditions.SetCost(guid, (result > 0) ? new int?(result2) : ((int?)null), result); message = ((result > 0) ? $"{label}: costs {result}x {EntityExtensions.GetPrefabName(new PrefabGUID(result2))} ({result2})." : (label + ": spawning is free (cost cleared).")); return true; } case "indestructible": case "permitindestructible": { if (!TryParseBoolOrClear(v1, out var value2)) { message = "Usage: indestructible ."; return false; } Core.ObjectConditions.SetPermitIndestructible(guid, value2); message = label + ": indestructible " + ((!value2.HasValue) ? "uses default (allowed)" : (value2.Value ? "allowed" : "denied — forced breakable")) + "."; return true; } case "respawn": case "permitrespawn": { if (!TryParseBoolOrClear(v1, out var value)) { message = "Usage: respawn ."; return false; } Core.ObjectConditions.SetPermitRespawn(guid, value); message = label + ": respawn " + ((!value.HasValue) ? "uses default (allowed)" : (value.Value ? "allowed" : "denied")) + "."; return true; } case "clear": case "reset": Core.ObjectConditions.Clear(guid); message = label + ": all conditions cleared (back to defaults)."; return true; default: message = "Fields: max | cost | indestructible | respawn | clear | show."; return false; } } private static bool TryParseBoolOrClear(string s, out bool? value) { value = null; s = s?.Trim().ToLowerInvariant(); switch (s) { case "reset": case "unset": case "clear": case "default": value = null; return true; case "allow": case "allowed": case "true": case "on": case "yes": case "1": value = true; return true; case "false": case "deny": case "no": case "off": case "0": case "denied": value = false; return true; default: return false; } } } internal sealed class PlayerUnlockService { private sealed class SaveFile { public int SchemaVersion { get; set; } = 1; public Dictionary> Unlocks { get; set; } = new Dictionary>(); public Dictionary NotifyPrefs { get; set; } = new Dictionary(); public Dictionary> DefeatedBosses { get; set; } = new Dictionary>(); } private readonly Dictionary> _unlocks = new Dictionary>(); private readonly Dictionary _notifyPref = new Dictionary(); private readonly Dictionary> _defeatedBosses = new Dictionary>(); private static string SaveDir => Path.Combine(Paths.ConfigPath, "Uriel"); private static string SavePath => Path.Combine(SaveDir, "player_unlocks.json"); public void Load() { //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePath)) { return; } SaveFile saveFile = JsonSerializer.Deserialize(File.ReadAllText(SavePath)); if (saveFile?.Unlocks == null) { return; } _unlocks.Clear(); foreach (KeyValuePair> unlock in saveFile.Unlocks) { if (ulong.TryParse(unlock.Key, out var result)) { _unlocks[result] = new HashSet(unlock.Value); } } _notifyPref.Clear(); if (saveFile.NotifyPrefs != null) { foreach (KeyValuePair notifyPref in saveFile.NotifyPrefs) { if (ulong.TryParse(notifyPref.Key, out var result2)) { _notifyPref[result2] = notifyPref.Value; } } } _defeatedBosses.Clear(); if (saveFile.DefeatedBosses != null) { foreach (KeyValuePair> defeatedBoss in saveFile.DefeatedBosses) { if (ulong.TryParse(defeatedBoss.Key, out var result3)) { _defeatedBosses[result3] = new HashSet(defeatedBoss.Value); } } } ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] loaded object unlocks for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_unlocks.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" player(s)."); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SPAWN] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private void SaveSync() { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); SaveFile saveFile = new SaveFile(); foreach (KeyValuePair> unlock in _unlocks) { saveFile.Unlocks[unlock.Key.ToString()] = new List(unlock.Value); } foreach (KeyValuePair item in _notifyPref) { saveFile.NotifyPrefs[item.Key.ToString()] = item.Value; } foreach (KeyValuePair> defeatedBoss in _defeatedBosses) { saveFile.DefeatedBosses[defeatedBoss.Key.ToString()] = new List(defeatedBoss.Value); } File.WriteAllText(SavePath, JsonSerializer.Serialize(saveFile, new JsonSerializerOptions { WriteIndented = true })); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SPAWN] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } public bool IsUnlocked(ulong steamId, int prefabGuid) { if (_unlocks.TryGetValue(steamId, out var value)) { return value.Contains(prefabGuid); } return false; } public bool Unlock(ulong steamId, int prefabGuid) { if (!_unlocks.TryGetValue(steamId, out var value)) { value = (_unlocks[steamId] = new HashSet()); } if (!value.Add(prefabGuid)) { return false; } SaveSync(); return true; } public bool Revoke(ulong steamId, int prefabGuid) { if (!_unlocks.TryGetValue(steamId, out var value) || !value.Remove(prefabGuid)) { return false; } SaveSync(); return true; } public int PruneUnlocked(ulong steamId, Func keep) { if (!_unlocks.TryGetValue(steamId, out var value) || value.Count == 0) { return 0; } int count = value.Count; value.RemoveWhere((int g) => !keep(g)); int num = count - value.Count; if (num > 0) { SaveSync(); } return num; } public IReadOnlyCollection GetUnlocked(ulong steamId) { if (!_unlocks.TryGetValue(steamId, out var value)) { return (IReadOnlyCollection)(object)Array.Empty(); } return value; } public int Count(ulong steamId) { if (!_unlocks.TryGetValue(steamId, out var value)) { return 0; } return value.Count; } public bool WantsNotify(ulong steamId, bool serverDefault) { if (!_notifyPref.TryGetValue(steamId, out var value)) { return serverDefault; } return value; } public bool HasNotifyPref(ulong steamId) { return _notifyPref.ContainsKey(steamId); } public void SetNotify(ulong steamId, bool on) { _notifyPref[steamId] = on; SaveSync(); } public bool HasDefeatedBoss(ulong steamId, int vbloodGuid) { if (_defeatedBosses.TryGetValue(steamId, out var value)) { return value.Contains(vbloodGuid); } return false; } public bool RecordBossDefeat(ulong steamId, int vbloodGuid) { if (!_defeatedBosses.TryGetValue(steamId, out var value)) { value = (_defeatedBosses[steamId] = new HashSet()); } if (!value.Add(vbloodGuid)) { return false; } SaveSync(); return true; } } internal static class PrisonerService { private static readonly PrefabGUID CharmActiveHumanBuff = new PrefabGUID(1303169868); private static readonly PrefabGUID ImprisonedBuffGuid = new PrefabGUID(1603329680); public static bool TakePrisoner(Entity character, Entity userEntity, Entity cell, out string message) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) message = null; if (!cell.TryGetComponent(out PrisonCell component)) { message = "That's not a prison cell."; return false; } Entity entityOnServer = ((NetworkedEntity)(ref component.ImprisonedEntity)).GetEntityOnServer(); if (!entityOnServer.Exists()) { message = "That cell has no prisoner."; return false; } if (!cell.TryGetComponent(out NetworkId component2)) { message = "Cell has no network id (report this)."; return false; } bool flag = default(bool); try { EntityManager entityManager = Core.EntityManager; Entity val = ((EntityManager)(ref entityManager)).CreateEntity(); entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponentData(val, new FromCharacter { User = userEntity, Character = character }); entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponentData(val, new InteractWithPrisonerEvent { Prison = component2, PrisonInteraction = (PrisonInteraction)1 }); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(69, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel PRISON] takeprisoner: vanilla Charm event fired for "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(entityOnServer.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (taker "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")."); } log.LogInfo(val2); } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel PRISON] vanilla charm event failed to create: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log2.LogWarning(val3); } Entity capturedCell = cell; Entity capturedPrisoner = entityOnServer; Entity capturedChar = character; Entity capturedUser = userEntity; Tick.RunLater(20, delegate { //IL_0001: 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_007f: Expected O, but got Unknown //IL_0013: 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_005c: 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_0020: Unknown result type (might be due to invalid IL or missing references) try { if (capturedPrisoner.Exists()) { if (!capturedPrisoner.Has()) { ChatNotify.ToUserEntity(capturedUser, "[Uriel] Prisoner released to you — escort them (Dominating Presence) before the charm wears off!"); Core.Log.LogInfo((object)"[Uriel PRISON] takeprisoner: vanilla path succeeded."); } else { Core.Log.LogInfo((object)"[Uriel PRISON] takeprisoner: vanilla path didn't take — running manual charm fallback."); ManualCharm(capturedChar, capturedUser, capturedCell, capturedPrisoner); } } } catch (Exception ex2) { ManualLogSource log3 = Core.Log; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(52, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel PRISON] takeprisoner verify/fallback failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex2); } log3.LogError(val4); } }); message = "Taking the prisoner… (have Dominating Presence ready to escort them)"; return true; } private static void ManualCharm(Entity character, Entity userEntity, Entity cell, Entity prisoner) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //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_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_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_006a: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_010b: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) try { Entity val = default(Entity); if (BuffUtility.TryGetBuff(Core.EntityManager, prisoner, PrefabIdentifier.op_Implicit(ImprisonedBuffGuid), ref val)) { DestroyUtility.Destroy(Core.EntityManager, val, (DestroyDebugReason)13, (string)null, 0); } } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(44, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel PRISON] ImprisonedBuff strip failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } if (prisoner.Has()) { EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(prisoner); } cell.With((EntityExtensions.RefAction)delegate(ref PrisonCell p) { //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) p.ImprisonedEntity = NetworkedEntity.op_Implicit(Entity.Null); }); if (cell.Has()) { cell.With((EntityExtensions.RefAction)delegate(ref Prisonstation s) { s.HasPrisoner = false; s.IsWorking = false; }); } ApplyBuffDebugEvent val3 = new ApplyBuffDebugEvent { BuffPrefabGUID = CharmActiveHumanBuff }; FromCharacter val4 = new FromCharacter { User = userEntity, Character = prisoner }; Core.DebugEventsSystem.ApplyBuff(val4, val3); Entity capturedPrisoner = prisoner; Entity capturedChar = character; Entity capturedUser = userEntity; Tick.RunLater(5, delegate { //IL_0000: 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_0010: 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: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) try { Entity entity = default(Entity); if (BuffUtility.TryGetBuff(Core.EntityManager, capturedPrisoner, PrefabIdentifier.op_Implicit(CharmActiveHumanBuff), ref entity) && entity.Has()) { entity.With((EntityExtensions.RefAction)delegate(ref EntityOwner eo) { //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) eo.Owner = capturedChar; }); ChatNotify.ToUserEntity(capturedUser, "[Uriel] Prisoner subdued and released to you — escort them home!"); Core.Log.LogInfo((object)"[Uriel PRISON] takeprisoner: manual charm applied."); } else { ChatNotify.ToUserEntity(capturedUser, "[Uriel] The prisoner was released from the cell, but the charm didn't take — they may turn hostile. Tell the admin to check the log."); Core.Log.LogWarning((object)"[Uriel PRISON] manual charm: buff not found on prisoner after apply."); } } catch (Exception ex2) { ManualLogSource log2 = Core.Log; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(46, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel PRISON] manual charm owner fix failed: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(ex2); } log2.LogError(val5); } }); } } internal sealed class PublicStorageService { internal sealed class PublicContainerEntry { public int PrefabGuid { get; set; } public int TileX { get; set; } public int TileY { get; set; } public string ContainerClass { get; set; } = "storage"; public ulong SharedBySteamId { get; set; } public string SharedAtUtc { get; set; } public bool HasHeartTile { get; set; } public int HeartTileX { get; set; } public int HeartTileY { get; set; } public string Permission { get; set; } = "givetake"; public int LimitWithdrawStacks { get; set; } public double LimitHours { get; set; } public int CostItemGuid { get; set; } public int CostAmount { get; set; } public Dictionary Usage { get; set; } = new Dictionary(); public bool HasRestrictions { get { if (!(Permission != "givetake") && LimitWithdrawStacks <= 0 && !(LimitHours > 0.0)) { return CostItemGuid != 0; } return true; } } } internal sealed class UsageRecord { public string WindowStartUtc { get; set; } public int StacksTaken { get; set; } } internal sealed class PayChestRef { public int PrefabGuid { get; set; } public int TileX { get; set; } public int TileY { get; set; } } private sealed class SaveFile { public int SchemaVersion { get; set; } = 2; public List Entries { get; set; } = new List(); public Dictionary PayChests { get; set; } = new Dictionary(); } private readonly List _entries = new List(); private readonly Dictionary _payChests = new Dictionary(); private static readonly int[] WorldChestGuids = new int[10] { -375592800, 240964190, -273515249, 257686919, -321007732, -1657744516, -241680783, -1576310588, 866003444, -1203166929 }; private bool _donorResolved; private Team _donorTeam; private Entity _donorTeamRefEntity; private Entity _neutralTeamEntity; private static string SaveDir => Path.Combine(Paths.ConfigPath, "Uriel"); private static string SavePath => Path.Combine(SaveDir, "public_containers.json"); public IReadOnlyList Entries => _entries; public void Load() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown bool flag = default(bool); try { if (!File.Exists(SavePath)) { return; } SaveFile saveFile = JsonSerializer.Deserialize(File.ReadAllText(SavePath)); if (saveFile?.Entries == null) { return; } _entries.Clear(); _entries.AddRange(saveFile.Entries); _payChests.Clear(); if (saveFile.PayChests != null) { foreach (KeyValuePair payChest in saveFile.PayChests) { _payChests[payChest.Key] = payChest.Value; } } ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(65, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_entries.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" public-container entry(ies), "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_payChests.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" pay chest(s)."); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SHARE] failed loading "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } public void SaveSync() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown try { Directory.CreateDirectory(SaveDir); string contents = JsonSerializer.Serialize(new SaveFile { Entries = _entries, PayChests = new Dictionary(_payChests) }, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(SavePath, contents); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] failed saving "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SavePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } public Entity ResolveTargetContainer(Entity character, out string error, bool nearestToPlayer = false) { //IL_0037: 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_004e: 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_0055: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) error = null; float value = Settings.PublicStorage_MaxTargetDistance.Value; if (!nearestToPlayer && character.TryGetComponent(out EntityAimData component)) { Entity val = ClosestContainerTo(component.AimPosition, value); if (val != Entity.Null) { return val; } } if (!TryGetCharacterPosition(character, out var position)) { error = "Could not read your position."; return Entity.Null; } Entity val2 = ClosestContainerTo(position, value); if (val2 == Entity.Null) { error = $"No castle container found within {value:F0}m of you. Stand next to it (or aim at it)."; } return val2; } internal static bool TryGetCharacterPosition(Entity character, out float3 position) { //IL_0000: 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_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_0032: 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) if (character.TryGetComponent(out LocalToWorld component)) { position = ((LocalToWorld)(ref component)).Position; return true; } if (character.TryGetComponent(out Translation component2)) { position = component2.Value; return true; } position = default(float3); return false; } private static Entity ClosestContainerTo(float3 refPos, float maxDist) { //IL_0004: 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_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_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_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_003b: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0068: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0092: 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_00a6: 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_00d3: Unknown result type (might be due to invalid IL or missing references) float num = maxDist * maxDist; EntityManager entityManager = Core.EntityManager; EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[3] { ComponentType.ReadOnly(), ComponentType.ReadOnly(), ComponentType.ReadOnly() }); NativeArray val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Entity result = Entity.Null; float num2 = float.MaxValue; for (int i = 0; i < val2.Length; i++) { Entity val3 = val2[i]; if (val3.Has() && val3.TryGetComponent(out Translation component)) { float3 value = component.Value; float num3 = value.x - refPos.x; float num4 = value.y - refPos.y; float num5 = value.z - refPos.z; float num6 = num3 * num3 + num4 * num4 + num5 * num5; if (num6 < num2 && num6 <= num) { num2 = num6; result = val3; } } } return result; } finally { val2.Dispose(); } } public static string ClassifyContainer(Entity container) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (container.Has()) { return "prison"; } if (container.Has()) { return "coffin"; } return "storage"; } private bool TryResolveDonorTeam() { //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_003b: 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_004e: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //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_0093: 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_009d: 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_001b: 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_00bb: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) if (_donorResolved && (_donorTeamRefEntity == Entity.Null || _donorTeamRefEntity.Exists())) { return true; } _donorResolved = false; EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { HashSet hashSet = new HashSet(WorldChestGuids); bool flag = default(bool); for (int i = 0; i < val4.Length; i++) { Entity entity = val4[i]; if (entity.TryGetComponent(out PrefabGUID component) && hashSet.Contains(component._Value) && entity.TryGetComponent(out Team component2) && entity.TryGetComponent(out TeamReference component3)) { _donorTeam = component2; _donorTeamRefEntity = component3.Value._Value; _donorResolved = true; ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(60, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel SHARE] neutral-team donor: live "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(component.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" (Team.Value="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(component2.Value); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", ref="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(_donorTeamRefEntity); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(")."); } log.LogInfo(val5); return true; } } } finally { val4.Dispose(); } int[] worldChestGuids = WorldChestGuids; PrefabGUID val6 = default(PrefabGUID); Entity entity2 = default(Entity); bool flag2 = default(bool); foreach (int num in worldChestGuids) { ((PrefabGUID)(ref val6))..ctor(num); PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; if (((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(val6, ref entity2) && entity2.TryGetComponent(out Team component4) && entity2.TryGetComponent(out TeamReference component5)) { _donorTeam = component4; _donorTeamRefEntity = component5.Value._Value; _donorResolved = true; ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(62, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel SHARE] neutral-team donor: PREFAB "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val6.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" (Team.Value="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(component4.Value); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", ref="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(_donorTeamRefEntity); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(")."); } log2.LogInfo(val5); return true; } } Core.Log.LogWarning((object)"[Uriel SHARE] no world chest found (live or prefab) to donate a neutral team — sharing unavailable this session."); return false; } private bool TryResolveNeutralTeamEntity(out Entity neutralTeam) { //IL_0001: 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_0021: 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_003a: 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_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_009a: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (_neutralTeamEntity.Exists()) { neutralTeam = _neutralTeamEntity; return true; } neutralTeam = Entity.Null; EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { bool flag = default(bool); for (int i = 0; i < val4.Length; i++) { if (!val4[i].Has()) { continue; } _neutralTeamEntity = val4[i]; neutralTeam = val4[i]; if (Settings.VerboseLogging.Value) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel SHARE] NeutralTeam singleton resolved: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val4[i]); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("."); } log.LogInfo(val5); } return true; } } finally { val4.Dispose(); } return false; } public bool CanResolvePublicTeam() { if (!TryResolveNeutralTeamEntity(out var _)) { return TryResolveDonorTeam(); } return true; } private bool TryGetPublicTeam(out int teamValue, out int factionIndex, out Entity teamRefEntity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_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) if (TryResolveNeutralTeamEntity(out var neutralTeam) && neutralTeam.TryGetComponent(out TeamData component)) { teamValue = component.TeamValue; factionIndex = -1; teamRefEntity = neutralTeam; return true; } if (TryResolveDonorTeam()) { teamValue = _donorTeam.Value; factionIndex = _donorTeam.FactionIndex; teamRefEntity = _donorTeamRefEntity; return true; } teamValue = 0; factionIndex = 0; teamRefEntity = Entity.Null; return false; } internal static void ForceResync(Entity entity) { //IL_0000: 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: Expected O, but got Unknown //IL_0008: 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_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_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_008f: 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) if (entity.Has()) { entity.With((EntityExtensions.RefAction)delegate(ref UpToDateUserBitMask m) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) m.Value = default(UserBitMask128); }); } bool flag = default(bool); try { if (entity.Has()) { return; } EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity); Entity captured = entity; Tick.RunLater(3, delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: Unknown result type (might be due to invalid IL or missing references) if (captured.Exists() && captured.Has()) { EntityManager entityManager2 = Core.EntityManager; ((EntityManager)(ref entityManager2)).RemoveComponent(captured); } }); if (Settings.VerboseLogging.Value) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] resync blink: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(entity.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SHARE] resync blink failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log2.LogWarning(val2); } } private void CaptureHeartAnchor(Entity container, PublicContainerEntry entry) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (container.TryGetComponent(out CastleHeartConnection component)) { Entity entityOnServer = ((NetworkedEntity)(ref component.CastleHeartEntity)).GetEntityOnServer(); if (entityOnServer.Exists() && entityOnServer.TryGetComponent(out TilePosition component2)) { entry.HasHeartTile = true; entry.HeartTileX = component2.Tile.x; entry.HeartTileY = component2.Tile.y; } } } private void ApplyPublicTeam(Entity container, PublicContainerEntry entry) { //IL_0007: 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_0028: 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_0079: 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_00d2: 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_0090: 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_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_00cc: 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) CaptureHeartAnchor(container, entry); if (TryGetPublicTeam(out var teamValue, out var factionIndex, out var teamRefEntity)) { container.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = teamValue; t.FactionIndex = factionIndex; }); container.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = teamRefEntity; }); } if (container.Has()) { container.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection c) { //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) c.CastleHeartEntity = NetworkedEntity.op_Implicit(Entity.Null); }); } if (container.TryGetComponent(out PrisonCell component)) { Entity entityOnServer = ((NetworkedEntity)(ref component.ImprisonedEntity)).GetEntityOnServer(); if (entityOnServer.Exists() && entityOnServer.Has()) { entityOnServer.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = teamValue; t.FactionIndex = factionIndex; }); if (entityOnServer.Has()) { entityOnServer.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = teamRefEntity; }); } ForceResync(entityOnServer); } } ForceResync(container); } private Entity ResolveHeartFor(Entity container, PublicContainerEntry entry) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0038: Unknown result type (might be due to invalid IL or missing references) if (container.TryGetComponent(out CastleHeartConnection component)) { Entity entityOnServer = ((NetworkedEntity)(ref component.CastleHeartEntity)).GetEntityOnServer(); if (entityOnServer.Exists()) { return entityOnServer; } } if (entry != null && entry.HasHeartTile) { return FindHeartByTile(entry.HeartTileX, entry.HeartTileY); } return Entity.Null; } private static Entity FindHeartByTile(int x, int y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0050: 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_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_0083: 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_00be: 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(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { if (val4[i].TryGetComponent(out TilePosition component) && component.Tile.x == x && component.Tile.y == y) { return val4[i]; } } } finally { val4.Dispose(); } return Entity.Null; } public bool IsController(Entity character, Entity container, PublicContainerEntry entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!ResolveHeartFor(container, entry).TryGetComponent(out Team component)) { return false; } if (!character.TryGetComponent(out Team component2)) { return false; } return component2.Value == component.Value; } private bool RestoreToPrivate(Entity container, PublicContainerEntry entry, out string error) { //IL_001e: 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 (entry.ContainerClass == "storage") { return RebuildContainer(container, entry, makePublic: false, out error); } return RestoreCastleTeam(container, entry, out error); } private bool RestoreCastleTeam(Entity container, PublicContainerEntry entry, out string error) { //IL_000b: 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_0018: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0035: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008c: 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_009b: 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_00bf: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_00e0: 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_00fc: 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_0105: Unknown result type (might be due to invalid IL or missing references) error = null; Entity heart = ResolveHeartFor(container, entry); if (!heart.Exists()) { error = "Castle heart not found (was the castle destroyed?); cannot restore."; return false; } if (container.Has()) { container.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) c.CastleHeartEntity = NetworkedEntity.op_Implicit(heart); }); } Entity val = FindSiblingTeamDonor(container, heart); if (val == Entity.Null) { val = heart; } if (!val.TryGetComponent(out Team donorTeam) || !val.TryGetComponent(out TeamReference component)) { error = "No team source found to restore from; cannot restore."; return false; } Entity refEntity = component.Value._Value; container.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = donorTeam.Value; t.FactionIndex = donorTeam.FactionIndex; }); container.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = refEntity; }); if (container.TryGetComponent(out PrisonCell component2)) { Entity entityOnServer = ((NetworkedEntity)(ref component2.ImprisonedEntity)).GetEntityOnServer(); if (entityOnServer.Exists() && entityOnServer.Has()) { entityOnServer.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = donorTeam.Value; t.FactionIndex = donorTeam.FactionIndex; }); if (entityOnServer.Has()) { entityOnServer.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = refEntity; }); } ForceResync(entityOnServer); } } ForceResync(container); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(81, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SHARE] unshare: reconnected heart + restored team on "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(container.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted((val == heart) ? "castle heart" : "sibling container"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Team.Value="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(donorTeam.Value); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")."); } log.LogInfo(val2); return true; } private Entity FindSiblingTeamDonor(Entity container, Entity heart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003a: 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_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0088: 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_009a: 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_00a8: 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_00ba: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; if (!(val5 == container) && val5.TryGetComponent(out CastleHeartConnection component) && !(((NetworkedEntity)(ref component.CastleHeartEntity)).GetEntityOnServer() != heart) && FindEntry(val5) == null && val5.Has() && val5.Has()) { return val5; } } } finally { val4.Dispose(); } return Entity.Null; } public static bool CharacterControlsContainer(Entity character, Entity container) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!container.TryGetComponent(out CastleHeartConnection component)) { return false; } if (!((NetworkedEntity)(ref component.CastleHeartEntity)).GetEntityOnServer().TryGetComponent(out Team component2)) { return false; } if (!character.TryGetComponent(out Team component3)) { return false; } return component3.Value == component2.Value; } private PublicContainerEntry FindEntry(Entity container) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (!container.TryGetComponent(out TilePosition component)) { return null; } int value = container.GetPrefabGuid()._Value; foreach (PublicContainerEntry entry in _entries) { if (entry.PrefabGuid == value && entry.TileX == component.Tile.x && entry.TileY == component.Tile.y) { return entry; } } return null; } public bool IsShared(Entity container) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return FindEntry(container) != null; } public bool Share(Entity character, Entity container, out string message, bool isAdmin = false) { //IL_0000: 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_0043: 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_0078: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0161: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) string text = ClassifyContainer(container); if (text == "prison" && !Settings.PublicPrison_Enabled.Value) { message = "Prison-cell sharing is disabled by the server admin (PublicStorage.PrisonEnabled)."; return false; } if (text == "coffin") { message = "Servant coffins can't be shared."; return false; } if (!isAdmin && !CharacterControlsContainer(character, container)) { message = "You don't control this container (its castle isn't yours/your clan's)."; return false; } if (FindEntry(container) != null) { message = "That container is already public."; return false; } if (!CanResolvePublicTeam()) { message = "Sharing unavailable: no neutral team source found on this map (see server log)."; return false; } if (!container.TryGetComponent(out TilePosition component)) { message = "Container has no tile position; cannot register it."; return false; } PublicContainerEntry publicContainerEntry = new PublicContainerEntry { PrefabGuid = container.GetPrefabGuid()._Value, TileX = component.Tile.x, TileY = component.Tile.y, ContainerClass = text, SharedBySteamId = character.GetSteamId(), SharedAtUtc = DateTime.UtcNow.ToString("u") }; CaptureHeartAnchor(container, publicContainerEntry); if (text == "storage") { if (!RebuildContainer(container, publicContainerEntry, makePublic: true, out var error)) { message = "Sharing failed: " + error; return false; } } else { ApplyPublicTeam(container, publicContainerEntry); } _entries.Add(publicContainerEntry); SaveSync(); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] shared "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(container.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" at ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(component.Tile.x); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(component.Tile.y); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") class="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); message = ((text == "prison") ? (container.GetPrefabGuid().GetPrefabName() + " is now PUBLIC — anyone can tend the prisoner (feed, extract blood) or charm them out as their own subdued follower. '.uriel unshare' to revert.") : (container.GetPrefabGuid().GetPrefabName() + " is now PUBLIC — anyone on the server can use it. Aim at it and use '.uriel unshare' to revert.")); return true; } public bool Unshare(Entity character, Entity container, bool isAdmin, out string message) { //IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0023: Unknown result type (might be due to invalid IL or missing references) PublicContainerEntry publicContainerEntry = FindEntry(container); if (publicContainerEntry == null) { message = "That container isn't currently public."; return false; } if (!isAdmin && !IsController(character, container, publicContainerEntry) && character.GetSteamId() != publicContainerEntry.SharedBySteamId) { message = "Only the container's controllers (or the original sharer / an admin) can unshare it."; return false; } if (!RestoreToPrivate(container, publicContainerEntry, out var error)) { message = "Could not restore the container: " + error; return false; } _entries.Remove(publicContainerEntry); SaveSync(); message = container.GetPrefabGuid().GetPrefabName() + " is private again."; return true; } public (int Restored, int Purged) UnshareMine(Entity character) { //IL_0000: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005f: 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_0082: Unknown result type (might be due to invalid IL or missing references) ulong steamId = character.GetSteamId(); int num = 0; int num2 = 0; foreach (PublicContainerEntry item in new List(_entries)) { Entity val = ResolveEntry(item); if (item.SharedBySteamId != steamId && (!(val != Entity.Null) || !IsController(character, val, item))) { continue; } if (val == Entity.Null) { _entries.Remove(item); num2++; continue; } if (RestoreToPrivate(val, item, out var _)) { num++; } _entries.Remove(item); } SaveSync(); return (Restored: num, Purged: num2); } public (int Restored, int Purged) UnshareBySteamId(ulong steamId) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; foreach (PublicContainerEntry item in new List(_entries)) { if (item.SharedBySteamId != steamId) { continue; } Entity val = ResolveEntry(item); if (val == Entity.Null) { _entries.Remove(item); num2++; continue; } if (RestoreToPrivate(val, item, out var _)) { num++; } _entries.Remove(item); } SaveSync(); return (Restored: num, Purged: num2); } public string DescribeEntry(PublicContainerEntry e) { //IL_001c: 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) StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 5, stringBuilder2); handler.AppendFormatted(EntityExtensions.GetPrefabName(new PrefabGUID(e.PrefabGuid))); handler.AppendLiteral(" @("); handler.AppendFormatted(e.TileX); handler.AppendLiteral(","); handler.AppendFormatted(e.TileY); handler.AppendLiteral(") ["); handler.AppendFormatted(e.ContainerClass); handler.AppendLiteral("] "); handler.AppendFormatted(e.Permission); stringBuilder3.Append(ref handler); if (e.LimitWithdrawStacks > 0) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(10, 2, stringBuilder2); handler.AppendLiteral(", limit "); handler.AppendFormatted(e.LimitWithdrawStacks); handler.AppendLiteral("/"); handler.AppendFormatted((e.LimitHours > 0.0) ? e.LimitHours : 24.0, "0.#"); handler.AppendLiteral("h"); stringBuilder4.Append(ref handler); } if (e.CostItemGuid != 0) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(9, 2, stringBuilder2); handler.AppendLiteral(", cost "); handler.AppendFormatted(e.CostAmount); handler.AppendLiteral("× "); handler.AppendFormatted(EntityExtensions.GetPrefabName(new PrefabGUID(e.CostItemGuid))); stringBuilder5.Append(ref handler); } return stringBuilder.ToString(); } public int UnshareAll(out int unresolved) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) unresolved = 0; int num = 0; foreach (PublicContainerEntry item in new List(_entries)) { Entity val = ResolveEntry(item); if (val == Entity.Null) { unresolved++; _entries.Remove(item); continue; } if (RestoreToPrivate(val, item, out var _)) { num++; } _entries.Remove(item); } SaveSync(); return num; } private Entity ResolveEntry(PublicContainerEntry entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003a: 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_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00ec: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; if (val5.TryGetComponent(out PrefabGUID component) && component._Value == entry.PrefabGuid && val5.TryGetComponent(out TilePosition component2) && component2.Tile.x == entry.TileX && component2.Tile.y == entry.TileY) { return val5; } } } finally { val4.Dispose(); } return Entity.Null; } public void ReapplyAll() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00d1: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown if (_entries.Count == 0) { return; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val; if (!Settings.PublicStorage_Enabled.Value) { ManualLogSource log = Core.Log; val = new BepInExInfoLogInterpolatedStringHandler(96, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] PublicStorage disabled in config; "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_entries.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" share(s) NOT applied (containers stay private)."); } log.LogInfo(val); return; } if (!CanResolvePublicTeam()) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel SHARE] cannot re-apply "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_entries.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" share(s): no neutral team source."); } log2.LogWarning(val2); return; } int num = 0; int num2 = 0; foreach (PublicContainerEntry entry in _entries) { Entity val3 = ResolveEntry(entry); if (val3 == Entity.Null) { num2++; continue; } ApplyPublicTeam(val3, entry); num++; } SaveSync(); ManualLogSource log3 = Core.Log; val = new BepInExInfoLogInterpolatedStringHandler(120, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel SHARE] re-applied public team to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" container(s); "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entry(ies) did not resolve (kept; '.uriel unshareall' to purge)."); } log3.LogInfo(val); } private bool TryGetOrShare(Entity character, Entity container, bool isAdmin, out PublicContainerEntry entry, out string error) { //IL_0003: 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_0045: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) entry = FindEntry(container); error = null; if (entry != null) { if (!isAdmin && !IsController(character, container, entry) && character.GetSteamId() != entry.SharedBySteamId) { entry = null; error = "You don't control this container, so you can't change its sharing policy."; return false; } return true; } if (!Share(character, container, out var message, isAdmin)) { error = message; return false; } entry = FindEntry(container); if (entry == null) { error = "Share succeeded but the entry could not be found (report this)."; return false; } return true; } public bool SetPermission(Entity character, Entity container, string permission, out string message, bool isAdmin = false) { //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) permission = permission?.Trim().ToLowerInvariant(); bool flag; switch (permission) { case "take": case "give": case "givetake": flag = true; break; default: flag = false; break; } if (!flag) { message = "Permission must be one of: take (withdraw only), give (donation box), givetake (both)."; return false; } if (!TryGetOrShare(character, container, isAdmin, out var entry, out message)) { return false; } entry.Permission = permission; SaveSync(); string text = permission; string text2 = ((permission == "take") ? "(others can only take items out)." : ((!(permission == "give")) ? "(others can take AND put items)." : "(others can only put items in — donation box).")); message = "Container is public with permission '" + text + "' " + text2; return true; } public bool SetLimitHours(Entity character, Entity container, double hours, out string message, bool isAdmin = false) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (hours < 0.0) { message = "Hours must be 0 (no window) or positive."; return false; } if (!TryGetOrShare(character, container, isAdmin, out var entry, out message)) { return false; } entry.LimitHours = hours; if (hours > 0.0 && entry.LimitWithdrawStacks <= 0) { entry.LimitWithdrawStacks = 1; } if (hours == 0.0) { entry.LimitWithdrawStacks = 0; entry.Usage.Clear(); } SaveSync(); message = ((hours == 0.0) ? "Withdrawal limit removed — container has no per-period cap." : $"Withdrawal limit: {entry.LimitWithdrawStacks} stack(s) per {hours:0.#}h per player."); return true; } public bool SetLimitWithdrawal(Entity character, Entity container, int stacks, out string message, bool isAdmin = false) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (stacks < 0) { message = "Stacks must be 0 (unlimited) or positive."; return false; } if (!TryGetOrShare(character, container, isAdmin, out var entry, out message)) { return false; } entry.LimitWithdrawStacks = stacks; if (stacks > 0 && entry.LimitHours <= 0.0) { entry.LimitHours = 24.0; } if (stacks == 0) { entry.LimitHours = 0.0; entry.Usage.Clear(); } SaveSync(); message = ((stacks == 0) ? "Withdrawal limit removed — container has no per-period cap." : $"Withdrawal limit: {stacks} stack(s) per {entry.LimitHours:0.#}h per player."); return true; } public bool SetCost(Entity character, Entity container, int itemGuid, int amount, out string message, bool isAdmin = false) { //IL_0060: 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_00bf: Unknown result type (might be due to invalid IL or missing references) if (itemGuid != 0 && amount <= 0) { message = "Cost amount must be positive (or use item id 0 to make it free)."; return false; } if (itemGuid != 0 && Core.ItemCatalog != null && !Core.ItemCatalog.IsKnownItem(itemGuid)) { message = $"Unknown item id {itemGuid}. Find the right id with: .uriel finditem "; return false; } if (!TryGetOrShare(character, container, isAdmin, out var entry, out message)) { return false; } entry.CostItemGuid = itemGuid; entry.CostAmount = ((itemGuid != 0) ? amount : 0); SaveSync(); message = ((itemGuid == 0) ? "Container is now free to access." : ($"Access cost: {amount}× {EntityExtensions.GetPrefabName(new PrefabGUID(itemGuid))} per stack withdrawn. " + ((GetPayChest(entry.SharedBySteamId) == null) ? "Payments go INTO this container (designate a private payment chest with '.uriel paychest')." : "Payments go to your designated pay chest."))); return true; } public PayChestRef GetPayChest(ulong steamId) { if (!_payChests.TryGetValue(steamId.ToString(), out var value)) { return null; } return value; } public bool SetPayChest(Entity character, Entity container, out string message) { //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_0013: 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_003f: 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_0069: 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_008e: 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_009f: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (!CharacterControlsContainer(character, container)) { message = "You don't control this container — aim at one of YOUR private chests."; return false; } if (FindEntry(container) != null) { message = "That container is public — payments must go to a PRIVATE chest. Aim at a private one."; return false; } if (ClassifyContainer(container) != "storage") { message = "Pay chests must be regular storage (not prison cells or coffins)."; return false; } if (!IsGeneralStorage(container)) { message = "Pay chests must be GENERAL storage — specialized stashes (lumber, seeds, …) only accept certain items and can't safely receive payments."; return false; } if (!container.TryGetComponent(out TilePosition component)) { message = "Container has no tile position; cannot register it."; return false; } _payChests[character.GetSteamId().ToString()] = new PayChestRef { PrefabGuid = container.GetPrefabGuid()._Value, TileX = component.Tile.x, TileY = component.Tile.y }; SaveSync(); message = "Payment chest set: " + container.GetPrefabGuid().GetPrefabName() + ". Cost payments from your shared containers will be delivered here."; return true; } private Entity ResolvePayChest(ulong ownerSteamId) { //IL_003b: 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) PayChestRef payChest = GetPayChest(ownerSteamId); if (payChest == null) { return Entity.Null; } return ResolveEntry(new PublicContainerEntry { PrefabGuid = payChest.PrefabGuid, TileX = payChest.TileX, TileY = payChest.TileY }); } public string BuildInfoText(Entity container) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) PublicContainerEntry publicContainerEntry = FindEntry(container); string prefabName = container.GetPrefabGuid().GetPrefabName(); if (publicContainerEntry == null) { return prefabName + ": private (not shared). Controllers can share it with '.uriel share'."; } StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(11, 2, stringBuilder2); handler.AppendFormatted(prefabName); handler.AppendLiteral(": PUBLIC ["); handler.AppendFormatted(publicContainerEntry.Permission); handler.AppendLiteral("]"); stringBuilder3.Append(ref handler); if (publicContainerEntry.LimitWithdrawStacks > 0) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(30, 2, stringBuilder2); handler.AppendLiteral(", limit "); handler.AppendFormatted(publicContainerEntry.LimitWithdrawStacks); handler.AppendLiteral(" stack(s)/"); handler.AppendFormatted(publicContainerEntry.LimitHours, "0.#"); handler.AppendLiteral("h per player"); stringBuilder4.Append(ref handler); } if (publicContainerEntry.CostItemGuid != 0) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(19, 2, stringBuilder2); handler.AppendLiteral(", cost "); handler.AppendFormatted(publicContainerEntry.CostAmount); handler.AppendLiteral("× "); handler.AppendFormatted(EntityExtensions.GetPrefabName(new PrefabGUID(publicContainerEntry.CostItemGuid))); handler.AppendLiteral(" per stack"); stringBuilder5.Append(ref handler); } stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(20, 2, stringBuilder2); handler.AppendLiteral(". Shared by "); handler.AppendFormatted(publicContainerEntry.SharedBySteamId); handler.AppendLiteral(" since "); handler.AppendFormatted(publicContainerEntry.SharedAtUtc); handler.AppendLiteral("."); stringBuilder6.Append(ref handler); return stringBuilder.ToString(); } public string BuildDebugText(Entity container) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_00c9: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0114: 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_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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); PublicContainerEntry publicContainerEntry = FindEntry(container); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(15, 3, stringBuilder2); handler.AppendFormatted(container.GetPrefabGuid().GetPrefabName()); handler.AppendLiteral(" ["); handler.AppendFormatted(ClassifyContainer(container)); handler.AppendLiteral("] registered="); handler.AppendFormatted((publicContainerEntry != null) ? "YES" : "no"); stringBuilder3.AppendLine(ref handler); if (container.TryGetComponent(out Team component)) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(25, 2, stringBuilder2); handler.AppendLiteral("Team.Value="); handler.AppendFormatted(component.Value); handler.AppendLiteral(" FactionIndex="); handler.AppendFormatted(component.FactionIndex); stringBuilder4.AppendLine(ref handler); } if (container.TryGetComponent(out TeamReference component2)) { Entity value = component2.Value._Value; stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(42, 3, stringBuilder2); handler.AppendLiteral("TeamReference="); handler.AppendFormatted(value); handler.AppendLiteral(" exists="); handler.AppendFormatted(value.Exists()); handler.AppendLiteral(" isNeutralSingleton="); handler.AppendFormatted(value.Exists() && value.Has()); stringBuilder5.AppendLine(ref handler); } if (container.TryGetComponent(out CastleHeartConnection component3)) { Entity entityOnServer = ((NetworkedEntity)(ref component3.CastleHeartEntity)).GetEntityOnServer(); stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 1, stringBuilder2); handler.AppendLiteral("CastleHeartConnection="); handler.AppendFormatted((entityOnServer == Entity.Null) ? "SEVERED (null)" : $"{entityOnServer} exists={entityOnServer.Exists()}"); stringBuilder6.AppendLine(ref handler); } else { stringBuilder.AppendLine("CastleHeartConnection: component missing"); } if (publicContainerEntry != null) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder7 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(29, 4, stringBuilder2); handler.AppendLiteral("Entry: heartAnchor="); handler.AppendFormatted(publicContainerEntry.HasHeartTile ? $"({publicContainerEntry.HeartTileX},{publicContainerEntry.HeartTileY}) resolves={FindHeartByTile(publicContainerEntry.HeartTileX, publicContainerEntry.HeartTileY).Exists()}" : "NONE"); handler.AppendLiteral(" policy=["); handler.AppendFormatted(publicContainerEntry.Permission); handler.AppendFormatted((publicContainerEntry.CostItemGuid != 0) ? " cost" : ""); handler.AppendFormatted((publicContainerEntry.LimitWithdrawStacks > 0) ? " limit" : ""); handler.AppendLiteral("]"); stringBuilder7.AppendLine(ref handler); } if (container.TryGetComponent(out PrisonCell component4)) { Entity entityOnServer2 = ((NetworkedEntity)(ref component4.ImprisonedEntity)).GetEntityOnServer(); if (entityOnServer2.Exists()) { entityOnServer2.TryGetComponent(out Team component5); stringBuilder2 = stringBuilder; StringBuilder stringBuilder8 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 2, stringBuilder2); handler.AppendLiteral("Prisoner: "); handler.AppendFormatted(entityOnServer2.GetPrefabGuid().GetPrefabName()); handler.AppendLiteral(" Team.Value="); handler.AppendFormatted(component5.Value); stringBuilder8.AppendLine(ref handler); } else { stringBuilder.AppendLine("Prisoner: none/empty cell"); } } return stringBuilder.ToString().TrimEnd(); } private bool RebuildContainer(Entity oldC, PublicContainerEntry entry, bool makePublic, out string error) { //IL_0011: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00ab: 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_00cf: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_015b: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) error = null; if (!oldC.TryGetComponent(out Translation translation) || !oldC.TryGetComponent(out Rotation rotation) || !oldC.TryGetComponent(out TilePosition tilePos)) { error = "Container is missing placement data and can't be rebuilt."; return false; } oldC.TryGetComponent(out TileBounds tileBounds); PrefabGUID prefabGuid = oldC.GetPrefabGuid(); PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; Entity val = default(Entity); if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(prefabGuid, ref val)) { error = "Container prefab not found."; return false; } Entity heart = ResolveHeartFor(oldC, entry); EntityManager entityManager = Core.EntityManager; Entity val2 = ((EntityManager)(ref entityManager)).Instantiate(val); val2.With((EntityExtensions.RefAction)delegate(ref Translation t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t.Value = translation.Value; }); val2.With((EntityExtensions.RefAction)delegate(ref Rotation r) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) r.Value = rotation.Value; }); val2.With((EntityExtensions.RefAction)delegate(ref TilePosition tp) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) tp.Tile = tilePos.Tile; tp.TileRotation = tilePos.TileRotation; tp.CompressedHeight = tilePos.CompressedHeight; }); if (val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref TileBounds tb) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tb.Value = tileBounds.Value; }); } if (val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref StaticTransformCompatible s) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) s.UseStaticTransform = false; s.NonStaticTransform_Pos = new float2(translation.Value.x, translation.Value.z); s.NonStaticTransform_Height = translation.Value.y; s.NonStaticTransform_Rotation = tilePos.TileRotation; }); } if (makePublic) { if (TryGetPublicTeam(out var teamValue, out var factionIndex, out var teamRefEntity)) { val2.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = teamValue; t.FactionIndex = factionIndex; }); val2.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = teamRefEntity; }); } if (val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection c) { //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) c.CastleHeartEntity = NetworkedEntity.op_Implicit(Entity.Null); }); } if (heart.Exists() && heart.TryGetComponent(out UserOwner heartOwner) && val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref UserOwner uo) { //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) uo = heartOwner; }); } } else { if (!heart.Exists()) { DestroyUtility.Destroy(Core.EntityManager, val2, (DestroyDebugReason)0, (string)null, 0); error = "Castle heart not found; cannot rebuild as private."; return false; } Entity val3 = FindSiblingTeamDonor(oldC, heart); if (val3 == Entity.Null) { val3 = heart; } if (val3.TryGetComponent(out Team donorTeam) && val3.TryGetComponent(out TeamReference component)) { Entity refEntity = component.Value._Value; val2.With((EntityExtensions.RefAction)delegate(ref Team t) { t.Value = donorTeam.Value; t.FactionIndex = donorTeam.FactionIndex; }); val2.With((EntityExtensions.RefAction)delegate(ref TeamReference tr) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) tr.Value._Value = refEntity; }); } if (val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) c.CastleHeartEntity = NetworkedEntity.op_Implicit(heart); }); } if (heart.TryGetComponent(out UserOwner hOwner) && val2.Has()) { val2.With((EntityExtensions.RefAction)delegate(ref UserOwner uo) { //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) uo = hOwner; }); } } if (!FinishRebuild(oldC, val2)) { Entity capturedOld = oldC; Entity capturedNew = val2; Tick.RunLater(3, delegate { //IL_000c: 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_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references) if (!FinishRebuild(capturedOld, capturedNew)) { Core.Log.LogError((object)"[Uriel SHARE] rebuild FAILED (inventory never resolved) — rolled back; container state unchanged."); if (capturedNew.Exists()) { DestroyUtility.Destroy(Core.EntityManager, capturedNew, (DestroyDebugReason)0, (string)null, 0); } } }); } return true; } private bool FinishRebuild(Entity oldC, Entity newC) { //IL_0006: 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_01da: Expected O, but got Unknown //IL_000e: 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_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_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_0060: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00c5: 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_0188: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { if (!oldC.Exists() || !newC.Exists()) { return true; } Entity val = ResolveInventoryEntity(oldC); Entity newInv = ResolveInventoryEntity(newC); if (newInv == Entity.Null) { return false; } if (val != Entity.Null) { ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val2 = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(val, ref val2)) { serverGameManager = Core.ServerGameManager; DynamicBuffer val3 = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(newInv, ref val3)) { int num = Math.Min(val2.Length, val3.Length); int num2 = 0; for (int i = 0; i < num; i++) { InventoryBuffer val4 = val2[i]; if (val4.ItemType._Value == 0 && val4.Amount <= 0) { continue; } val3[i] = val4; Entity entityOnServer = ((NetworkedEntity)(ref val4.ItemEntity)).GetEntityOnServer(); if (entityOnServer.Exists() && entityOnServer.Has()) { entityOnServer.With((EntityExtensions.RefAction)delegate(ref InventoryItem ii) { //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) ii.ContainerEntity = newInv; }); } InventoryBuffer val5 = val4; val5.ItemEntity = default(NetworkedEntity); val5.ItemType = default(PrefabGUID); val5.Amount = 0; val2[i] = val5; num2++; } if (Settings.VerboseLogging.Value) { ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(59, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[Uriel SHARE] rebuild: moved "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(num2); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" slot(s) to the new container."); } log.LogInfo(val6); } } } } DestroyUtility.Destroy(Core.EntityManager, oldC, (DestroyDebugReason)0, (string)null, 0); return true; } catch (Exception ex) { ManualLogSource log2 = Core.Log; BepInExErrorLogInterpolatedStringHandler val7 = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[Uriel SHARE] rebuild transfer failed: "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted(ex); } log2.LogError(val7); return true; } } private static Entity ResolveInventoryEntity(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_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_000d: 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_0025: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (entity == Entity.Null) { return Entity.Null; } ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(entity, ref val)) { return entity; } Entity result = default(Entity); if (InventoryUtilities.TryGetInventoryEntity(Core.EntityManager, entity, ref result, 0)) { return result; } return Entity.Null; } private Entity ContainerOf(Entity inventoryEntity) { //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_0014: 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_001e: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (inventoryEntity == Entity.Null) { return Entity.Null; } if (FindEntry(inventoryEntity) != null) { return inventoryEntity; } if (inventoryEntity.TryGetComponent(out InventoryConnection component) && component.InventoryOwner.Exists()) { return component.InventoryOwner; } return inventoryEntity; } private static Entity ResolveNetworkId(NetworkId id) { //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_0012: 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_0023: 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_0030: 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) try { Singleton singleton = ((ComponentSystemBase)Core.ServerScriptMapper).GetSingleton(); Entity val = default(Entity); return ((NetworkIdLookupMap)(ref singleton._NetworkIdLookupMap)).TryGetValue(id, ref val) ? val : Entity.Null; } catch { return Entity.Null; } } private void Deny(Entity eventEntity, Entity userEntity, string reason) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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) ChatNotify.ToUserEntity(userEntity, "[Uriel] " + reason); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).DestroyEntity(eventEntity); } public void HandleMoveEvent(Entity eventEntity, FromCharacter fromChar, NetworkId fromInvId, NetworkId toInvId, int fromSlot) { //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_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002b: 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_003f: 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_0051: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00a0: 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_00cf: 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_00c1: 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_00eb: 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_00de: 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_010c: Expected O, but got Unknown //IL_011e: 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_0139: Unknown result type (might be due to invalid IL or missing references) Entity val = ResolveNetworkId(fromInvId); Entity inventoryEntity = ResolveNetworkId(toInvId); Entity val2 = ContainerOf(val); Entity val3 = ContainerOf(inventoryEntity); PublicContainerEntry publicContainerEntry = (val2.Exists() ? FindEntry(val2) : null); PublicContainerEntry publicContainerEntry2 = (val3.Exists() ? FindEntry(val3) : null); if ((publicContainerEntry == null && publicContainerEntry2 == null) || val2 == val3) { return; } Entity character = fromChar.Character; Entity user = fromChar.User; bool value = Settings.VerboseLogging.Value; if (publicContainerEntry != null) { if (IsController(character, val2, publicContainerEntry)) { return; } if (publicContainerEntry.Permission == "give") { Deny(eventEntity, user, "This container is a DONATION BOX — you can put items in, not take them."); return; } if (!CheckWithdrawalWindow(publicContainerEntry, character.GetSteamId(), out var denyMsg)) { Deny(eventEntity, user, denyMsg); return; } if (!TryCollectCost(publicContainerEntry, character, user, out var denyMsg2)) { Deny(eventEntity, user, denyMsg2); return; } ConsumeWithdrawal(publicContainerEntry, character.GetSteamId()); if (value) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel SHARE] "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" withdrew a stack from public "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("."); } log.LogInfo(val4); } } else if (publicContainerEntry2 != null) { if (!IsController(character, val3, publicContainerEntry2) && publicContainerEntry2.Permission == "take") { Deny(eventEntity, user, "This container is TAKE-ONLY — you can't put items into it."); } else { ManualDeposit(eventEntity, character, user, val, fromSlot, val3, value); } } } private bool CheckWithdrawalWindow(PublicContainerEntry entry, ulong steamId, out string denyMsg) { denyMsg = null; if (entry.LimitWithdrawStacks <= 0) { return true; } double num = ((entry.LimitHours > 0.0) ? entry.LimitHours : 24.0); string key = steamId.ToString(); if (entry.Usage.TryGetValue(key, out var value) && DateTime.TryParse(value.WindowStartUtc, null, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out var result)) { TimeSpan timeSpan = DateTime.UtcNow - result; if (timeSpan.TotalHours >= num) { return true; } if (value.StacksTaken >= entry.LimitWithdrawStacks) { TimeSpan span = TimeSpan.FromHours(num) - timeSpan; denyMsg = $"Withdrawal limit reached ({entry.LimitWithdrawStacks} stack(s) per {num:0.#}h). Try again in {FormatSpan(span)}."; return false; } } return true; } private void ConsumeWithdrawal(PublicContainerEntry entry, ulong steamId) { if (entry.LimitWithdrawStacks > 0) { double num = ((entry.LimitHours > 0.0) ? entry.LimitHours : 24.0); string key = steamId.ToString(); if (!entry.Usage.TryGetValue(key, out var value) || !DateTime.TryParse(value.WindowStartUtc, null, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out var result) || !((DateTime.UtcNow - result).TotalHours < num)) { value = new UsageRecord { WindowStartUtc = DateTime.UtcNow.ToString("u"), StacksTaken = 0 }; entry.Usage[key] = value; } value.StacksTaken++; SaveSync(); } } private static string FormatSpan(TimeSpan span) { if (span.TotalHours >= 1.0) { return $"{(int)span.TotalHours}h {span.Minutes}m"; } return $"{span.Minutes}m"; } public static bool IsGeneralStorage(Entity container) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val = default(DynamicBuffer); if (!((ServerGameManager)(ref serverGameManager)).TryGetBuffer(container, ref val)) { return false; } for (int i = 0; i < val.Length; i++) { InventoryInstanceElement val2 = val[i]; if (val2.RestrictedCategory != 0L) { return false; } if (val2.RestrictedType._Value != 0) { return false; } } return true; } public static bool ItemFitsRestriction(Entity container, PrefabGUID itemGuid) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0028: 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_0039: Expected I8, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0072: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val = default(DynamicBuffer); if (!((ServerGameManager)(ref serverGameManager)).TryGetBuffer(container, ref val)) { return true; } long num = 0L; try { serverGameManager = Core.ServerGameManager; ItemData val2 = default(ItemData); if (((ServerGameManager)(ref serverGameManager)).ItemLookupMap.TryGetValue(itemGuid, ref val2)) { num = (long)val2.ItemCategory; } } catch { } for (int i = 0; i < val.Length; i++) { InventoryInstanceElement val3 = val[i]; if (val3.RestrictedType._Value != 0 && val3.RestrictedType._Value != itemGuid._Value) { return false; } if (val3.RestrictedCategory != 0L && (num & val3.RestrictedCategory) == 0L) { return false; } } return true; } public static int CountFit(Entity container, PrefabGUID itemGuid) { //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_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_001b: 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_0037: 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_0067: 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_006e: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) Entity val = default(Entity); if (!InventoryUtilities.TryGetInventoryEntity(Core.EntityManager, container, ref val, 0)) { return 0; } ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val2 = default(DynamicBuffer); if (!((ServerGameManager)(ref serverGameManager)).TryGetBuffer(val, ref val2)) { return 0; } int num = 1; try { serverGameManager = Core.ServerGameManager; ItemData val3 = default(ItemData); if (((ServerGameManager)(ref serverGameManager)).ItemLookupMap.TryGetValue(itemGuid, ref val3) && val3.MaxAmount > 0) { num = val3.MaxAmount; } } catch { } int num2 = 0; for (int i = 0; i < val2.Length; i++) { InventoryBuffer val4 = val2[i]; if (val4.ItemType._Value == 0) { num2 += num; } else if (val4.ItemType._Value == itemGuid._Value && val4.Amount < num) { num2 += num - val4.Amount; } } return num2; } private Entity PickPaymentDestination(PublicContainerEntry entry, PrefabGUID costItem, int amount) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_001a: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) Entity val = ResolvePayChest(entry.SharedBySteamId); if (val != Entity.Null && IsGeneralStorage(val) && CountFit(val, costItem) >= amount) { return val; } Entity val2 = ResolveEntry(entry); if (val2 != Entity.Null && IsGeneralStorage(val2) && CountFit(val2, costItem) >= amount) { return val2; } Entity val3 = ((val2 != Entity.Null) ? ResolveHeartFor(val2, entry) : Entity.Null); if (val2 != Entity.Null && val3.Exists() && val2.TryGetComponent(out Translation component)) { Entity val4 = val3; EntityQueryBuilder val5 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val5 = ((EntityQueryBuilder)(ref val5)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val5 = ((EntityQueryBuilder)(ref val5)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val5 = ((EntityQueryBuilder)(ref val5)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val6 = ((EntityQueryBuilder)(ref val5)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val7 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val6); NativeArray val8 = ((EntityQuery)(ref val7)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Entity val9 = Entity.Null; float num = float.MaxValue; for (int i = 0; i < val8.Length; i++) { Entity val10 = val8[i]; if (!(val10 == val2) && val10.TryGetComponent(out CastleHeartConnection component2) && !(((NetworkedEntity)(ref component2.CastleHeartEntity)).GetEntityOnServer() != val4) && FindEntry(val10) == null && !(ClassifyContainer(val10) != "storage") && IsGeneralStorage(val10) && CountFit(val10, costItem) >= amount && val10.TryGetComponent(out Translation component3)) { float num2 = component3.Value.x - component.Value.x; float num3 = component3.Value.y - component.Value.y; float num4 = component3.Value.z - component.Value.z; float num5 = num2 * num2 + num3 * num3 + num4 * num4; if (num5 < num) { num = num5; val9 = val10; } } } if (val9 != Entity.Null) { return val9; } } finally { val8.Dispose(); } } return Entity.Null; } private bool TryCollectCost(PublicContainerEntry entry, Entity character, Entity userEntity, out string denyMsg) { //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_0076: 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) //IL_0034: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00bd: 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_00c3: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0154: 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_0169: Unknown result type (might be due to invalid IL or missing references) denyMsg = null; if (entry.CostItemGuid == 0) { return true; } PrefabGUID val = default(PrefabGUID); ((PrefabGUID)(ref val))..ctor(entry.CostItemGuid); Entity val2 = default(Entity); if (InventoryUtilities.TryGetInventoryEntity(Core.EntityManager, character, ref val2, 0)) { ServerGameManager serverGameManager = Core.ServerGameManager; if (((ServerGameManager)(ref serverGameManager)).GetInventoryItemCount(val2, val) >= entry.CostAmount) { Entity val3 = PickPaymentDestination(entry, val, entry.CostAmount); if (val3 == Entity.Null) { denyMsg = "No payment destination has room (pay chest, this container, and the castle's other general storage are all full) — tell the owner. No payment was taken."; return false; } Entity val4 = ResolveInventoryEntity(val3); if (val4 == Entity.Null) { denyMsg = "Payment destination has no resolvable inventory — tell the owner. No payment was taken."; return false; } serverGameManager = Core.ServerGameManager; if (!((ServerGameManager)(ref serverGameManager)).TryRemoveInventoryItem(val2, val, entry.CostAmount)) { denyMsg = "Payment could not be collected (inventory changed?). Try again."; return false; } serverGameManager = Core.ServerGameManager; if (!AddItemResponse.op_Implicit(((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(val4, val, entry.CostAmount))) { serverGameManager = Core.ServerGameManager; ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(character, val, entry.CostAmount); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(103, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[Uriel SHARE] payment: TryAddInventoryItem failed AFTER capacity check (target="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val4); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", container="); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val3.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("); refunded."); } log.LogWarning(val5); denyMsg = "Payment delivery failed unexpectedly — refunded. Try again."; return false; } ChatNotify.ToUserEntity(userEntity, $"[Uriel] Paid {entry.CostAmount}× {val.GetPrefabName()} for this withdrawal."); return true; } } denyMsg = $"This container costs {entry.CostAmount}× {val.GetPrefabName()} per stack — you don't have enough."; return false; } private void ManualDeposit(Entity eventEntity, Entity character, Entity userEntity, Entity fromInv, int fromSlot, Entity toContainer, bool verbose) { //IL_0000: 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_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_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Expected O, but got Unknown //IL_001c: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0062: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c0: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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) //IL_010b: 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_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_0176: 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_015c: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_01ea: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { Entity val = ResolveInventoryEntity(fromInv); if (val == Entity.Null) { val = ResolveInventoryEntity(character); } ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val2 = default(DynamicBuffer); if (!((ServerGameManager)(ref serverGameManager)).TryGetBuffer(val, ref val2) || fromSlot < 0 || fromSlot >= val2.Length) { ManualLogSource log = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(106, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] deposit: source inventory unreadable (fromInv="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(fromInv); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", resolved="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", slot="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(fromSlot); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("); leaving event to vanilla."); } log.LogWarning(val3); return; } InventoryBuffer val4 = val2[fromSlot]; PrefabGUID itemType = val4.ItemType; int amount = val4.Amount; if (itemType._Value == 0 || amount <= 0) { return; } Entity val5 = ResolveInventoryEntity(toContainer); if (val5 == Entity.Null) { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(95, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] deposit: container "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(toContainer.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" has no resolvable inventory entity; leaving event to vanilla."); } log2.LogWarning(val3); return; } if (!ItemFitsRestriction(toContainer, itemType)) { Deny(eventEntity, userEntity, "That container doesn't accept this type of item."); return; } if (CountFit(toContainer, itemType) < amount) { Deny(eventEntity, userEntity, "That container doesn't have room for this stack."); return; } serverGameManager = Core.ServerGameManager; if (!((ServerGameManager)(ref serverGameManager)).TryRemoveInventoryItem(val, itemType, amount)) { ManualLogSource log3 = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(71, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] deposit: TryRemoveInventoryItem failed (source="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", item="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(itemType.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("×"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(amount); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")."); } log3.LogWarning(val3); Deny(eventEntity, userEntity, "Deposit failed (item could not be moved)."); return; } serverGameManager = Core.ServerGameManager; if (!AddItemResponse.op_Implicit(((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(val5, itemType, amount))) { serverGameManager = Core.ServerGameManager; ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(character, itemType, amount); ManualLogSource log4 = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(111, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] deposit: TryAddInventoryItem failed AFTER capacity check (target="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val5); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", container="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(toContainer.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", item="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(itemType.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("×"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(amount); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("); refunded."); } log4.LogWarning(val3); Deny(eventEntity, userEntity, "Deposit failed unexpectedly — items refunded. Tell the admin to check the server log."); return; } EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).DestroyEntity(eventEntity); if (verbose) { ManualLogSource log5 = Core.Log; BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(41, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[Uriel SHARE] "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(character.GetSteamId()); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" deposited "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(amount); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("× "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(itemType.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" into public "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(toContainer.GetPrefabGuid().GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("."); } log5.LogInfo(val6); } } catch (Exception ex) { ManualLogSource log6 = Core.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel SHARE] manual deposit failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log6.LogWarning(val3); } } public void HandleMoveAllEvent(Entity eventEntity, FromCharacter fromChar, NetworkId fromInvId, NetworkId toInvId) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0057: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Entity val = ContainerOf(ResolveNetworkId(fromInvId)); Entity val2 = ContainerOf(ResolveNetworkId(toInvId)); PublicContainerEntry publicContainerEntry = (val.Exists() ? FindEntry(val) : null); if (publicContainerEntry == null) { publicContainerEntry = (val2.Exists() ? FindEntry(val2) : null); } if (publicContainerEntry != null) { Entity container = ((FindEntry(val) != null) ? val : val2); if (!IsController(fromChar.Character, container, publicContainerEntry) && publicContainerEntry.HasRestrictions) { Deny(eventEntity, fromChar.User, "This container has sharing rules — move items one at a time."); } } } } internal sealed class StairSwapService { private sealed class PieceCapture { public PrefabGUID Prefab; public Translation Translation; public bool HasRotation; public Rotation Rotation; public bool HasTilePos; public TilePosition TilePos; public bool HasTileBounds; public TileBounds TileBounds; public bool HasStatic; public StaticTransformCompatible Static; public bool HasTeam; public Team Team; public bool HasTeamRef; public TeamReference TeamRef; public bool HasOwner; public UserOwner Owner; public bool HasHeart; public CastleHeartConnection Heart; public readonly List AttachParents = new List(); } private const string BlueprintPrefix = "BP_Castle_Stairs_"; private static readonly string[] StyleOrder = new string[6] { "stone1", "stone2", "stone3", "gloomrot", "projectk", "strongblade" }; private static readonly Dictionary SuffixToStyle = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["Stone01"] = "stone1", ["Stone02"] = "stone2", ["Stone03"] = "stone3", ["DLC_Gloomrot01"] = "gloomrot", ["DLC_ProjectK01"] = "projectk", ["DLC_StrongbladeDLC01"] = "strongblade" }; private static readonly Dictionary> Matrix = new Dictionary>(StringComparer.OrdinalIgnoreCase) { ["Single"] = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["stone1"] = -541385494, ["stone2"] = 1267405974, ["stone3"] = 1019577856, ["gloomrot"] = -1808336362, ["projectk"] = -601630508, ["strongblade"] = 1831814293 }, ["Single_CW"] = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["stone1"] = -628212401, ["stone2"] = 891240110, ["stone3"] = 1737385414, ["gloomrot"] = -671167268, ["projectk"] = -2111252824, ["strongblade"] = 54801101 }, ["Single_CCW"] = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["stone1"] = -1323146211, ["stone2"] = 171455823, ["stone3"] = 2042236287, ["gloomrot"] = 249484894, ["projectk"] = 787873859, ["strongblade"] = 1748214728 }, ["Double"] = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["stone1"] = 77571580, ["stone2"] = -887317616, ["stone3"] = -1186795702, ["gloomrot"] = -1940654627, ["projectk"] = 384472583, ["strongblade"] = -2042297302 } }; public static bool TryParseStairName(string prefabName, out string archetype, out string style) { archetype = null; style = null; if (string.IsNullOrEmpty(prefabName) || !prefabName.StartsWith("BP_Castle_Stairs_", StringComparison.OrdinalIgnoreCase)) { return false; } string text = prefabName.Substring("BP_Castle_Stairs_".Length); string[] array = new string[4] { "Single_CCW", "Single_CW", "Single", "Double" }; foreach (string text2 in array) { if (text.StartsWith(text2 + "_", StringComparison.OrdinalIgnoreCase)) { string key = text.Substring(text2.Length + 1); if (!SuffixToStyle.TryGetValue(key, out style)) { return false; } archetype = text2; return true; } } return false; } public Entity ResolveTargetStair(Entity character, out string archetype, out string currentStyle, out string error, bool nearestToPlayer = false) { //IL_0041: 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_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_0062: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003f: Unknown result type (might be due to invalid IL or missing references) archetype = null; currentStyle = null; error = null; float value = Settings.StairSwap_MaxTargetDistance.Value; if (!nearestToPlayer && character.TryGetComponent(out EntityAimData component)) { Entity val = ClosestStairTo(component.AimPosition, value, out archetype, out currentStyle); if (val != Entity.Null) { return val; } } if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { error = "Could not read your position."; return Entity.Null; } Entity val2 = ClosestStairTo(position, value, out archetype, out currentStyle); if (val2 == Entity.Null) { error = $"No stair found within {value:F0}m of you. Stand next to the staircase (or aim at it)."; } return val2; } private static Entity ClosestStairTo(float3 refPos, float maxDist, out string archetype, out string currentStyle) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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) archetype = null; currentStyle = null; float num = maxDist * maxDist; EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Entity result = Entity.Null; float num2 = float.MaxValue; string text = null; string text2 = null; for (int i = 0; i < val4.Length; i++) { Entity entity = val4[i]; if (!entity.TryGetComponent(out Translation component)) { continue; } float num3 = component.Value.x - refPos.x; float num4 = component.Value.y - refPos.y; float num5 = component.Value.z - refPos.z; float num6 = num3 * num3 + num4 * num4 + num5 * num5; if (!(num6 > num) && !(num6 >= num2)) { Entity val5 = ResolveStairRoot(entity); if (!(val5 == Entity.Null) && TryParseStairName(val5.GetPrefabGuid().GetPrefabName(), out var archetype2, out var style)) { num2 = num6; result = val5; text = archetype2; text2 = style; } } } archetype = text; currentStyle = text2; return result; } finally { val4.Dispose(); } } private static Entity ResolveStairRoot(Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (IsStairRoot(entity)) { return entity; } if (entity.TryGetComponent(out CastleBuildingFusedChild component)) { Entity entityOnServer = ((NetworkedEntity)(ref component.ParentEntity)).GetEntityOnServer(); if (IsStairRoot(entityOnServer)) { return entityOnServer; } } return Entity.Null; } private static bool IsStairRoot(Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!entity.Exists()) { return false; } return entity.GetPrefabGuid().GetPrefabName().StartsWith("BP_Castle_Stairs_", StringComparison.OrdinalIgnoreCase); } public unsafe static bool UserOwnsStyle(Entity userEntity, PrefabGUID styleGuid, out string dlcName) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_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_0041: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) dlcName = null; PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; Entity entity = default(Entity); if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(styleGuid, ref entity)) { return false; } if (!entity.Has()) { return true; } UserContentFlags value = entity.Read().Value; dlcName = ((object)(*(UserContentFlags*)(&value))/*cast due to .constrained prefix*/).ToString(); if (!userEntity.TryGetComponent(out User component)) { return false; } return UserContentUtility.HasUnlocked(component.UserContent, value); } public bool Swap(Entity character, Entity userEntity, string styleKey, out string message, bool nearestToPlayer = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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) string archetype; string currentStyle; Entity val = ResolveTargetStair(character, out archetype, out currentStyle, out message, nearestToPlayer); if (val == Entity.Null) { return false; } if (!PublicStorageService.CharacterControlsContainer(character, val)) { message = "You don't control this stair (its castle isn't yours/your clan's)."; return false; } string text; if (string.Equals(styleKey, "next", StringComparison.OrdinalIgnoreCase)) { text = NextOwnedStyle(userEntity, archetype, currentStyle); if (text == null) { message = "No other style available to you for this stair."; return false; } } else { text = styleKey?.Trim().ToLowerInvariant(); if (text == null || !Matrix[archetype].ContainsKey(text)) { message = $"Unknown style '{styleKey}'. Styles: {string.Join(", ", StyleOrder)} (or 'next')."; return false; } } if (string.Equals(text, currentStyle, StringComparison.OrdinalIgnoreCase)) { message = "That stair is already style '" + currentStyle + "'."; return false; } PrefabGUID val2 = default(PrefabGUID); ((PrefabGUID)(ref val2))..ctor(Matrix[archetype][text]); if (!UserOwnsStyle(userEntity, val2, out var dlcName)) { message = ((dlcName == null) ? "That style could not be resolved." : $"Style '{text}' requires the {dlcName} DLC — it isn't in your build menu."); return false; } try { return ExecuteSwap(val, val2, archetype, currentStyle, text, character, userEntity, out message); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel STAIRS] swap failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log.LogError(val3); message = "Swap failed unexpectedly — nothing was changed if the old stair is still standing. Check the server log."; return false; } } private string NextOwnedStyle(Entity userEntity, string archetype, string currentStyle) { //IL_002b: 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) int num = Array.IndexOf(StyleOrder, currentStyle); for (int i = 1; i <= StyleOrder.Length; i++) { string text = StyleOrder[(num + i) % StyleOrder.Length]; if (!(text == currentStyle) && UserOwnsStyle(userEntity, new PrefabGUID(Matrix[archetype][text]), out var _)) { return text; } } return null; } private bool ExecuteSwap(Entity oldRoot, PrefabGUID targetGuid, string archetype, string fromStyle, string toStyle, Entity character, Entity userEntity, out string message) { //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_000d: 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_003b: 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_0062: 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_0078: Expected O, but got Unknown //IL_0045: 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_004c: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) oldRoot.With((EntityExtensions.RefAction)delegate(ref PrefabGUID g) { g._Value = targetGuid._Value; }); if (oldRoot.Has()) { oldRoot.With((EntityExtensions.RefAction)delegate(ref BlueprintData b) { //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) b.Guid = targetGuid; }); } bool flag = false; if (oldRoot.TryGetComponent(out NetworkId component) && (int)component.Type == 2) { flag = true; oldRoot.With((EntityExtensions.RefAction)delegate(ref NetworkId n) { n.MegaStatic_PrefabGUID = targetGuid._Value; }); } PublicStorageService.ForceResync(oldRoot); ManualLogSource log = Core.Log; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(68, 4, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Uriel STAIRS] identity swap: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(archetype); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(fromStyle); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(toStyle); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (entity preserved; megaStatic="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(flag); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")."); } log.LogInfo(val); message = $"Stair swapped: {fromStyle} -> {toStyle} ({archetype}). The new look appears for everyone at the NEXT SERVER RESTART (the change is already saved)."; return true; } public string PurgeNear(Entity character, float radius = 5f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_008b: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_00c0: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (!PublicStorageService.TryGetCharacterPosition(character, out var position)) { return "Could not read your position."; } EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); val = ((EntityQueryBuilder)(ref val)).AddAll(new ComponentType(Il2CppType.Of(), (AccessMode)1)); EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)66); EntityManager entityManager = Core.EntityManager; EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2); NativeArray val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); int num = 0; try { float num2 = radius * radius; for (int i = 0; i < val4.Length; i++) { Entity val5 = val4[i]; string prefabName = val5.GetPrefabGuid().GetPrefabName(); if ((prefabName.StartsWith("BP_Castle_Stairs_", StringComparison.OrdinalIgnoreCase) || prefabName.StartsWith("TM_Castle_Stairs_", StringComparison.OrdinalIgnoreCase)) && val5.TryGetComponent(out Translation component)) { float num3 = component.Value.x - position.x; float num4 = component.Value.y - position.y; float num5 = component.Value.z - position.z; if (!(num3 * num3 + num4 * num4 + num5 * num5 > num2)) { DestroyUtility.Destroy(Core.EntityManager, val5, (DestroyDebugReason)0, (string)null, 0); num++; } } } } finally { val4.Dispose(); } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(65, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[Uriel STAIRS] stairpurge: destroyed "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" stair entity(ies) within "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(radius, "F0"); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("m."); } log.LogInfo(val6); if (num == 0) { return $"No stair entities found within {radius:F0}m."; } return $"Purged {num} stair entity(ies) within {radius:F0}m. RESTART the server to flush any remaining ghost grid claims, then rebuild the stairs."; } public unsafe string DiagnoseLiveRefresh(Entity character, bool performAction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_049b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) string archetype; string currentStyle; string error; Entity val = ResolveTargetStair(character, out archetype, out currentStyle, out error); if (val == Entity.Null) { return error ?? "No staircase targeted."; } L($"root={Describe(val)} archetype={archetype} style={currentStyle} performAction={performAction}"); List list = new List { val }; ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val2 = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(val, ref val2)) { for (int i = 0; i < val2.Length; i++) { CastleBuildingFusedChildrenBuffer val3 = val2[i]; Entity entityOnServer = ((NetworkedEntity)(ref val3.ChildEntity)).GetEntityOnServer(); if (entityOnServer.Exists()) { list.Add(entityOnServer); } } } L($"fused children: {list.Count - 1}"); foreach (Entity item in list) { NetworkId component; string value = (item.TryGetComponent(out component) ? ((object)(*(NetworkIdType*)(&component.Type))/*cast due to .constrained prefix*/).ToString() : "none"); PrefabGUID prefabGuid = item.GetPrefabGuid(); BlueprintData component2; string value2 = (item.TryGetComponent(out component2) ? $"{component2.Guid.GetPrefabName()}({component2.Guid._Value})" : "none"); L($" {Describe(item)}: NetId={value} static={item.Has()} PrefabGUID={prefabGuid.GetPrefabName()}({prefabGuid._Value}) BlueprintData.Guid={value2}"); } if (performAction) { int num = 0; Entity entity = default(Entity); foreach (Entity item2 in list) { try { PrefabGUID prefabGuid2 = item2.GetPrefabGuid(); PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(prefabGuid2, ref entity) || !entity.Exists()) { L(" no prefab for " + Describe(item2) + " — skipped rebake"); continue; } bool value3 = false; bool value4 = false; if (item2.Has() && entity.TryGetComponent(out TileData ptd)) { item2.With((EntityExtensions.RefAction)delegate(ref TileData x) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) x.Data = ptd.Data; }); value3 = true; } if (item2.Has() && entity.TryGetComponent(out NetworkedPrefabChildren pnpc)) { item2.With((EntityExtensions.RefAction)delegate(ref NetworkedPrefabChildren x) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) x.Data = pnpc.Data; }); value4 = true; } num++; L($" rebaked {Describe(item2)} from prefab {prefabGuid2.GetPrefabName()} (TileData={value3} NetworkedPrefabChildren={value4})"); } catch (Exception ex) { L(" rebake failed for " + Describe(item2) + ": " + ex.Message); } } int num2 = 0; foreach (Entity item3 in list) { try { PublicStorageService.ForceResync(item3); num2++; } catch (Exception ex2) { L(" re-stream failed for " + Describe(item3) + ": " + ex2.Message); } } L($"rebaked {num}, re-streamed {num2} entity(ies)."); return $"Stair live-refresh EXPERIMENT v2: re-baked visual blobs (TileData / NetworkedPrefabChildren) on {num} piece(s) from their current prefab, then re-streamed {num2}. WATCH the staircase for a few seconds. If it updates → that's the fix and I fold it into the swap. If still nothing → the visual is resolved purely client-side from structure identity and only a true respawn (or client-side BCH) can refresh it. Durable swap unaffected."; } return $"Stair diagnostic written to the server log (root + {list.Count - 1} child tile(s), full component dumps). No change made — set [StairSwap] ExperimentalLiveRefresh=true to test the live re-stream."; static void L(string line) { Core.Log.LogInfo((object)("[Uriel STAIRREFRESH] " + line)); } } private static string Describe(Entity e) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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 (!e.Exists()) { return "Entity.Null"; } return $"{e.GetPrefabGuid().GetPrefabName()}({e.Index}:{e.Version})"; } private static PieceCapture Capture(Entity e, PrefabGUID prefabOverride) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0059: 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_0070: 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_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) //IL_008b: 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_00a2: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00d6: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0110: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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) PieceCapture pieceCapture = new PieceCapture { Prefab = ((prefabOverride._Value != 0) ? prefabOverride : e.GetPrefabGuid()) }; if (e.TryGetComponent(out Translation component)) { pieceCapture.Translation = component; } if (e.TryGetComponent(out Rotation component2)) { pieceCapture.HasRotation = true; pieceCapture.Rotation = component2; } if (e.TryGetComponent(out TilePosition component3)) { pieceCapture.HasTilePos = true; pieceCapture.TilePos = component3; } if (e.TryGetComponent(out TileBounds component4)) { pieceCapture.HasTileBounds = true; pieceCapture.TileBounds = component4; } if (e.TryGetComponent(out StaticTransformCompatible component5)) { pieceCapture.HasStatic = true; pieceCapture.Static = component5; } if (e.TryGetComponent(out Team component6)) { pieceCapture.HasTeam = true; pieceCapture.Team = component6; } if (e.TryGetComponent(out TeamReference component7)) { pieceCapture.HasTeamRef = true; pieceCapture.TeamRef = component7; } if (e.TryGetComponent(out UserOwner component8)) { pieceCapture.HasOwner = true; pieceCapture.Owner = component8; } if (e.TryGetComponent(out CastleHeartConnection component9)) { pieceCapture.HasHeart = true; pieceCapture.Heart = component9; } ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(e, ref val)) { for (int i = 0; i < val.Length; i++) { CastleBuildingAttachToParentsBuffer val2 = val[i]; Entity entityOnServer = ((NetworkedEntity)(ref val2.ParentEntity)).GetEntityOnServer(); if (entityOnServer.Exists()) { pieceCapture.AttachParents.Add(entityOnServer); } } } return pieceCapture; } private static Entity SpawnPiece(PieceCapture c) { //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_0020: 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_0047: Expected O, but got Unknown //IL_002e: 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_005f: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d2: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f9: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; Entity val = default(Entity); if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(c.Prefab, ref val) || !val.Exists()) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(54, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Uriel STAIRRESPAWN] no prefab for "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(c.Prefab.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(c.Prefab._Value); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") — piece skipped."); } log.LogError(val2); return Entity.Null; } EntityManager entityManager = Core.EntityManager; Entity val3 = ((EntityManager)(ref entityManager)).Instantiate(val); if (val3.Has()) { entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(val3); } val3.With((EntityExtensions.RefAction)delegate(ref Translation t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t = c.Translation; }); if (c.HasRotation && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref Rotation r) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) r = c.Rotation; }); } if (c.HasTilePos && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref TilePosition t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t = c.TilePos; }); } if (c.HasTileBounds && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref TileBounds t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t = c.TileBounds; }); } if (c.HasStatic && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref StaticTransformCompatible s) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) s = c.Static; }); } if (c.HasTeam && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref Team t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t = c.Team; }); } if (c.HasTeamRef && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref TeamReference t) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) t = c.TeamRef; }); } if (c.HasOwner && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref UserOwner u) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) u = c.Owner; }); } if (c.HasHeart && val3.Has()) { val3.With((EntityExtensions.RefAction)delegate(ref CastleHeartConnection h) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) h = c.Heart; }); } return val3; } public bool SwapViaRespawn(Entity character, Entity userEntity, string styleKey, out string message, bool nearestToPlayer = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) string archetype; string currentStyle; Entity val = ResolveTargetStair(character, out archetype, out currentStyle, out message, nearestToPlayer); if (val == Entity.Null) { return false; } if (!PublicStorageService.CharacterControlsContainer(character, val)) { message = "You don't control this stair (its castle isn't yours/your clan's)."; return false; } string text; if (string.Equals(styleKey, "next", StringComparison.OrdinalIgnoreCase)) { text = NextOwnedStyle(userEntity, archetype, currentStyle); if (text == null) { message = "No other style available to you for this stair."; return false; } } else { text = styleKey?.Trim().ToLowerInvariant(); if (text == null || !Matrix[archetype].ContainsKey(text)) { message = $"Unknown style '{styleKey}'. Styles: {string.Join(", ", StyleOrder)} (or 'next')."; return false; } } if (string.Equals(text, currentStyle, StringComparison.OrdinalIgnoreCase)) { message = "That stair is already style '" + currentStyle + "'."; return false; } PrefabGUID val2 = default(PrefabGUID); ((PrefabGUID)(ref val2))..ctor(Matrix[archetype][text]); if (!UserOwnsStyle(userEntity, val2, out var dlcName)) { message = ((dlcName == null) ? "That style could not be resolved." : $"Style '{text}' requires the {dlcName} DLC — it isn't in your build menu."); return false; } try { return ExecuteRespawn(val, val2, currentStyle, text, out message); } catch (Exception ex) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Uriel STAIRRESPAWN] failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log.LogError(val3); message = "Respawn failed unexpectedly — check the server log."; return false; } } private bool ExecuteRespawn(Entity oldRoot, PrefabGUID targetGuid, string fromStyle, string toStyle, out string message) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_0198: Expected O, but got Unknown PieceCapture rootCap = Capture(oldRoot, targetGuid); List childCaps = new List(); List list = new List { oldRoot }; ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(oldRoot, ref val)) { for (int i = 0; i < val.Length; i++) { CastleBuildingFusedChildrenBuffer val2 = val[i]; Entity entityOnServer = ((NetworkedEntity)(ref val2.ChildEntity)).GetEntityOnServer(); if (entityOnServer.Exists()) { childCaps.Add(Capture(entityOnServer, default(PrefabGUID))); list.Add(entityOnServer); } } } PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; Entity val3 = default(Entity); if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(rootCap.Prefab, ref val3)) { message = "Could not resolve the '" + toStyle + "' staircase prefab — nothing was changed."; return false; } foreach (PieceCapture item in childCaps) { prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap; if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(item.Prefab, ref val3)) { message = "Could not resolve a stair segment prefab — nothing was changed."; return false; } } int num = 0; foreach (Entity item2 in list) { if (item2.Exists()) { DestroyUtility.Destroy(Core.EntityManager, item2, (DestroyDebugReason)0, (string)null, 0); num++; } } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(90, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel STAIRRESPAWN] "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(fromStyle); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("->"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(toStyle); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": destroyed "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" old piece(s) (root + "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(childCaps.Count); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" children). Respawning after gap."); } log.LogInfo(val4); int num2 = Math.Max(1, Settings.StairSwap_RespawnGapFrames.Value); Tick.RunLater(num2, delegate { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0168: 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_00bf: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) bool flag2 = default(bool); try { Entity newRoot = SpawnPiece(rootCap); if (newRoot == Entity.Null) { Core.Log.LogError((object)"[Uriel STAIRRESPAWN] new root spawn failed — staircase NOT restored."); } else { List list2 = new List(); ServerGameManager serverGameManager2; DynamicBuffer val6 = default(DynamicBuffer); DynamicBuffer val7 = default(DynamicBuffer); foreach (PieceCapture item3 in childCaps) { Entity val5 = SpawnPiece(item3); if (!(val5 == Entity.Null)) { if (val5.Has()) { val5.With((EntityExtensions.RefAction)delegate(ref CastleBuildingFusedChild f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) f.ParentEntity = NetworkedEntity.op_Implicit(newRoot); }); } if (item3.AttachParents.Count > 0) { serverGameManager2 = Core.ServerGameManager; if (((ServerGameManager)(ref serverGameManager2)).TryGetBuffer(val5, ref val6)) { val6.Clear(); foreach (Entity attachParent in item3.AttachParents) { if (attachParent.Exists()) { val6.Add(new CastleBuildingAttachToParentsBuffer { ParentEntity = NetworkedEntity.op_Implicit(attachParent) }); serverGameManager2 = Core.ServerGameManager; if (((ServerGameManager)(ref serverGameManager2)).TryGetBuffer(attachParent, ref val7)) { val7.Add(new CastleBuildingAttachedChildrenBuffer { ChildEntity = NetworkedEntity.op_Implicit(val5) }); } } } } } list2.Add(val5); } } serverGameManager2 = Core.ServerGameManager; DynamicBuffer val8 = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager2)).TryGetBuffer(newRoot, ref val8)) { val8.Clear(); foreach (Entity item4 in list2) { val8.Add(new CastleBuildingFusedChildrenBuffer { ChildEntity = NetworkedEntity.op_Implicit(item4) }); } } ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val9 = new BepInExInfoLogInterpolatedStringHandler(87, 4, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("[Uriel STAIRRESPAWN] respawned "); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted(targetGuid.GetPrefabName()); ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(" root("); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted(newRoot.Index); ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(":"); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted(newRoot.Version); ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(") + "); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted(list2.Count); ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(" child(ren). New NetworkIds assign next tick."); } log2.LogInfo(val9); } } catch (Exception ex) { ManualLogSource log3 = Core.Log; BepInExErrorLogInterpolatedStringHandler val10 = new BepInExErrorLogInterpolatedStringHandler(44, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("[Uriel STAIRRESPAWN] respawn lambda failed: "); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted(ex); } log3.LogError(val10); } }); message = $"Stair RESPAWN {fromStyle} -> {toStyle}: old staircase destroyed; new-style staircase appears after a {num2}-frame gap (it should render the NEW style live since it's a fresh entity). EXPERIMENTAL — if it looks wrong or floats, dismantle & rebuild, or restart to normalize."; return true; } public bool RemoveStair(Entity character, out string message, bool nearestToPlayer = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0045: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown string archetype; string currentStyle; Entity val = ResolveTargetStair(character, out archetype, out currentStyle, out message, nearestToPlayer); if (val == Entity.Null) { return false; } if (!PublicStorageService.CharacterControlsContainer(character, val)) { message = "You don't control this stair (its castle isn't yours/your clan's)."; return false; } List list = new List { val }; ServerGameManager serverGameManager = Core.ServerGameManager; DynamicBuffer val2 = default(DynamicBuffer); if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer(val, ref val2)) { for (int i = 0; i < val2.Length; i++) { CastleBuildingFusedChildrenBuffer val3 = val2[i]; Entity entityOnServer = ((NetworkedEntity)(ref val3.ChildEntity)).GetEntityOnServer(); if (entityOnServer.Exists()) { list.Add(entityOnServer); } } } int num = 0; foreach (Entity item in list) { if (item.Exists()) { DestroyUtility.Destroy(Core.EntityManager, item, (DestroyDebugReason)0, (string)null, 0); num++; } } ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(96, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Uriel STAIRS] removestairs: destroyed "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" piece(s) of a "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(archetype); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(currentStyle); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("' staircase (connected tiles untouched)."); } log.LogInfo(val4); message = $"Removed the {archetype} staircase ({num} piece(s)). The floors/walls it was connected to were left intact. (No materials are refunded.)"; return true; } public string DescribeStyles(Entity character, Entity userEntity, bool nearestToPlayer = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0098: Unknown result type (might be due to invalid IL or missing references) if (ResolveTargetStair(character, out var archetype, out var currentStyle, out var error, nearestToPlayer) == Entity.Null) { return error; } StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(37, 2, stringBuilder2); handler.AppendLiteral("Stair: "); handler.AppendFormatted(archetype); handler.AppendLiteral(", current style '"); handler.AppendFormatted(currentStyle); handler.AppendLiteral("'. Available:"); stringBuilder3.AppendLine(ref handler); string[] styleOrder = StyleOrder; foreach (string text in styleOrder) { string dlcName; bool flag = UserOwnsStyle(userEntity, new PrefabGUID(Matrix[archetype][text]), out dlcName); stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(2, 3, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text); handler.AppendFormatted((text == currentStyle) ? " (current)" : ""); handler.AppendFormatted(flag ? "" : (" — locked (" + dlcName + " DLC)")); stringBuilder4.AppendLine(ref handler); } stringBuilder.Append("Swap with: .uriel stairswap