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 Botany Pots v0.7.70
BepInEx/plugins/BotanyPots/BotanyPots.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.7.70.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 ValheimBotanyPots { internal static class BotanyBlenderModels { private static byte[] worktopGrain; private static int grainSide; internal static int Install(GameObject prefab, MonoBehaviour target, bool isSilo) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown string text = (isSilo ? "Silo" : "SeedTable"); Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Collider[] componentsInChildren2 = prefab.GetComponentsInChildren<Collider>(true); LODGroup[] componentsInChildren3 = prefab.GetComponentsInChildren<LODGroup>(true); Collider val = ((IEnumerable<Collider>)componentsInChildren2).FirstOrDefault((Func<Collider, bool>)((Collider c) => c.enabled && !c.isTrigger)); int layer = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject.layer : prefab.layer); Shader val2 = Shader.Find("Standard"); if ((Object)(object)val2 == (Object)null) { Material? obj = componentsInChildren.Select((Renderer r) => r.sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material m) => (Object)(object)m != (Object)null && m.HasProperty("_Color"))); val2 = ((obj != null) ? obj.shader : null); } if ((Object)(object)val2 == (Object)null) { throw new InvalidOperationException("No shader available for " + text); } GameObject val3 = new GameObject("BotanyBlender_" + text); val3.transform.SetParent(prefab.transform, false); val3.layer = prefab.layer; GameObject val4 = new GameObject("BotanyBlenderCollision"); val4.transform.SetParent(prefab.transform, false); val4.layer = layer; val4.AddComponent<BotanyModelInteraction>().Target = target; int result; try { result = ReadMeshes(val3, text, val2); if (isSilo) { AddSiloCollision(val4, target); } else { AddBenchCollision(val4); } } catch { Object.DestroyImmediate((Object)(object)val3); Object.DestroyImmediate((Object)(object)val4); throw; } LODGroup[] array = componentsInChildren3; for (int num = 0; num < array.Length; num++) { array[num].enabled = false; } Renderer[] array2 = componentsInChildren; foreach (Renderer val5 in array2) { if (val5 is MeshRenderer || val5 is SkinnedMeshRenderer) { val5.enabled = false; } } Collider[] array3 = componentsInChildren2; foreach (Collider val6 in array3) { if (!val6.isTrigger) { val6.enabled = false; } } return result; } internal static int AddBenchDecorations(GameObject parent, Shader nativeShader) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown Shader val = Shader.Find("Standard"); if ((Object)(object)val == (Object)null || !val.isSupported) { val = nativeShader; } if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("No shader for seed table decorations."); } GameObject val2 = new GameObject("BotanySeedTableFlowers"); val2.layer = parent.layer; val2.transform.SetParent(parent.transform, false); try { return ReadMeshes(val2, "SeedTable", val); } catch { Object.DestroyImmediate((Object)(object)val2); throw; } } private static int ReadMeshes(GameObject root, string modelName, Shader shader) { string text = "BotanyPots.Models." + modelName + ".bpm"; using Stream stream = typeof(BotanyBlenderModels).Assembly.GetManifestResourceStream(text); if (stream == null) { throw new FileNotFoundException(text); } using BinaryReader binaryReader = new BinaryReader(stream, Encoding.UTF8); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "BPM1") { throw new InvalidDataException("Unknown mesh format: " + modelName); } int num = binaryReader.ReadInt32(); if (num < 1 || num > 256) { throw new InvalidDataException("Invalid surface count"); } int num2 = 0; for (int i = 0; i < num; i++) { num2 += ReadSurface(binaryReader, root, shader, modelName == "Silo"); } if (stream.Position != stream.Length) { throw new InvalidDataException("Unexpected mesh data"); } return num2; } private static int ReadSurface(BinaryReader reader, GameObject root, Shader shader, bool isSilo) { //IL_00d6: 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_00f6: 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_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_0161: 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_017f: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01e4: 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_022c: 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_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) int num = reader.ReadInt32(); if (num < 1 || num > 1024) { throw new InvalidDataException("Invalid material name"); } string text = Encoding.UTF8.GetString(reader.ReadBytes(num)); Color val = default(Color); ((Color)(ref val))..ctor(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 1f); float num2 = reader.ReadSingle(); float num3 = reader.ReadSingle(); int num4 = reader.ReadInt32(); int num5 = reader.ReadInt32(); if (num4 < 3 || num4 > 65535 || num5 < 3 || num5 > 1000000 || num5 % 3 != 0) { throw new InvalidDataException("Invalid mesh dimensions for " + text); } Vector3[] array = (Vector3[])(object)new Vector3[num4]; Vector3[] array2 = (Vector3[])(object)new Vector3[num4]; Vector2[] array3 = (Vector2[])(object)new Vector2[num4]; for (int i = 0; i < num4; i++) { array[i] = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); array2[i] = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); array3[i] = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } int[] array4 = new int[num5]; for (int j = 0; j < array4.Length; j++) { array4[j] = reader.ReadUInt16(); if (array4[j] >= num4) { throw new InvalidDataException("Mesh index outside vertex buffer"); } } Mesh val2 = new Mesh { name = ((Object)root).name + "_" + text }; val2.vertices = array; val2.normals = array2; val2.uv = array3; val2.triangles = array4; val2.RecalculateBounds(); Material val3 = new Material(shader) { name = "BotanyBlender_" + text }; if (!isSilo && val3.HasProperty("_MainTex")) { bool hasGrain = IsBenchTimber(text); val3.SetTexture("_MainTex", (Texture)(object)CreateBenchAlbedo(text, val, hasGrain)); if (val3.HasProperty("_Color")) { val3.SetColor("_Color", Color.white); } } else if (val3.HasProperty("_Color")) { val3.SetColor("_Color", isSilo ? val : ((Color)(ref val)).gamma); } if (val3.HasProperty("_Glossiness")) { val3.SetFloat("_Glossiness", (!isSilo && IsBenchTimber(text)) ? 0.09f : num2); } if (val3.HasProperty("_Metallic")) { val3.SetFloat("_Metallic", num3); } if (isSilo) { if (val3.HasProperty("_GlossyReflections")) { val3.SetFloat("_GlossyReflections", 0f); val3.EnableKeyword("_GLOSSYREFLECTIONS_OFF"); } if (text != "Copper" && val3.HasProperty("_SpecularHighlights")) { val3.SetFloat("_SpecularHighlights", 0f); val3.EnableKeyword("_SPECULARHIGHLIGHTS_OFF"); } } GameObject val4 = new GameObject(text); val4.transform.SetParent(root.transform, false); val4.layer = root.layer; val4.AddComponent<MeshFilter>().sharedMesh = val2; MeshRenderer obj = val4.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = val3; ((Renderer)obj).allowOcclusionWhenDynamic = false; return array4.Length / 3; } private static bool IsBenchTimber(string name) { if (!name.StartsWith("Worktop_", StringComparison.Ordinal) && !name.StartsWith("Bench_", StringComparison.Ordinal)) { return name == "Backboard_Oak"; } return true; } private static Texture2D CreateBenchAlbedo(string name, Color linearColor, bool hasGrain) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_009b: 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_00b1: 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_0048: 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_00c5: 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_00d5: Expected O, but got Unknown //IL_007a: 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_0084: Unknown result type (might be due to invalid IL or missing references) if (hasGrain) { LoadWorktopGrain(); } int num = ((!hasGrain) ? 1 : grainSide); bool flag = (int)QualitySettings.activeColorSpace == 0; Color32[] array = (Color32[])(object)new Color32[num * num]; Color val = default(Color); for (int i = 0; i < array.Length; i++) { float num2 = (hasGrain ? ((float)(int)worktopGrain[i * 4] / 255f) : 1f); ((Color)(ref val))..ctor(linearColor.r * num2, linearColor.g * num2, linearColor.b * num2, 1f); array[i] = Color32.op_Implicit((hasGrain || flag) ? ((Color)(ref val)).gamma : val); } Texture2D val2 = new Texture2D(num, num, (TextureFormat)4, hasGrain, !hasGrain) { name = "BotanyBenchAlbedo_" + name, wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)((!hasGrain) ? 1 : 2) }; val2.SetPixels32(array); val2.Apply(hasGrain, true); return val2; } private static void LoadWorktopGrain() { if (worktopGrain != null) { return; } using Stream stream = typeof(BotanyBlenderModels).Assembly.GetManifestResourceStream("BotanyPots.Models.WorktopGrain.rgba"); if (stream == null) { throw new FileNotFoundException("BotanyPots.Models.WorktopGrain.rgba"); } using BinaryReader binaryReader = new BinaryReader(stream); int num = binaryReader.ReadInt32(); if (num < 1 || num > 1024) { throw new InvalidDataException("Invalid worktop texture dimensions"); } int num2 = num * num * 4; byte[] array = binaryReader.ReadBytes(num2); if (array.Length != num2 || stream.Position != stream.Length) { throw new InvalidDataException("Invalid worktop texture data"); } grainSide = num; worktopGrain = array; } private static void AddBenchCollision(GameObject root) { float[] array = new float[2] { -0.76f, 0.76f }; foreach (float x in array) { Box(root, x, 0.445f, -0.34f, 0.134f, 0.89f, 0.139f); Box(root, x, 0.851f, 0.35f, 0.136f, 1.702f, 0.145f); } Box(root, 0f, 0.89f, 0f, 1.84f, 0.12f, 0.95f); Box(root, 0f, 0.334f, 0.046f, 1.54f, 0.075f, 0.6f); Box(root, 0f, 1.285f, 0.274f, 1.63f, 0.072f, 0.334f); Box(root, 0f, 1.461f, 0.372f, 1.406f, 0.304f, 0.062f); Box(root, 0f, 1.653f, 0.351f, 1.67f, 0.102f, 0.165f); } private static void AddSiloCollision(GameObject root, MonoBehaviour target) { Hull(root, target, "Base", new float[3] { 0f, 0.235f, 0.345f }, new float[3] { 1.13f, 1.14f, 1.013f }); Hull(root, target, "Barrel", new float[2] { 0.31f, 4.34f }, new float[2] { 1.023f, 1.029f }); Hull(root, target, "Roof", new float[4] { 4.29f, 4.56f, 4.89f, 5.057f }, new float[4] { 1.165f, 1.064f, 0.69f, 0.095f }); Box(root, 0f, 0.11f, -1.165f, 0.74f, 0.22f, 0.41f); Box(root, 0f, 0.86f, -1.1f, 0.74f, 1.11f, 0.2f); } private static void Box(GameObject root, float x, float y, float z, float w, float h, float d) { //IL_000a: 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) BoxCollider obj = root.AddComponent<BoxCollider>(); obj.center = new Vector3(x, y, z); obj.size = new Vector3(w, h, d); } private static void Hull(GameObject root, MonoBehaviour target, string name, float[] y, float[] radius) { //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_0149: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_0186: 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_01a9: Unknown result type (might be due to invalid IL or missing references) int num = y.Length; Vector3[] array = (Vector3[])(object)new Vector3[num * 16]; int[] array2 = new int[((num - 1) * 16 * 2 + 28) * 3]; int num2 = 0; for (int i = 0; i < num; i++) { for (int j = 0; j < 16; j++) { float num3 = (float)j * (float)Math.PI * 2f / 16f; int num4 = i * 16 + j; int num5 = i * 16 + (j + 1) % 16; array[num4] = new Vector3(Mathf.Sin(num3) * radius[i], y[i], Mathf.Cos(num3) * radius[i]); if (i + 1 < num) { array2[num2++] = num4; array2[num2++] = num5; array2[num2++] = num5 + 16; array2[num2++] = num4; array2[num2++] = num5 + 16; array2[num2++] = num4 + 16; } } } int num6 = (num - 1) * 16; for (int k = 1; k < 15; k++) { array2[num2++] = 0; array2[num2++] = k + 1; array2[num2++] = k; array2[num2++] = num6; array2[num2++] = num6 + k; array2[num2++] = num6 + k + 1; } Mesh val = new Mesh { name = "Botany_" + name + "_Hull", vertices = array, triangles = array2 }; val.RecalculateBounds(); GameObject val2 = new GameObject(name + "Hit") { layer = root.layer }; val2.transform.SetParent(root.transform, false); val2.AddComponent<BotanyModelInteraction>().Target = target; MeshCollider obj = val2.AddComponent<MeshCollider>(); obj.convex = true; obj.sharedMesh = val; } } internal static class BotanyBuildings { private enum Surface { Timber, Oak, Sage, Stone, Copper, Clay, Patina, Leaf, Cream, Pink, Blue, Gold } private sealed class Building { private readonly Transform visuals; private readonly Transform collision; private readonly Renderer[] oldRenderers; private readonly Collider[] oldColliders; private readonly LODGroup[] oldLods; private readonly Material[] materials; private readonly int visualLayer; private readonly int physicsLayer; internal Building(GameObject prefab, MonoBehaviour target, string name) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown oldRenderers = prefab.GetComponentsInChildren<Renderer>(true); oldColliders = prefab.GetComponentsInChildren<Collider>(true); oldLods = prefab.GetComponentsInChildren<LODGroup>(true); Collider val = ((IEnumerable<Collider>)oldColliders).FirstOrDefault((Func<Collider, bool>)((Collider c) => c.enabled && !c.isTrigger)); physicsLayer = (((Object)(object)val == (Object)null) ? prefab.layer : ((Component)val).gameObject.layer); visualLayer = prefab.layer; Shader shader = Shader.Find("Standard"); if ((Object)(object)shader == (Object)null) { shader = oldRenderers.Select((Renderer r) => r.sharedMaterial).First((Material m) => (Object)(object)m != (Object)null).shader; } materials = Colors.Select(delegate(Color32 color, int i) { //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_002b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Material val4 = new Material(shader); Surface surface = (Surface)i; ((Object)val4).name = "BotanyBuilding_" + surface; Material val5 = val4; if (val5.HasProperty("_Color")) { val5.SetColor("_Color", Color32.op_Implicit(color)); } if (val5.HasProperty("_Glossiness")) { val5.SetFloat("_Glossiness", 0.14f); } return val5; }).ToArray(); GameObject val2 = new GameObject(name); val2.layer = visualLayer; val2.transform.SetParent(prefab.transform, false); visuals = val2.transform; GameObject val3 = new GameObject(name + "Interaction"); val3.layer = physicsLayer; val3.transform.SetParent(prefab.transform, false); val3.AddComponent<BotanyModelInteraction>().Target = target; collision = val3.transform; } private unsafe Mesh Add(PrimitiveType shape, Surface surface, Vector3 center, Vector3 scale, Quaternion rotation) { //IL_0000: 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_0083: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive(shape); ((Object)obj).name = surface.ToString() + "_" + ((object)(*(PrimitiveType*)(&shape))/*cast due to .constrained prefix*/).ToString(); Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } obj.layer = visualLayer; obj.transform.SetParent(visuals, false); obj.transform.localPosition = center; obj.transform.localRotation = rotation; obj.transform.localScale = scale; MeshRenderer component2 = obj.GetComponent<MeshRenderer>(); ((Renderer)component2).sharedMaterial = materials[(int)surface]; ((Renderer)component2).allowOcclusionWhenDynamic = false; return obj.GetComponent<MeshFilter>().sharedMesh; } internal void Box(Surface surface, Vector3 center, Vector3 size, bool solid = false) { //IL_0003: 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_0005: 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) Add((PrimitiveType)3, surface, center, size, Quaternion.identity); if (solid) { BoxCollider obj = ((Component)collision).gameObject.AddComponent<BoxCollider>(); obj.center = center; obj.size = size; } } internal void Cylinder(Surface surface, Vector3 center, float radius, float height, bool solid = false) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_006b: 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) Vector3 val = V(radius * 2f, height * 0.5f, radius * 2f); Mesh sharedMesh = Add((PrimitiveType)2, surface, center, val, Quaternion.identity); if (solid) { GameObject val2 = new GameObject("RoundHit") { layer = physicsLayer }; val2.transform.SetParent(collision, false); val2.transform.localPosition = center; val2.transform.localScale = val; val2.AddComponent<BotanyModelInteraction>().Target = ((Component)collision).GetComponent<BotanyModelInteraction>().Target; MeshCollider obj = val2.AddComponent<MeshCollider>(); obj.convex = true; obj.sharedMesh = sharedMesh; } } internal void Ball(Surface surface, Vector3 center, Vector3 size) { //IL_0003: 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_0005: Unknown result type (might be due to invalid IL or missing references) Add((PrimitiveType)0, surface, center, size, Quaternion.identity); } internal void Stem(Vector3 a, Vector3 b, float width) { //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_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_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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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_0030: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Add((PrimitiveType)3, Surface.Leaf, (a + b) * 0.5f, V(width, ((Vector3)(ref val)).magnitude, width), Quaternion.FromToRotation(Vector3.up, val)); } internal void Flower(Vector3 center, float size, Surface surface) { //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) //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_003c: 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_0058: 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_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_009f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 5; i++) { float num = (float)i * (float)Math.PI * 0.4f; Vector3 val = V(Mathf.Sin(num), Mathf.Cos(num), 0f) * size * 0.51f; Ball(surface, center + val, V(size * 0.5f, size * 0.5f, size * 0.32f)); } Ball(Surface.Gold, center + V(0f, 0f, (0f - size) * 0.17f), V(size * 0.47f, size * 0.47f, size * 0.31f)); } internal void Garland(float halfWidth, float y, float z, float sag) { //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_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_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_007a: 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_00bf: 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_008a: 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) Vector3 a = V(0f - halfWidth, y, z); for (int i = 0; i <= 6; i++) { float num = (float)i / 6f; Vector3 val = V(Mathf.Lerp(0f - halfWidth, halfWidth, num), y - 4f * num * (1f - num) * sag, z); if (i > 0) { Stem(a, val, 0.018f); } Ball(Surface.Leaf, val + V(0.025f, -0.023f, 0f), V(0.087f, 0.042f, 0.035f)); if ((i & 1) == 0) { Flower(val + V(0f, 0f, -0.016f), 0.064f, i switch { 4 => Surface.Blue, 2 => Surface.Pink, _ => Surface.Cream, }); } a = val; } } internal void Finish() { LODGroup[] array = oldLods; for (int i = 0; i < array.Length; i++) { array[i].enabled = false; } Renderer[] array2 = oldRenderers; foreach (Renderer val in array2) { if (val is MeshRenderer || val is SkinnedMeshRenderer) { val.enabled = false; } } Collider[] array3 = oldColliders; foreach (Collider val2 in array3) { if (!val2.isTrigger) { val2.enabled = false; } } } } private static readonly Color32[] Colors = (Color32[])(object)new Color32[12] { new Color32((byte)102, (byte)68, (byte)43, byte.MaxValue), new Color32((byte)157, (byte)108, (byte)69, byte.MaxValue), new Color32((byte)78, (byte)114, (byte)90, byte.MaxValue), new Color32((byte)103, (byte)105, (byte)100, byte.MaxValue), new Color32((byte)170, (byte)104, (byte)58, byte.MaxValue), new Color32((byte)153, (byte)76, (byte)54, byte.MaxValue), new Color32((byte)47, (byte)111, (byte)105, byte.MaxValue), new Color32((byte)64, (byte)110, (byte)51, byte.MaxValue), new Color32((byte)238, (byte)220, (byte)172, byte.MaxValue), new Color32((byte)215, (byte)110, (byte)133, byte.MaxValue), new Color32((byte)132, (byte)149, (byte)204, byte.MaxValue), new Color32((byte)223, (byte)170, (byte)79, byte.MaxValue) }; internal static void Bench(GameObject prefab, CraftingStation station) { //IL_003b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00d0: 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_0100: 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_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_0160: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_022d: 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_0262: 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_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: 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_0310: 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_0322: Unknown result type (might be due to invalid IL or missing references) Building building = new Building(prefab, (MonoBehaviour)(object)station, "SeedNursery"); int[] array = new int[2] { -1, 1 }; for (int i = 0; i < array.Length; i++) { float x = (float)array[i] * 0.72f; building.Box(Surface.Timber, V(x, 0.44f, -0.33f), V(0.15f, 0.88f, 0.15f), solid: true); building.Box(Surface.Timber, V(x, 0.85f, 0.34f), V(0.15f, 1.7f, 0.15f), solid: true); building.Box(Surface.Sage, V(x, 0.4f, 0.01f), V(0.13f, 0.17f, 0.69f)); } building.Box(Surface.Oak, V(0f, 0.89f, 0f), V(1.74f, 0.13f, 0.91f), solid: true); building.Box(Surface.Sage, V(0f, 0.77f, -0.39f), V(1.55f, 0.18f, 0.13f)); building.Box(Surface.Timber, V(0f, 0.38f, 0.06f), V(1.53f, 0.095f, 0.58f), solid: true); building.Box(Surface.Oak, V(0f, 1.275f, 0.335f), V(1.47f, 0.085f, 0.27f), solid: true); building.Box(Surface.Sage, V(0f, 1.58f, 0.34f), V(1.6f, 0.16f, 0.16f), solid: true); building.Box(Surface.Timber, V(0f, 1.43f, 0.365f), V(1.37f, 0.3f, 0.09f)); building.Garland(0.66f, 1.53f, 0.256f, 0.14f); building.Garland(0.66f, 0.78f, -0.49f, 0.11f); for (int j = -1; j <= 1; j++) { building.Box(Surface.Cream, V((float)j * 0.14f, 0.966f, -0.13f), V(0.115f, 0.023f, 0.21f)); building.Ball(Surface.Gold, V((float)j * 0.14f, 0.984f, -0.13f), V(0.062f, 0.023f, 0.066f)); } array = new int[2] { -1, 1 }; for (int i = 0; i < array.Length; i++) { float num = (float)array[i] * 0.54f; building.Cylinder(Surface.Clay, V(num, 1.027f, -0.11f), 0.098f, 0.145f); for (int k = -1; k <= 1; k++) { Vector3 val = V(num + (float)k * 0.07f, 1.25f + 0.05f * (float)(1 - Mathf.Abs(k)), -0.11f); building.Stem(V(num, 1.08f, -0.11f), val, 0.017f); building.Flower(val, 0.069f, (k < 0) ? Surface.Blue : ((k == 0) ? Surface.Cream : Surface.Pink)); } } building.Finish(); } internal static void Silo(GameObject prefab, Container chest) { //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) //IL_0082: 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_00f9: 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_0152: 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_0181: 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_01b1: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) Building building = new Building(prefab, (MonoBehaviour)(object)chest, "TimberSilo"); building.Cylinder(Surface.Stone, V(0f, 0.19f, 0f), 1.13f, 0.38f, solid: true); building.Cylinder(Surface.Oak, V(0f, 2.29f, 0f), 0.965f, 3.92f, solid: true); float[] array = new float[4] { 0.4f, 1.6f, 2.9f, 4.18f }; foreach (float y in array) { building.Cylinder(Surface.Sage, V(0f, y, 0f), 1.013f, 0.105f); } building.Cylinder(Surface.Copper, V(0f, 4.27f, 0f), 1.12f, 0.13f, solid: true); float[] array2 = new float[8] { 1.104f, 1.068f, 1.015f, 0.936f, 0.826f, 0.686f, 0.51f, 0.305f }; for (int j = 0; j < array2.Length; j++) { building.Cylinder(Surface.Patina, V(0f, 4.342f + (float)j * 0.094f, 0f), array2[j], 0.102f, solid: true); } building.Cylinder(Surface.Copper, V(0f, 5.067f, 0f), 0.207f, 0.07f); building.Ball(Surface.Gold, V(0f, 5.107f, 0f), V(0.097f, 0.072f, 0.097f)); building.Box(Surface.Stone, V(0f, 0.1f, -1.1f), V(0.7f, 0.2f, 0.36f), solid: true); building.Box(Surface.Timber, V(0f, 0.79f, -0.937f), V(0.7f, 1.05f, 0.29f), solid: true); building.Box(Surface.Sage, V(0f, 0.79f, -1.103f), V(0.57f, 0.87f, 0.067f)); array = new float[2] { 0.47f, 1.1f }; foreach (float y2 in array) { building.Box(Surface.Copper, V(0f, y2, -1.15f), V(0.51f, 0.042f, 0.031f)); } building.Ball(Surface.Gold, V(0.16f, 0.79f, -1.16f), V(0.073f, 0.073f, 0.075f)); building.Garland(0.31f, 1.36f, -1.079f, 0.075f); int[] array3 = new int[2] { -1, 1 }; foreach (int num in array3) { building.Box(Surface.Timber, V((float)num * 0.958f, 3.52f, 0f), V(0.17f, 0.44f, 0.38f)); building.Box(Surface.Sage, V((float)num * 1.051f, 3.52f, 0f), V(0.04f, 0.34f, 0.29f)); for (int k = -1; k <= 1; k++) { building.Box(Surface.Copper, V((float)num * 1.08f, 3.52f + (float)k * 0.079f, 0f), V(0.034f, 0.03f, 0.248f)); } } building.Finish(); } private static Vector3 V(float x, float y, float z) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } } internal static class BotanyFittings { internal static void SiloAnnex(GameObject prefab, int tier) { //IL_00c6: 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_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) MeshRenderer val = Mesh("wood_beam_1", "wood_beam"); MeshRenderer post = Mesh("wood_pole", "wood_pole_log"); MeshRenderer floor = Mesh("wood_floor", "wood_floor_1x1"); Transform val2 = Start(prefab, null); Material[] materials; switch (tier) { case 0: materials = BronzeAnnex(val2, val, post); break; case 1: materials = IronAnnex(val2, val, post, floor); break; default: { MeshRenderer stone = Mesh("stone_floor", "stone_wall_1x1", "wood_floor"); materials = SilverAnnex(val2, val, post, floor, stone); break; } } BotanyNativeBench.Place(val, val2, "Transfer chute", new Vector3(0f, 1.04f, -0.65f), new Vector3(0.31f, 0.24f, 0.37f), 90f, upright: false, horizontalPanel: false, materials); Hit(val2, new Vector3(0f, 0.89f, 0f), new Vector3(0.9f, 1.78f, 0.9f)); } private static Material[] BronzeAnnex(Transform root, MeshRenderer beam, MeshRenderer post) { //IL_0010: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b5: 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_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_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_00f2: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01c8: Unknown result type (might be due to invalid IL or missing references) Material[] materials = Tinted(post, new Color(0.89f, 0.65f, 0.4f)); Material[] array = Tinted(beam, new Color(1f, 0.62f, 0.27f)); Material[] materials2 = Tinted(beam, new Color(0.36f, 0.76f, 0.62f)); BotanyNativeBench.Place(beam, root, "Wooden plinth", new Vector3(0f, 0.085f, 0f), new Vector3(1.04f, 0.17f, 1.04f)); for (int i = 0; i < 10; i++) { float num = (float)i * 36f; Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; BotanyNativeBench.Place(post, root, "Rounded stave", val * 0.476f + Vector3.up * 0.88f, new Vector3(0.327f, 1.46f, 0.115f), num, upright: true, horizontalPanel: false, materials); float[] array2 = new float[3] { 0.32f, 0.83f, 1.36f }; foreach (float num2 in array2) { BotanyNativeBench.Place(beam, root, "Bronze hoop", val * 0.537f + Vector3.up * num2, new Vector3(0.36f, 0.105f, 0.083f), num, upright: false, horizontalPanel: false, array); } for (int k = 0; k < 3; k++) { float num3 = 0.53f - (float)k * 0.17f; BotanyNativeBench.Place(beam, root, "Green cap", val * num3 + Vector3.up * (1.6f + (float)k * 0.13f), new Vector3(num3 * 0.71f, 0.15f, 0.28f), num, upright: false, horizontalPanel: false, materials2); } } BotanyNativeBench.Place(beam, root, "Bronze finial", new Vector3(0f, 1.96f, 0f), new Vector3(0.23f, 0.16f, 0.23f), 0f, upright: false, horizontalPanel: false, array); return array; } private static Material[] IronAnnex(Transform root, MeshRenderer beam, MeshRenderer post, MeshRenderer floor) { //IL_0010: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b5: 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_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_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_00f2: 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_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_015e: 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_0171: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) Material[] materials = Tinted(floor, new Color(0.56f, 0.57f, 0.38f)); Material[] array = Tinted(beam, new Color(0.52f, 0.56f, 0.61f)); Material[] materials2 = Tinted(post, new Color(0.67f, 0.7f, 0.71f)); BotanyNativeBench.Place(floor, root, "Low square iron bin", new Vector3(0f, 0.12f, 0f), new Vector3(1.03f, 0.24f, 1.03f), 0f, upright: false, horizontalPanel: true, materials); float[] array2; for (int i = 0; i < 4; i++) { float num = (float)i * 90f; Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; BotanyNativeBench.Place(floor, root, "Square plank wall", val * 0.45f + Vector3.up * 0.73f, new Vector3(0.92f, 0.13f, 1.07f), 0f, upright: false, horizontalPanel: true, materials).localRotation = Quaternion.Euler(0f, num, 0f) * Quaternion.Euler(90f, 0f, 0f); array2 = new float[2] { 0.26f, 1.24f }; foreach (float num2 in array2) { BotanyNativeBench.Place(beam, root, "Heavy iron rail", val * 0.488f + Vector3.up * num2, new Vector3(1.02f, 0.125f, 0.12f), num, upright: false, horizontalPanel: false, array); } } array2 = new float[2] { -0.49f, 0.49f }; foreach (float num3 in array2) { float[] array3 = new float[2] { -0.49f, 0.49f }; foreach (float num4 in array3) { BotanyNativeBench.Place(post, root, "Corner brace", new Vector3(num3, 0.75f, num4), new Vector3(0.13f, 1.39f, 0.13f), 0f, upright: true, horizontalPanel: false, materials2); } } BotanyNativeBench.Place(floor, root, "Flat mossy lid", new Vector3(0f, 1.43f, 0f), new Vector3(1.11f, 0.14f, 1.11f), 0f, upright: false, horizontalPanel: true, materials); array2 = new float[3] { -0.34f, 0f, 0.34f }; foreach (float num5 in array2) { BotanyNativeBench.Place(beam, root, "Iron lid strap", new Vector3(num5, 1.51f, 0f), new Vector3(1.07f, 0.075f, 0.105f), 90f, upright: false, horizontalPanel: false, array); } return array; } private static Material[] SilverAnnex(Transform root, MeshRenderer beam, MeshRenderer post, MeshRenderer floor, MeshRenderer stone) { //IL_0011: 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_004e: 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_0075: 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_00b3: 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_0111: 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_015e: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) Material[] materials = Tinted(stone, new Color(0.87f, 0.91f, 1f)); Material[] materials2 = Tinted(floor, new Color(0.4f, 0.54f, 0.77f)); Color tint = default(Color); ((Color)(ref tint))..ctor(0.85f, 0.94f, 1f); Material[] array = Tinted(beam, tint); Material[] materials3 = Tinted(post, tint); BotanyNativeBench.Place(stone, root, "Pale stone base", new Vector3(0f, 0.19f, 0f), new Vector3(1.08f, 0.38f, 1.04f), 0f, upright: false, horizontalPanel: true, materials); BotanyNativeBench.Place(stone, root, "Stone hopper", new Vector3(0f, 0.82f, 0f), new Vector3(0.81f, 0.95f, 0.83f), 0f, upright: false, horizontalPanel: true, materials); float[] array2 = new float[2] { -0.4f, 0.4f }; foreach (float num in array2) { BotanyNativeBench.Place(post, root, "Silver upright", new Vector3(num, 0.92f, 0.423f), new Vector3(0.105f, 1.09f, 0.11f), 0f, upright: true, horizontalPanel: false, materials3); } BotanyNativeBench.Place(stone, root, "Roof seat", new Vector3(0f, 1.37f, 0f), new Vector3(1.02f, 0.2f, 1.01f), 0f, upright: false, horizontalPanel: true, materials); array2 = new float[2] { -0.47f, 0.47f }; foreach (float num2 in array2) { for (int j = 0; j < 3; j++) { BotanyNativeBench.Place(beam, root, "Gable plank", new Vector3(0f, 1.59f + (float)j * 0.14f, num2), new Vector3(0.75f - (float)j * 0.23f, 0.15f, 0.085f), 0f, upright: false, horizontalPanel: false, array); } } int[] array3 = new int[2] { -1, 1 }; foreach (int num3 in array3) { BotanyNativeBench.Place(floor, root, "High slate roof", new Vector3((float)num3 * 0.27f, 1.74f, 0f), new Vector3(0.8f, 0.11f, 1.14f), 0f, upright: false, horizontalPanel: true, materials2).localRotation = Quaternion.Euler(0f, 0f, (float)(-num3) * 51f); } BotanyNativeBench.Place(beam, root, "Silver roof ridge", new Vector3(0f, 2.06f, 0f), new Vector3(1.17f, 0.12f, 0.14f), 90f, upright: false, horizontalPanel: false, array); return array; } internal static void SeedChest(GameObject prefab, Container container) { //IL_0050: 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_008d: 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_00ca: 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_012b: 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_0165: 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_01c0: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) MeshRenderer source = Mesh("wood_floor", "wood_floor_1x1"); MeshRenderer source2 = Mesh("wood_beam_1", "wood_beam"); Transform parent = Start(prefab, (MonoBehaviour)(object)container); Material[] materials = Tinted(source2, new Color(0.39f, 0.65f, 0.46f)); Material[] materials2 = Tinted(source2, new Color(0.96f, 0.74f, 0.38f)); BotanyNativeBench.Place(source, parent, "Plank chest", new Vector3(0f, 0.33f, 0f), new Vector3(1.13f, 0.55f, 0.64f), 0f, upright: false, horizontalPanel: true); BotanyNativeBench.Place(source, parent, "Lid", new Vector3(0f, 0.64f, 0f), new Vector3(1.23f, 0.11f, 0.75f), 0f, upright: false, horizontalPanel: true); float[] array = new float[2] { -0.42f, 0.42f }; foreach (float num in array) { BotanyNativeBench.Place(source2, parent, "Foot rail", new Vector3(num, 0.065f, 0f), new Vector3(0.72f, 0.13f, 0.15f), 90f); BotanyNativeBench.Place(source2, parent, "Green lid strap", new Vector3(num, 0.708f, 0f), new Vector3(0.75f, 0.04f, 0.11f), 90f, upright: false, horizontalPanel: false, materials); float[] array2 = new float[2] { -0.34f, 0.34f }; foreach (float num2 in array2) { BotanyNativeBench.Place(source2, parent, "Green front strap", new Vector3(num, 0.37f, num2), new Vector3(0.11f, 0.49f, 0.045f), 0f, upright: false, horizontalPanel: false, materials); } } array = new float[2] { -0.352f, 0.352f }; foreach (float num3 in array) { BotanyNativeBench.Place(source2, parent, "Brass latch", new Vector3(0f, 0.551f, num3), new Vector3(0.14f, 0.145f, 0.07f), 0f, upright: false, horizontalPanel: false, materials2); for (int k = -1; k <= 1; k++) { BotanyNativeBench.Place(source2, parent, "Seed inlay", new Vector3((float)k * 0.1f, 0.35f, num3), new Vector3(0.05f, 0.09f, 0.028f), 0f, upright: false, horizontalPanel: false, materials2).localRotation = Quaternion.Euler(0f, 0f, -27f + 12f * (float)k); } } Hit(parent, new Vector3(0f, 0.36f, 0f), new Vector3(1.22f, 0.72f, 0.75f)); } internal static void PotBoard(GameObject prefab, BotanyPotBoard board) { //IL_0091: 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_00c9: 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_0124: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_02b5: 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_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) MeshRenderer source = Mesh("wood_floor", "wood_floor_1x1"); MeshRenderer source2 = Mesh("wood_beam_1", "wood_beam"); MeshRenderer source3 = Mesh("wood_pole", "wood_pole_log"); MeshRenderer source4 = Mesh("stone_floor", "stone_wall_1x1", "wood_floor"); Transform parent = Start(prefab, (MonoBehaviour)(object)board); Material[] materials = Tinted(source2, new Color(0.53f, 0.73f, 0.49f)); Material[] materials2 = Tinted(source2, new Color(1f, 0.86f, 0.62f)); Material[] materials3 = Tinted(source, new Color(0.44f, 0.63f, 0.42f)); float[] array = new float[2] { -0.55f, 0.55f }; foreach (float num in array) { BotanyNativeBench.Place(source4, parent, "Stone footing", new Vector3(num, 0.092f, 0.01f), new Vector3(0.25f, 0.184f, 0.36f), 0f, upright: false, horizontalPanel: true); BotanyNativeBench.Place(source3, parent, "Timber standard", new Vector3(num, 0.84f, 0.03f), new Vector3(0.16f, 1.5f, 0.17f), 0f, upright: true); } BotanyNativeBench.Place(source, parent, "Notice board", new Vector3(0f, 1.08f, 0f), new Vector3(1.19f, 0.15f, 0.65f), 0f, upright: false, horizontalPanel: true).localRotation = Quaternion.Euler(90f, 0f, 0f); array = new float[2] { 0.74f, 1.42f }; foreach (float num2 in array) { BotanyNativeBench.Place(source2, parent, "Green frame", new Vector3(0f, num2, -0.06f), new Vector3(1.28f, 0.11f, 0.2f), 0f, upright: false, horizontalPanel: false, materials); } BotanyNativeBench.Place(source, parent, "Sloped garden awning", new Vector3(0f, 1.57f, -0.17f), new Vector3(1.44f, 0.12f, 0.72f), 0f, upright: false, horizontalPanel: true, materials3).localRotation = Quaternion.Euler(-16f, 0f, 0f); BotanyNativeBench.Place(source, parent, "Potting ledge", new Vector3(0f, 0.7f, -0.15f), new Vector3(1.25f, 0.075f, 0.44f), 0f, upright: false, horizontalPanel: true); for (int j = 0; j < 2; j++) { BotanyNativeBench.Place(source2, parent, "Ledger strip", new Vector3(0.05f, 1.25f - 0.18f * (float)j, -0.1f), new Vector3(0.53f, 0.09f, 0.035f), 0f, upright: false, horizontalPanel: false, materials2); } for (int k = 0; k < 3; k++) { float num3 = (float)(k - 1) * 0.36f; BotanyNativeBench.Place(source2, parent, "Seed drawer", new Vector3(num3, 0.61f, -0.17f), new Vector3(0.32f, 0.13f, 0.23f), 0f, upright: false, horizontalPanel: false, materials); BotanyNativeBench.Place(source2, parent, "Drawer pull", new Vector3(num3, 0.61f, -0.3f), new Vector3(0.093f, 0.04f, 0.04f), 0f, upright: false, horizontalPanel: false, materials2); } Hit(parent, new Vector3(0f, 1.07f, -0.025f), new Vector3(1.25f, 0.72f, 0.24f)); Hit(parent, new Vector3(0f, 0.64f, -0.1f), new Vector3(1.25f, 0.17f, 0.4f)); Hit(parent, new Vector3(0f, 1.57f, -0.17f), new Vector3(1.38f, 0.15f, 0.57f)); array = new float[2] { -0.55f, 0.55f }; foreach (float num4 in array) { Hit(parent, new Vector3(num4, 0.43f, 0.03f), new Vector3(0.18f, 0.86f, 0.2f)); } } private static MeshRenderer Mesh(params string[] names) { return BotanyNativeBench.FindWood(names) ?? throw new InvalidOperationException("Missing native build mesh " + names[0]); } private static Material[] Tinted(MeshRenderer source, Color tint) { //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) return ((Renderer)source).sharedMaterials.Select(delegate(Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0020: 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) Material val = new Material(material); if (val.HasProperty("_Color")) { val.SetColor("_Color", val.GetColor("_Color") * tint); } return val; }).ToArray(); } private static Transform Start(GameObject prefab, MonoBehaviour target) { //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_005b: Expected O, but got Unknown Collider[] componentsInChildren = prefab.GetComponentsInChildren<Collider>(true); Collider val = ((IEnumerable<Collider>)componentsInChildren).FirstOrDefault((Func<Collider, bool>)((Collider collider) => collider.enabled && !collider.isTrigger)); GameObject val2 = new GameObject("BotanyFitting") { layer = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject.layer : prefab.layer) }; LODGroup[] componentsInChildren2 = prefab.GetComponentsInChildren<LODGroup>(true); for (int num = 0; num < componentsInChildren2.Length; num++) { componentsInChildren2[num].enabled = false; } Renderer[] componentsInChildren3 = prefab.GetComponentsInChildren<Renderer>(true); for (int num = 0; num < componentsInChildren3.Length; num++) { componentsInChildren3[num].enabled = false; } Collider[] array = componentsInChildren; for (int num = 0; num < array.Length; num++) { array[num].enabled = false; } val2.transform.SetParent(prefab.transform, false); if ((Object)(object)target != (Object)null) { val2.AddComponent<BotanyModelInteraction>().Target = target; } return val2.transform; } private static void Hit(Transform parent, Vector3 center, Vector3 size) { //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) BoxCollider obj = ((Component)parent).gameObject.AddComponent<BoxCollider>(); obj.center = center; obj.size = size; } } internal static class BotanyLocalization { private sealed class SeedText { internal string CropLabel; internal string FallbackCrop; internal string GermanName; internal string DisplayName; internal string CropName; } private const string Prefix = "$botanypots_"; private static readonly string[] Languages = new string[4] { "English", "German", "Spanish", "French" }; private static readonly Dictionary<string, SeedText> Seeds = new Dictionary<string, SeedText>(StringComparer.Ordinal); private static CustomLocalization localization; private static FieldInfo gameInstance; private static MethodInfo gameLocalize; private static MethodInfo gameAddWord; internal static string Token(string name) { return "$botanypots_" + name; } internal static void Register() { localization = LocalizationManager.Instance.GetLocalization(); Type type = AccessTools.TypeByName("Localization"); if (type != null) { gameInstance = AccessTools.Field(type, "m_instance"); gameLocalize = AccessTools.Method(type, "Localize", new Type[1] { typeof(string) }, (Type[])null); gameAddWord = AccessTools.Method(type, "AddWord", new Type[2] { typeof(string), typeof(string) }, (Type[])null); } Add("silo", "Botany Silo", "Botany-Silo", "Silo botánico", "Silo botanique"); Add("silo_desc", "Collects harvests from nearby Botany Pots. Set its range to 10–60 m from the silo window.", "Sammelt die Ernte aus Botany-Töpfen. Im Silo lässt sich die Reichweite auf 10–60 m einstellen.", "Recoge la cosecha de las macetas botánicas cercanas. Ajusta el alcance de 10 a 60 m en la ventana del silo.", "Collecte les récoltes des pots botaniques à proximité. Réglez la portée de 10 à 60 m dans la fenêtre du silo."); Add("silo_pots", "Pots: {0}", "Töpfe: {0}", "Macetas: {0}", "Pots : {0}"); Add("annex_bronze", "Black Forest Silo Annex", "Grauwald-Siloanbau", "Anexo de silo del Bosque Negro", "Extension de la Forêt noire"); Add("annex_iron", "Swamp Silo Annex", "Sumpf-Siloanbau", "Anexo de silo del Pantano", "Extension du Marais"); Add("annex_silver", "Mountain Silo Annex", "Gebirgs-Siloanbau", "Anexo de silo de la Montaña", "Extension de la Montagne"); Add("annex_desc", "Adds 40 storage slots on its assigned side of the Botany Silo.", "Bringt 40 zusätzliche Lagerplätze an seiner festen Seite des Botany-Silos.", "Añade 40 espacios en su lado asignado del silo botánico.", "Ajoute 40 emplacements sur son côté attitré du silo botanique."); Add("annex_socket_unavailable", "Aim at a nearby silo with the matching socket free.", "Ziele auf ein nahes Silo mit freiem Anschluss für diesen Anbau.", "Apunta a un silo cercano con la conexión correspondiente libre.", "Visez un silo proche dont la prise correspondante est libre."); Add("seed_chest", "Seed Chest", "Saatgutkiste", "Cofre de semillas", "Coffre à graines"); Add("seed_chest_desc", "Stores only Botany seeds. A Pot Board within 10 m can use its 200 slots.", "Lagert nur Botany-Samen. Eine Topfverwaltung in bis zu 10 m Entfernung kann auf die 200 Plätze zugreifen.", "Guarda solo semillas de Botany. Un tablero a 10 m o menos puede usar sus 200 espacios.", "Contient uniquement des graines Botany. Un tableau à 10 m ou moins peut utiliser ses 200 places."); Add("seed_chest_unlinked", "Build a Seed Chest within 10 m of this Pot Board.", "Baue eine Saatgutkiste im Umkreis von 10 m um die Topfverwaltung.", "Construye un cofre de semillas a 10 m o menos de este tablero.", "Construisez un coffre à graines à 10 m ou moins de ce tableau."); Add("seed_chest_empty", "The Seed Chest is empty.", "Die Saatgutkiste ist leer.", "El cofre de semillas está vacío.", "Le coffre à graines est vide."); Add("seed_chest_controls", "Drag to store · Click to select · Ctrl-click to plant · Right-click to take one", "Ziehen zum Lagern · Klick zum Wählen · Strg-Klick zum Pflanzen · Rechtsklick für einen Samen", "Arrastra para guardar · Clic para elegir · Ctrl+clic para plantar · Clic derecho para retirar una", "Glisser pour ranger · Cliquer pour choisir · Ctrl-clic pour planter · Clic droit pour en prendre une"); Add("seed_chest_selected", "{0} · Click a planting slot or click here to cancel", "{0} · Saatplatz anklicken oder hier abbrechen", "{0} · Haz clic en un espacio para plantar o aquí para cancelar", "{0} · Cliquez sur un emplacement pour planter ou ici pour annuler"); Add("seed_chest_transfer_failed", "Seed transfer failed. Check seed stock, storage space and access.", "Samen nicht übertragen. Prüfe den Samenvorrat, freien Platz und den Zugriff.", "No se pudo transferir la semilla. Revisa tu reserva, el espacio y el acceso.", "Transfert impossible. Vérifiez le stock, la place et les droits d’accès."); Add("remote_title", "Pot Board", "Topfverwaltung", "Tablero de macetas", "Tableau des pots"); Add("remote_desc", "Manage pots within range of a nearby Botany Silo.", "Verwalte Töpfe in Reichweite eines nahen Botany-Silos.", "Gestiona las macetas al alcance de un silo botánico cercano.", "Gérez les pots à portée d’un silo botanique proche."); Add("remote_open", "Manage pots", "Töpfe verwalten", "Gestionar macetas", "Gérer les pots"); Add("remote_no_silo", "Build within silo range", "In Silo-Reichweite bauen", "Construye al alcance de un silo", "Construisez à portée d’un silo"); Add("remote_harvest", "Harvest", "Ernte", "Cosecha", "Récolte"); Add("remote_empty", "No pots in range", "Keine Töpfe in Reichweite", "No hay macetas cerca", "Aucun pot à portée"); Add("remote_back", "Planting slots", "Saatplätze", "Espacios de plantación", "Emplacements"); Add("remote_no_seeds", "No seeds in your inventory", "Keine Samen im Inventar", "No tienes semillas", "Aucune graine en inventaire"); Add("remote_read_only", "Currently read-only", "Derzeit nur Ansicht", "Solo lectura por ahora", "Lecture seule pour le moment"); Add("remote_no_free_slot", "No free planting slot", "Kein freier Saatplatz", "No hay espacios de plantación libres", "Aucun emplacement de plantation libre"); Add("remote_quick_plant", "Choose seed · Ctrl-click to plant", "Samen wählen · Strg-Klick zum Pflanzen", "Elegir semilla · Ctrl+clic para plantar", "Choisir une graine · Ctrl-clic pour planter"); Add("remote_remove", "Take seed", "Samen entnehmen", "Retirar semilla", "Retirer la graine"); Add("remote_failed", "Seed transfer failed. Check inventory space and pot access.", "Samen nicht übertragen. Prüfe Inventarplatz und Zugriff.", "No se pudo transferir la semilla. Revisa el inventario y el acceso.", "Transfert impossible. Vérifiez la place et l’accès au pot."); Add("basic_pot", "Basic Pot", "Einfacher Topf", "Maceta básica", "Pot simple"); Add("advanced_pot", "Advanced Pot", "Verbesserter Topf", "Maceta avanzada", "Pot amélioré"); Add("elite_pot", "Elite Pot", "Elite-Topf", "Maceta de élite", "Pot d’élite"); Add("mega_pot", "Mega Pot", "Mega-Topf", "Maceta mega", "Méga-pot"); Add("ultra_pot", "Ultra Pot", "Ultra-Topf", "Maceta ultra", "Ultra-pot"); Add("fat_pot", "Fat Pot", "Riesentopf", "Maceta gigante", "Pot géant"); Add("pot_desc_1", "One planting slot. Harvest by hand or with a Botany Silo.", "Ein Saatplatz. Ernte von Hand oder mit einem Botany-Silo.", "Un espacio de plantación. Recoge la cosecha a mano o con un silo botánico.", "Un emplacement de plantation. Récoltez à la main ou avec un silo botanique."); int[] array = new int[5] { 2, 3, 4, 5, 10 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; Add("pot_desc_" + num, $"{num} independent planting slots. Harvest by hand or with a Botany Silo.", $"{num} unabhängige Saatplätze. Ernte von Hand oder mit einem Botany-Silo.", $"{num} espacios de plantación independientes. Recoge la cosecha a mano o con un silo botánico.", $"{num} emplacements de plantation indépendants. Récoltez à la main ou avec un silo botanique."); } Add("pot_use", "Open planting slots", "Saatplätze öffnen", "Abrir espacios de plantación", "Ouvrir les emplacements"); Add("recover_seeds", "Recover old seeds", "Alte Samen zurückholen", "Recuperar semillas antiguas", "Récupérer les anciennes graines"); Add("seed_table", "Seed Table", "Saatgutwerkbank", "Mesa de semillas", "Table à graines"); Add("seed_table_desc", "A flower-decorated workbench for Botany Pots seed recipes.", "Blumenverzierte Werkbank für die Saatgutrezepte von Botany Pots.", "Banco decorado con flores para fabricar las semillas de Botany Pots.", "Établi fleuri pour fabriquer les graines de Botany Pots."); Add("search", "Search seeds …", "Samen suchen …", "Buscar semillas…", "Rechercher des graines…"); Add("groups", "Mod groups", "Modgruppen", "Grupos de mods", "Groupes de mods"); Add("no_recipes", "No recipes", "Keine Rezepte", "Sin recetas", "Aucune recette"); Add("seed_format", "Seeds: {0}", "Samen: {0}", "Semillas de {0}", "Graines : {0}"); Add("seed_desc", "Plant in a Botany Pot to repeatedly produce this resource.", "In einen Botany-Topf einsetzen, um diese Ressource dauerhaft zu produzieren.", "Plántala en una maceta botánica para producir este recurso de forma continua.", "Plantez ces graines dans un pot botanique pour produire cette ressource en continu."); for (int j = 1; j <= 5; j++) { Add("mod_seed_desc_" + j, $"Tier {j} seed from a detected mod. Plant in a Botany Pot to produce this resource.", $"Saatgut aus einer erkannten Mod (Stufe {j}). In einem Botany-Topf einsetzen, um diese Ressource zu produzieren.", $"Semilla de nivel {j} de un mod detectado. Plántala en una maceta botánica para producir este recurso.", $"Graines de niveau {j} issues d’un mod détecté. Plantez-les dans un pot botanique pour produire cette ressource."); } LocalizationManager.OnLocalizationAdded += RefreshSeedNames; } internal static void Unregister() { LocalizationManager.OnLocalizationAdded -= RefreshSeedNames; Seeds.Clear(); } private static void Add(string key, string english, string german, string spanish, string french) { string[] array = new string[4] { english, german, spanish, french }; for (int i = 0; i < Languages.Length; i++) { CustomLocalization obj = localization; ref readonly string reference = ref Languages[i]; string text = Token(key); obj.AddTranslation(ref reference, ref text, array[i]); } } internal static string Text(string key) { return localization.TryTranslate(Token(key)); } internal static string GameText(string label) { if (string.IsNullOrEmpty(label) || label.IndexOf('$') < 0) { return label; } object obj = gameInstance?.GetValue(null); if (obj == null || !(gameLocalize != null)) { return label; } return (gameLocalize.Invoke(obj, new object[1] { label }) as string) ?? label; } internal static string RegisterSeed(string prefab, string crop, string cropLabel, string germanName) { string text = Token("seed_name_" + BitConverter.ToString(Encoding.UTF8.GetBytes(prefab)).Replace("-", "")); SeedText seedText = new SeedText { CropLabel = cropLabel, FallbackCrop = ReadablePrefab(crop), GermanName = germanName }; if (crop == "FishAnglerRaw") { seedText.CropLabel = cropLabel + " ($animal_fish9)"; seedText.FallbackCrop = "Raw Fish (Anglerfish)"; } Seeds[text] = seedText; UpdateSeedName(text, seedText, gameInstance?.GetValue(null)); return text; } internal static string SeedName(string key, string fallback) { if (key == null || !Seeds.TryGetValue(key, out var value)) { return fallback; } return value.DisplayName; } internal static string CropName(string key, string fallback) { if (key == null || !Seeds.TryGetValue(key, out var value)) { return fallback; } return value.CropName; } internal static void RefreshSeedNames() { object game = gameInstance?.GetValue(null); foreach (KeyValuePair<string, SeedText> seed in Seeds) { UpdateSeedName(seed.Key, seed.Value, game); } } private static void UpdateSeedName(string key, SeedText seed, object game) { string text = GameText(seed.CropLabel); if (string.IsNullOrWhiteSpace(text) || (text == seed.CropLabel && text.StartsWith("$", StringComparison.Ordinal)) || (text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal))) { text = seed.FallbackCrop; } seed.CropName = text; seed.DisplayName = ((seed.GermanName != null && PlayerPrefs.GetString("language", "English") == "German") ? seed.GermanName : string.Format(Text("seed_format"), text)); if (game != null && gameAddWord != null) { gameAddWord.Invoke(game, new object[2] { key.Substring(1), seed.DisplayName }); } else { CustomLocalization obj = localization; string text2 = "English"; obj.AddTranslation(ref text2, ref key, seed.DisplayName); } } private static string ReadablePrefab(string prefab) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < prefab.Length; i++) { char c = prefab[i]; if (c == '_' || c == '-') { stringBuilder.Append(' '); continue; } if (i > 0 && char.IsUpper(c) && char.IsLower(prefab[i - 1])) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString().Trim(); } } internal static class BotanyModels { private enum Finish { Oak, Endgrain, Sage, Clay, Cream, Soil, Stone, Slate, Copper, Jade, Leaf, Moss, Rose, Violet, Gold, Glass } private sealed class Model { private readonly List<Vector3> vertices = new List<Vector3>(); private readonly List<Vector2> uv = new List<Vector2>(); private readonly Dictionary<Finish, List<int>> faces = new Dictionary<Finish, List<int>>(); private readonly List<Bounds> boxes = new List<Bounds>(); private readonly List<Mesh> hulls = new List<Mesh>(); private void Quad(Finish finish, Vector3 a, Vector3 b, Vector3 c, Vector3 d, float u0 = 0f, float u1 = 1f, float v0 = 0f, float v1 = 1f) { //IL_0035: 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_005a: 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_007f: 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_00a7: 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_00b3: 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_00ba: 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_00c0: 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_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_00f0: 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_00f7: 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_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) if (!faces.TryGetValue(finish, out var value)) { faces.Add(finish, value = new List<int>()); } int count = vertices.Count; vertices.Add(a); vertices.Add(b); vertices.Add(c); vertices.Add(d); uv.Add(new Vector2(u0, v0)); uv.Add(new Vector2(u1, v0)); uv.Add(new Vector2(u1, v1)); uv.Add(new Vector2(u0, v1)); Vector3 val = Vector3.Cross(b - a, c - a); if (((Vector3)(ref val)).sqrMagnitude > 1E-15f) { value.Add(count); value.Add(count + 1); value.Add(count + 2); } val = Vector3.Cross(c - a, d - a); if (((Vector3)(ref val)).sqrMagnitude > 1E-15f) { value.Add(count); value.Add(count + 2); value.Add(count + 3); } } internal void TwoSided(Finish finish, Vector3 a, Vector3 b, Vector3 c, Vector3 d) { //IL_0002: 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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_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) Quad(finish, a, b, c, d); Quad(finish, d, c, b, a); } internal void HitBox(Vector3 center, Vector3 size) { //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_0008: Unknown result type (might be due to invalid IL or missing references) boxes.Add(new Bounds(center, size)); } internal void Box(Finish finish, Vector3 center, Vector3 size, bool solid = false) { //IL_0002: 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_000f: 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_0034: 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_0063: 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) Profile(finish, center, size.x * 0.70710677f, size.z * 0.70710677f, 4, (0f - size.y) * 0.5f, 0f, (0f - size.y) * 0.5f, 1f, size.y * 0.5f, 1f, size.y * 0.5f, 0f); if (solid) { HitBox(center, size); } } internal void Beam(Finish finish, Vector3 from, Vector3 to, float width) { //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_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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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_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_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_0047: 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_0056: 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_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_0062: 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_0073: 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_0081: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_009d: 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_00a4: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e7: 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_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_00f4: 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_00f7: 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_00fd: 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_012a: 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_0138: 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) //IL_014a: 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_0154: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0199: 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_01a2: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((Mathf.Abs(Vector3.Dot(normalized, Vector3.up)) > 0.93f) ? Vector3.forward : Vector3.up); val = Vector3.Cross(normalized, val2); Vector3 val3 = ((Vector3)(ref val)).normalized * width * 0.5f; val = Vector3.Cross(val3, normalized); Vector3 val4 = ((Vector3)(ref val)).normalized * width * 0.5f; Vector3[] array = (Vector3[])(object)new Vector3[4] { val3 + val4, val3 - val4, -val3 - val4, -val3 + val4 }; for (int i = 0; i < 4; i++) { Vector3 val5 = array[i]; Vector3 val6 = array[(i + 1) % 4]; Quad(finish, from + val5, from + val6, to + val6, to + val5); } Quad(finish, from + array[3], from + array[2], from + array[1], from + array[0]); Quad(finish, to + array[0], to + array[1], to + array[2], to + array[3]); } internal void Oval(Finish finish, Vector3 p, Vector3 radius, int sides) { //IL_0002: 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_0009: 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_003f: 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) float x = radius.x; float z = radius.z; float[] obj = new float[10] { 0f, 0f, 0f, 0.83f, 0f, 1f, 0f, 0.83f, 0f, 0f }; obj[0] = 0f - radius.y; obj[2] = (0f - radius.y) * 0.55f; obj[6] = radius.y * 0.55f; obj[8] = radius.y; Profile(finish, p, x, z, sides, obj); } internal void Vessel(Vector3 p, float rx, float rz, float height, Finish body, Finish rim, int sides, float shape = 1f, bool solid = true) { //IL_0003: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Profile(body, p, rx, rz, sides, 0f, 0f, 0f, 0.67f, height * 0.15f, 0.78f, height * 0.54f, 0.96f, height * 0.86f, 0.99f, height * 0.91f, 1f, shape); Profile(rim, p, rx, rz, sides, height * 0.91f, 1f, height * 0.94f, 1.04f, height, 1.04f, height, 0.87f, height * 0.91f, 0.84f, height * 0.8f, 0.81f, shape); Profile(Finish.Soil, p, rx, rz, sides, height * 0.8f, 0.82f, height * 0.875f, 0.65f, height * 0.85f, 0f, shape); if (solid) { float[] obj = new float[12] { 0f, 0f, 0f, 0.67f, 0f, 0.78f, 0f, 0.96f, 0f, 1.025f, 0f, 0f }; obj[4] = height * 0.15f; obj[6] = height * 0.54f; obj[8] = height; obj[10] = height; HitProfile(p, rx, rz, sides, obj, shape); } } internal void Profile(Finish finish, Vector3 p, float rx, float rz, int sides, params float[] profile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Profile(finish, p, rx, rz, sides, profile, 1f); } private void Profile(Finish finish, Vector3 p, float rx, float rz, int sides, float y0, float r0, float y1, float r1, float y2, float r2, float shape) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Profile(finish, p, rx, rz, sides, new float[6] { y0, r0, y1, r1, y2, r2 }, shape); } private void Profile(Finish finish, Vector3 p, float rx, float rz, int sides, float y0, float r0, float y1, float r1, float y2, float r2, float y3, float r3, float y4, float r4, float y5, float r5, float shape) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Profile(finish, p, rx, rz, sides, new float[12] { y0, r0, y1, r1, y2, r2, y3, r3, y4, r4, y5, r5 }, shape); } private void Profile(Finish finish, Vector3 p, float rx, float rz, int sides, float[] profile, float shape) { //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_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_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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: 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_009c: 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_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_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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (profile.Length < 4 || (profile.Length & 1) != 0) { throw new ArgumentException("Expected height/radius pairs.", "profile"); } for (int i = 0; i < sides; i++) { Vector3 val = Axis(i, sides, rx, rz, shape); Vector3 val2 = Axis(i + 1, sides, rx, rz, shape); for (int j = 0; j < profile.Length - 2; j += 2) { Vector3 val3 = p + Vector3.up * profile[j]; Vector3 val4 = p + Vector3.up * profile[j + 2]; Quad(finish, val3 + val * profile[j + 1], val3 + val2 * profile[j + 1], val4 + val2 * profile[j + 3], val4 + val * profile[j + 3]); } } } private static Vector3 Axis(int index, int sides, float rx, float rz, float shape) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) float num = ((float)(index % sides) + 0.5f) * 2f * (float)Math.PI / (float)sides; float num2 = Mathf.Sin(num); float num3 = Mathf.Cos(num); return V(Mathf.Sign(num2) * Mathf.Pow(Mathf.Abs(num2), 1f / shape) * rx, 0f, Mathf.Sign(num3) * Mathf.Pow(Mathf.Abs(num3), 1f / shape) * rz); } internal void HitProfile(Vector3 p, float rx, float rz, int sides, float[] profile, float shape) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Model model = new Model(); model.Profile(Finish.Stone, p, rx, rz, sides, profile, shape); hulls.Add(model.Mesh("BotanyCollision", new Finish[1] { Finish.Stone })); } private Mesh Mesh(string name, Finish[] finishes) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Mesh val = new Mesh { name = name, subMeshCount = finishes.Length }; val.SetVertices(vertices); val.SetUVs(0, uv); for (int i = 0; i < finishes.Length; i++) { val.SetTriangles(faces[finishes[i]], i); } val.RecalculateNormals(); val.RecalculateBounds(); return val; } internal void Install(GameObject prefab, MonoBehaviour interactable, string design) { //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_007e: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_014f: 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) //IL_016c: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Collider[] componentsInChildren2 = prefab.GetComponentsInChildren<Collider>(true);