Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BbdCards v0.1.4
BbdCards.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BbdCards.Helpers; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BbdCards")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.4.0")] [assembly: AssemblyInformationalVersion("0.1.4+3cfb75f130125680b16d3e39626f29118e77344b")] [assembly: AssemblyProduct("BbdCards")] [assembly: AssemblyTitle("BbdCards")] [assembly: AssemblyVersion("0.1.4.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BbdCards { internal static class CardAssets { private const string Prefix = "BbdCards.Cards."; public static readonly string[] Ids = (from n in Assembly.GetExecutingAssembly().GetManifestResourceNames() where n.StartsWith("BbdCards.Cards.", StringComparison.Ordinal) && n.EndsWith(".png", StringComparison.Ordinal) select n.Substring("BbdCards.Cards.".Length, n.Length - "BbdCards.Cards.".Length - 4)).OrderBy<string, string>((string n) => n, StringComparer.Ordinal).ToArray(); public static Mesh CreateMesh() { //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_0016: 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_0080: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown CardGeometry.Data data = CardGeometry.Create(); Mesh val = new Mesh { name = "BbdCards/Rounded card", vertices = ((IEnumerable<CardGeometry.Vertex>)data.Vertices).Select((Func<CardGeometry.Vertex, Vector3>)((CardGeometry.Vertex v) => new Vector3(v.X, v.Y, v.Z))).ToArray(), uv = ((IEnumerable<CardGeometry.Vertex>)data.Vertices).Select((Func<CardGeometry.Vertex, Vector2>)((CardGeometry.Vertex v) => new Vector2(v.U, v.V))).ToArray(), triangles = data.Triangles.ToArray() }; val.RecalculateNormals(); val.RecalculateBounds(); val.RecalculateTangents(); val.UploadMeshData(true); return val; } public static Material CreateMaterial(string id, Material template) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BbdCards.Cards." + id + ".png") ?? throw new FileNotFoundException("Card texture missing: " + id); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)3, true) { name = "BbdCards/" + id, filterMode = (FilterMode)2, wrapMode = (TextureWrapMode)1, anisoLevel = 2 }; Material val2 = null; try { if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true)) { throw new InvalidDataException("Cannot decode card: " + id); } val2 = MaterialFactory.Create(template, ((Object)val).name, Color.white, 0f, 0.15f); val2.mainTexture = (Texture)(object)val; return val2; } catch { Object.Destroy((Object)(object)val); if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)val2); } throw; } } } internal static class CardGeometry { internal readonly struct Vertex { public readonly float X; public readonly float Y; public readonly float Z; public readonly float U; public readonly float V; public Vertex(float x, float y, float z, float u, float v) { X = x; Y = y; Z = z; U = u; V = v; } } internal sealed class Data { public readonly List<Vertex> Vertices = new List<Vertex>(); public readonly List<int> Triangles = new List<int>(); public void Triangle(int a, int b, int c) { Triangles.Add(a); Triangles.Add(b); Triangles.Add(c); } } public const float Side = 0.34f; public const float Thickness = 0.018f; public const float Radius = 0.018f; public const int CornerSegments = 6; public static Data Create() { Data data = new Data(); List<(float, float)> ring = CreateRing(); AddFace(data, ring, back: false); AddFace(data, ring, back: true); AddRim(data, ring); return data; } private static List<(float x, float y)> CreateRing() { List<(float, float)> list = new List<(float, float)>(); float num = 0.17f; for (int i = 0; i < 4; i++) { float num2 = ((i == 0 || i == 3) ? (num - 0.018f) : (0f - num + 0.018f)); float num3 = ((i < 2) ? 0.322f : 0.018f); for (int j = 0; j <= 6; j++) { double num4 = ((double)i * 90.0 + (double)j * 90.0 / 6.0) * Math.PI / 180.0; list.Add((num2 + 0.018f * (float)Math.Cos(num4), num3 + 0.018f * (float)Math.Sin(num4))); } } return list; } private static void AddFace(Data data, List<(float x, float y)> ring, bool back) { int count = data.Vertices.Count; float z = (back ? 0.009f : (-0.009f)); data.Vertices.Add(new Vertex(0f, 0.17f, z, 0.5f, 0.5f)); foreach (var item in ring) { float num = Math.Max(0f, Math.Min(1f, item.x / 0.34f + 0.5f)); float v = Math.Max(0f, Math.Min(1f, item.y / 0.34f)); data.Vertices.Add(new Vertex(item.x, item.y, z, back ? (1f - num) : num, v)); } for (int i = 0; i < ring.Count; i++) { int num2 = count + 1 + i; int num3 = count + 1 + (i + 1) % ring.Count; if (back) { data.Triangle(count, num2, num3); } else { data.Triangle(count, num3, num2); } } } private static void AddRim(Data data, List<(float x, float y)> ring) { float num = 0.009f; for (int i = 0; i < ring.Count; i++) { (float, float) tuple = ring[i]; (float, float) tuple2 = ring[(i + 1) % ring.Count]; int count = data.Vertices.Count; data.Vertices.Add(new Vertex(tuple.Item1, tuple.Item2, 0f - num, 0.001f, 0.001f)); data.Vertices.Add(new Vertex(tuple2.Item1, tuple2.Item2, 0f - num, 0.002f, 0.001f)); data.Vertices.Add(new Vertex(tuple2.Item1, tuple2.Item2, num, 0.002f, 0.002f)); data.Vertices.Add(new Vertex(tuple.Item1, tuple.Item2, num, 0.001f, 0.002f)); data.Triangle(count, count + 1, count + 2); data.Triangle(count, count + 2, count + 3); } } } [BepInPlugin("romanvht.BbdCards", "BBD Cards", "0.1.4")] [BepInDependency("REPOLib", "4.2.0")] public sealed class Plugin : BaseUnityPlugin { public const string Id = "romanvht.BbdCards"; internal static Plugin Instance; private readonly List<PrefabRef> registered = new List<PrefabRef>(); private ConfigEntry<bool> debugSpawn; private ConfigEntry<float> min; private ConfigEntry<float> max; private ConfigEntry<float> mass; private ConfigEntry<float> fragility; private bool initialized; private int nextDebugCard; private void Awake() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Instance = this; debugSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableSpawnKey", false, "Host: F9 spawns the next card during a level."); min = Bind("ValueMin", 700f, 1f, 100000f, "Minimum base value; game multipliers apply."); max = Bind("ValueMax", 1400f, 1f, 100000f, "Maximum base value."); mass = Bind("Mass", 0.25f, 0.1f, 30f, "Mass; use identical settings on all clients."); fragility = Bind("Fragility", 35f, 0f, 100f, "Impact fragility; use identical settings on all clients."); new Harmony("romanvht.BbdCards").PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"BBD Cards loaded: {CardAssets.Ids.Length} embedded images."); } private ConfigEntry<float> Bind(string key, float value, float low, float high, string description) { return ConfigValues.Bind(((BaseUnityPlugin)this).Config, "Cards", key, value, low, high, description + " Restart after changes."); } internal void Initialize() { if (initialized) { return; } initialized = true; try { if (CardAssets.Ids.Length == 0) { throw new InvalidOperationException("No embedded card images."); } GameObject donor = ValuablePrefab.LoadDonor(); BoxCollider collider = StockCollider.FindTemplate(donor); Material template = MaterialFactory.FindTemplate(donor); Mesh mesh = CardAssets.CreateMesh(); GameObject val = ValuablePrefab.CreateStorage("BbdCards Prefabs"); string[] ids = CardAssets.Ids; foreach (string text in ids) { try { RegisterCard(text, donor, val.transform, collider, template, mesh); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Cannot register {text}: {arg}"); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"BBD Cards ready: {registered.Count}/{CardAssets.Ids.Length} valuables registered."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } } private void RegisterCard(string id, GameObject donor, Transform storage, BoxCollider collider, Material template, Mesh mesh) { //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_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_0079: 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_007b: 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) using ValuablePrefab valuablePrefab = new ValuablePrefab(donor, storage, "BbdCards " + id); Material val = valuablePrefab.Own<Material>(CardAssets.CreateMaterial(id, template)); valuablePrefab.Own<Texture>(val.mainTexture); valuablePrefab.AddVisual("Rounded Card", mesh, val); Vector3 size = new Vector3(0.34f, 0.34f, 0.018f); Vector3 center = new Vector3(0f, 0.17f, 0f); StockCollider.Attach(collider, valuablePrefab.Root.transform, "Card Collider", center, size, Quaternion.identity); valuablePrefab.Configure(min.Value, max.Value, mass.Value, fragility.Value, center); valuablePrefab.Root.AddComponent<CardMarker>().CardId = id; registered.Add(valuablePrefab.Register()); } private void Update() { //IL_002b: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (DebugSpawn.TryGetCamera(debugSpawn.Value, (KeyCode)290, registered.Count, out Camera camera)) { Vector3 val = ((Component)camera).transform.position + ((Component)camera).transform.forward * 1.5f; Quaternion val2 = Quaternion.Euler(90f, ((Component)camera).transform.eulerAngles.y, 0f); Valuables.SpawnValuable(registered[nextDebugCard], val, val2); nextDebugCard = (nextDebugCard + 1) % registered.Count; } } } public sealed class CardMarker : MonoBehaviour { public string CardId = ""; } [HarmonyPatch(typeof(RunManager), "Awake")] internal static class RunManagerPatch { [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOLib" })] private static void Postfix() { Plugin.Instance.Initialize(); } } } namespace BbdCards.Helpers { internal static class ConfigValues { public static ConfigEntry<float> Bind(ConfigFile config, string section, string key, float value, float low, float high, string description) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown return config.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(low, high), Array.Empty<object>())); } } internal static class DebugSpawn { public static bool TryGetCamera(bool enabled, KeyCode key, int count, out Camera camera) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) camera = null; if (!enabled || count == 0 || !Input.GetKeyDown(key)) { return false; } if (!SemiFunc.IsMasterClientOrSingleplayer() || !Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated || !Object.op_Implicit((Object)(object)ValuableDirector.instance) || !SemiFunc.RunIsLevel()) { return false; } camera = Camera.main; return Object.op_Implicit((Object)(object)camera); } } internal static class MaterialFactory { public static Material FindTemplate(GameObject donor) { MeshRenderer componentInChildren = donor.GetComponentInChildren<MeshRenderer>(true); if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)((Renderer)componentInChildren).sharedMaterial)) { throw new InvalidOperationException("Base material is missing."); } return ((Renderer)componentInChildren).sharedMaterial; } public static Material Create(Material template, string name, Color color, float metallic, float smoothness) { //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_000e: Expected O, but got Unknown //IL_003b: 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_008a: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(template) { name = name }; try { string[] texturePropertyNames = val.GetTexturePropertyNames(); foreach (string text in texturePropertyNames) { val.SetTexture(text, (Texture)null); } val.shaderKeywords = Array.Empty<string>(); val.color = color; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", Mathf.Clamp01(metallic)); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", Mathf.Clamp01(smoothness)); } val.mainTextureScale = Vector2.one; val.mainTextureOffset = Vector2.zero; return val; } catch { Object.Destroy((Object)(object)val); throw; } } } internal static class StockCollider { internal const float Padding = 0.015f; internal static BoxCollider FindTemplate(GameObject donor) { BoxCollider[] componentsInChildren = donor.GetComponentsInChildren<BoxCollider>(true); foreach (BoxCollider val in componentsInChildren) { if (!((Collider)val).isTrigger && ((Collider)val).enabled && Object.op_Implicit((Object)(object)((Component)val).GetComponent<PhysGrabObjectCollider>()) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<PhysGrabObjectBoxCollider>()) && Object.op_Implicit((Object)(object)((Collider)val).sharedMaterial)) { return val; } } throw new InvalidOperationException("Base prefab has no supported stock valuable collider."); } internal static void Attach(BoxCollider template, Transform parent, string name, Vector3 center, Vector3 size, Quaternion rotation) { //IL_001a: 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_0033: 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_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_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) GameObject obj = Object.Instantiate<GameObject>(((Component)template).gameObject, parent, false); ((Object)obj).name = name; obj.transform.localPosition = center; obj.transform.localRotation = rotation; obj.transform.localScale = Vector3.one; BoxCollider component = obj.GetComponent<BoxCollider>(); component.center = Vector3.zero; component.size = size + Vector3.one * 0.03f; RemoveVisualization(obj); } private static void RemoveVisualization(GameObject obj) { MeshRenderer component = obj.GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } MeshFilter component2 = obj.GetComponent<MeshFilter>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } } internal static Bounds GetBounds(Transform root) { //IL_0002: 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_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_0055: 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_0045: Unknown result type (might be due to invalid IL or missing references) Bounds result = default(Bounds); bool flag = true; BoxCollider[] componentsInChildren = ((Component)root).GetComponentsInChildren<BoxCollider>(true); foreach (BoxCollider val in componentsInChildren) { if (((Collider)val).isTrigger || !((Collider)val).enabled) { continue; } for (int j = 0; j < 8; j++) { Vector3 corner = GetCorner(root, val, j); if (flag) { ((Bounds)(ref result))..ctor(corner, Vector3.zero); flag = false; } else { ((Bounds)(ref result)).Encapsulate(corner); } } } if (flag) { throw new InvalidOperationException("No solid colliders on the valuable prefab."); } return result; } private static Vector3 GetCorner(Transform root, BoxCollider box, int corner) { //IL_0026: 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_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_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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)(((corner & 1) != 0) ? 1 : (-1)), (float)(((corner & 2) != 0) ? 1 : (-1)), (float)(((corner & 4) != 0) ? 1 : (-1))); Vector3 val2 = Vector3.Scale(box.size * 0.5f, val); return root.InverseTransformPoint(((Component)box).transform.TransformPoint(box.center + val2)); } } internal sealed class ValuablePrefab : IDisposable { private readonly List<Object> resources = new List<Object>(); private bool registered; public GameObject Root { get; } public ValuablePrefab(GameObject donor, Transform storage, string name) { //IL_004e: 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_0078: Unknown result type (might be due to invalid IL or missing references) if (((Component)storage).gameObject.activeInHierarchy) { throw new InvalidOperationException("Prefab storage must be inactive."); } Root = Object.Instantiate<GameObject>(donor, storage, false); ((Object)Root).name = name; Root.transform.localPosition = Vector3.zero; Root.transform.localRotation = Quaternion.identity; Root.transform.localScale = Vector3.one; Transform[] array = ((IEnumerable)Root.transform).Cast<Transform>().ToArray(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject); } } public static GameObject LoadDonor() { GameObject obj = Resources.Load<GameObject>("Valuables/02 Small/Valuable Arctic HDD"); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidOperationException("Base prefab Valuable Arctic HDD is missing; check the game version."); } return obj; } public static GameObject CreateStorage(string name) { //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_0013: Expected O, but got Unknown //IL_0014: Expected O, but got Unknown GameObject val = new GameObject(name); val.SetActive(false); Object.DontDestroyOnLoad((Object)val); return val; } public T Own<T>(T resource) where T : Object { resources.Add((Object)(object)resource); return resource; } public void AddVisual(string name, Mesh mesh, Material material) { //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_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) GameObject val = new GameObject(name); val.transform.SetParent(Root.transform, false); val.layer = Root.layer; val.AddComponent<MeshFilter>().sharedMesh = mesh; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material; } public void Configure(float min, float max, float mass, float fragility, Vector3 center) { //IL_0014: 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_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_00cf: 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_00f5: 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_0101: 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) ValuableObject component = Root.GetComponent<ValuableObject>(); component.debugVolume = false; component.volumeType = (Type)1; Value val = this.Own<Value>(ScriptableObject.CreateInstance<Value>()); val.valueMin = min; val.valueMax = Mathf.Max(min, max); component.valuePreset = val; PhysAttribute val2 = this.Own<PhysAttribute>(ScriptableObject.CreateInstance<PhysAttribute>()); val2.mass = mass; component.physAttributePreset = val2; Durability val3 = this.Own<Durability>(ScriptableObject.CreateInstance<Durability>()); val3.fragility = fragility; val3.durability = 100f; component.durabilityPreset = val3; Rigidbody component2 = Root.GetComponent<Rigidbody>(); component2.mass = mass; component2.centerOfMass = center; Root.GetComponent<PhysGrabObject>().massOriginal = mass; GameObject val4 = new GameObject("Center of Mass"); val4.transform.SetParent(Root.transform, false); val4.transform.localPosition = center; Bounds bounds = StockCollider.GetBounds(Root.transform); RoomVolumeCheck component3 = Root.GetComponent<RoomVolumeCheck>(); component3.CheckPosition = ((Bounds)(ref bounds)).center; component3.currentSize = ((Bounds)(ref bounds)).size; } public PrefabRef Register() { PrefabRef result = Valuables.RegisterValuable(Root) ?? throw new InvalidOperationException("REPOLib rejected registration."); registered = true; return result; } public void Dispose() { if (registered) { return; } if (Object.op_Implicit((Object)(object)Root)) { Object.Destroy((Object)(object)Root); } foreach (Object resource in resources) { if (Object.op_Implicit(resource)) { Object.Destroy(resource); } } resources.Clear(); } } }