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 MySix ProgressivePortals v1.0.0
MySix.ProgressivePortals.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MySix.Core; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace MySix { internal static class ModVersion { public const string Value = "1.0.0"; } } namespace MySix.ProgressivePortals { public class ColorShift : MonoBehaviour { public string m_tier; public Color m_from; public Color m_to; public float m_period = 8f; private const float Step = 0.12f; private TeleportWorld _portal; private Tier _base; private Tier _now; private float _next; private void Awake() { _portal = ((Component)this).GetComponent<TeleportWorld>(); _base = Tiers.ByPrefab(m_tier); if (_base != null) { _now = (Tier)typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(_base, null); } } private void Update() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_portal == (Object)null) && _now != null && !(Time.time < _next)) { _next = Time.time + 0.12f; float num = 0.5f - 0.5f * Mathf.Cos((Time.time / m_period + ((Component)this).transform.position.x * 0.013f) * (float)Math.PI * 2f); Color val = Color.Lerp(m_from, m_to, num); _now.Glow = val; _now.GlowDeep = val * 0.35f; _now.GlowDeep.a = 1f; _portal.m_colorTargetfound = val * _base.GlowStrength; if ((Object)(object)_portal.m_target_found != (Object)null && ((Component)_portal.m_target_found).gameObject.activeInHierarchy) { PortalPrefabs.RecolourEffect(((Component)_portal.m_target_found).transform, _now); } } } } public static class Effects { public static void Apply(GameObject prefab, Tier tier, Func<string, GameObject> find) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) Transform obj = prefab.transform.Find("New/small_portal"); MeshFilter val = ((obj != null) ? ((Component)obj).GetComponent<MeshFilter>() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.sharedMesh == (Object)null) && val.sharedMesh.isReadable) { switch (tier.Level) { case 1: { GameObject source3 = find("Blob"); Tune(Borrow(source3, "Visual/particles/ooz", val), val.sharedMesh, 12f, (1.4f, 2.6f), -0.005f, 0.32f); Tune(Borrow(source3, "Visual/particles/flies", val), val.sharedMesh, 16f, null, null); break; } case 5: { GameObject source2 = find("Spawner_GreydwarfNest"); ParticleSystem ps = Borrow(source2, "particles/sparcs", val); Tune(ps, val.sharedMesh, 10f, null, -0.02f); Tint(ps, tier.Glow); Tune(Borrow(source2, "particles/evil_smoke _world (1)", val), val.sharedMesh, 6f, (0.8f, 1.6f), -0.01f, 0.25f); break; } case 2: { GameObject source = find("MaceSilver"); Tune(Borrow(source, "attach/effects/soft cloud", val), val.sharedMesh, 14f, (0.8f, 1.8f), 0.04f, 0.2f); Tune(Borrow(source, "attach/effects/vfx_BloodHit 1", val), val.sharedMesh, 12f, null, 0.06f); break; } case 3: case 4: break; } } } private static void Tint(ParticleSystem ps, Color colour) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ps == (Object)null)) { MainModule main = ps.main; float r = colour.r; float g = colour.g; float b = colour.b; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(r, g, b, ((MinMaxGradient)(ref startColor)).color.a)); ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = false; } } private static ParticleSystem Borrow(GameObject source, string path, MeshFilter frame) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)source != (Object)null) ? source.transform.Find(path) : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent<ParticleSystem>() == (Object)null) { Plugin.Log.LogWarning((object)("No " + path + " on " + (Object.op_Implicit((Object)(object)source) ? ((Object)source).name : "?") + " to borrow")); return null; } GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)frame).transform, false); ((Object)val2).name = "MySix_" + ((Object)val).name; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; val2.SetActive(true); return val2.GetComponent<ParticleSystem>(); } private static void Tune(ParticleSystem ps, Mesh frame, float rate, (float min, float max)? size, float? gravity, float? alpha = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cf: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Invalid comparison between Unknown and I4 //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ps == (Object)null) { return; } ShapeModule shape = ps.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)6; ((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)2; ((ShapeModule)(ref shape)).mesh = frame; ((ShapeModule)(ref shape)).position = Vector3.zero; ((ShapeModule)(ref shape)).rotation = Vector3.zero; ((ShapeModule)(ref shape)).scale = Vector3.one; MainModule main = ps.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = true; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; ((MainModule)(ref main)).maxParticles = Mathf.Max(20, Mathf.CeilToInt(rate * ((MinMaxCurve)(ref startLifetime)).constantMax * 1.5f)); if (size.HasValue) { ((MainModule)(ref main)).startSize = new MinMaxCurve(size.Value.min, size.Value.max); } if (gravity.HasValue) { ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity.Value); } if (alpha.HasValue) { MinMaxGradient startColor = ((MainModule)(ref main)).startColor; if ((int)((MinMaxGradient)(ref startColor)).mode == 0) { startColor = ((MainModule)(ref main)).startColor; Color color = ((MinMaxGradient)(ref startColor)).color; color.a = alpha.Value; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); } } EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); } } public static class FrostPaint { private const int Size = 1024; public static void Apply(MeshRenderer frame, Mesh mesh, Material ice, Func<Vector3, Vector3, float> weight) { //IL_008d: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_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_014f: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_01a4: 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) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Expected O, but got Unknown //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: 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_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) Material sharedMaterial = ((Renderer)frame).sharedMaterial; if ((Object)(object)sharedMaterial == (Object)null || (Object)(object)sharedMaterial.mainTexture == (Object)null || !mesh.isReadable) { return; } Texture2D val = Repaint.Readable(sharedMaterial.mainTexture); Texture2D val2 = (((Object)(object)ice != (Object)null && (Object)(object)ice.mainTexture != (Object)null) ? Repaint.Readable(ice.mainTexture) : null); Color val3 = (Color)(((Object)(object)ice != (Object)null && ice.HasProperty("_Color")) ? ice.color : new Color(0.85f, 0.92f, 1f)); Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Vector2[] uv = mesh.uv; int[] triangles = mesh.triangles; float[] array = new float[1048576]; bool[] array2 = new bool[1048576]; Vector2 val8 = default(Vector2); for (int i = 0; i < triangles.Length; i += 3) { int num = triangles[i]; int num2 = triangles[i + 1]; int num3 = triangles[i + 2]; Vector2 val4 = uv[num] * 1024f; Vector2 val5 = uv[num2] * 1024f; Vector2 val6 = uv[num3] * 1024f; Vector3 val7 = Vector3.Cross(vertices[num2] - vertices[num], vertices[num3] - vertices[num]); if (Vector3.Dot(val7, normals[num] + normals[num2] + normals[num3]) < 0f) { val7 = -val7; } val7 = ((Vector3)(ref val7)).normalized; int num4 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val4.x, Mathf.Min(val5.x, val6.x))) - 1); int num5 = Mathf.Min(1023, Mathf.CeilToInt(Mathf.Max(val4.x, Mathf.Max(val5.x, val6.x))) + 1); int num6 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val4.y, Mathf.Min(val5.y, val6.y))) - 1); int num7 = Mathf.Min(1023, Mathf.CeilToInt(Mathf.Max(val4.y, Mathf.Max(val5.y, val6.y))) + 1); float num8 = (val5.x - val4.x) * (val6.y - val4.y) - (val6.x - val4.x) * (val5.y - val4.y); if (Mathf.Abs(num8) < 1E-06f) { continue; } for (int j = num6; j <= num7; j++) { for (int k = num4; k <= num5; k++) { ((Vector2)(ref val8))..ctor((float)k + 0.5f, (float)j + 0.5f); float num9 = ((val5.x - val8.x) * (val6.y - val8.y) - (val6.x - val8.x) * (val5.y - val8.y)) / num8; float num10 = ((val6.x - val8.x) * (val4.y - val8.y) - (val4.x - val8.x) * (val6.y - val8.y)) / num8; float num11 = 1f - num9 - num10; if (!(num9 < -0.03f) && !(num10 < -0.03f) && !(num11 < -0.03f)) { Vector3 val9 = vertices[num] * num9 + vertices[num2] * num10 + vertices[num3] * num11; float num12 = weight(val9, val7) + (Mathf.PerlinNoise(val9.x * 9f + val9.z * 4f + 3.1f, val9.y * 9f + 7.7f) - 0.5f) * 0.4f; float num13 = Mathf.Clamp01((num12 - 0.18f) / 0.25f); num13 = num13 * num13 * (3f - 2f * num13); int num14 = j * 1024 + k; array2[num14] = true; if (num13 > array[num14]) { array[num14] = num13; } } } } } for (int l = 0; l < 3; l++) { float[] array3 = (float[])array.Clone(); for (int m = 1; m < 1023; m++) { for (int n = 1; n < 1023; n++) { int num15 = m * 1024 + n; if (!array2[num15]) { array3[num15] = Mathf.Max(Mathf.Max(array[num15 - 1], array[num15 + 1]), Mathf.Max(array[num15 - 1024], array[num15 + 1024])); } } } array = array3; } Color[] array4 = (Color[])(object)new Color[1048576]; for (int num16 = 0; num16 < 1024; num16++) { for (int num17 = 0; num17 < 1024; num17++) { float num18 = ((float)num17 + 0.5f) / 1024f; float num19 = ((float)num16 + 0.5f) / 1024f; Color pixelBilinear = val.GetPixelBilinear(num18, num19); int num20 = num16 * 1024 + num17; if (array[num20] <= 0f) { array4[num20] = pixelBilinear; continue; } Color val10 = (((Object)(object)val2 != (Object)null) ? (val2.GetPixelBilinear(num18 * 3f, num19 * 3f) * val3 * 1.25f) : val3); val10 = Color.Lerp(val10, new Color(0.93f, 0.97f, 1f), 0.35f); val10.a = 1f; array4[num20] = Color.Lerp(pixelBilinear, val10, array[num20]); } } Texture2D val11 = new Texture2D(1024, 1024, (TextureFormat)4, true) { name = ((Object)sharedMaterial.mainTexture).name + "_frosted", wrapMode = (TextureWrapMode)0 }; val11.SetPixels(array4); val11.Apply(true, true); Material val12 = new Material(sharedMaterial) { name = ((Object)sharedMaterial).name + "_frosted" }; val12.mainTexture = (Texture)(object)val11; ((Renderer)frame).sharedMaterial = val12; } } public class GlowWith : MonoBehaviour { public MeshRenderer m_frame; private MeshRenderer _coat; private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor"); private void Awake() { _coat = ((Component)this).GetComponent<MeshRenderer>(); } private void LateUpdate() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_frame == (Object)null) && !((Object)(object)_coat == (Object)null)) { ((Renderer)_coat).material.SetColor(EmissionColor, ((Renderer)m_frame).material.GetColor(EmissionColor)); } } } public static class Icons { private static readonly MethodInfo LoadImage = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); public static Sprite Load(string prefab) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00de: 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) string name = typeof(Icons).Assembly.GetName().Name + ".Icons." + prefab + ".png"; using Stream stream = typeof(Icons).Assembly.GetManifestResourceStream(name); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { name = prefab + "_icon" }; if (LoadImage == null || !(bool)LoadImage.Invoke(null, new object[2] { val, array })) { return null; } Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)val2).name = prefab + "_icon"; return val2; } } public class Lightning : MonoBehaviour { private static readonly Vector3 Centre = new Vector3(0f, 1.45f, 0f); private const float RingX = 1.3f; private const float RingY = 1.35f; private const int Points = 12; private const int Arcs = 3; private static readonly FieldRef<EffectFade, bool> Active = AccessTools.FieldRefAccess<EffectFade, bool>("m_active"); private TeleportWorld _portal; private LineRenderer[] _arcs; private float[] _until; private Vector3[][] _shape; private Light _flash; private float _next; private float _flashUntil; private Material _material; private bool Lit => (Object)(object)_portal != (Object)null && (Object)(object)_portal.m_target_found != (Object)null && Active.Invoke(_portal.m_target_found); private Color Colour { get { //IL_001c: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Color val = (((Object)(object)_portal != (Object)null) ? _portal.m_colorTargetfound : Color.white); float num = Mathf.Max(val.r, Mathf.Max(val.g, val.b)); return ((num > 0f) ? Color.Lerp(val / num, Color.white, 0.35f) : Color.white) * 2f; } } private void Awake() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) _portal = ((Component)this).GetComponent<TeleportWorld>(); Shader val = Shader.Find("Legacy Shaders/Particles/Additive"); if ((Object)(object)val == (Object)null) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array) { if (((Object)val2).name == "Legacy Shaders/Particles/Additive") { val = val2; break; } } } if ((Object)(object)val == (Object)null) { ((Behaviour)this).enabled = false; return; } _material = new Material(val) { mainTexture = (Texture)(object)Texture2D.whiteTexture }; Transform val3 = ((Component)this).transform.Find("New") ?? ((Component)this).transform; _arcs = (LineRenderer[])(object)new LineRenderer[3]; _until = new float[3]; _shape = new Vector3[3][]; for (int j = 0; j < 3; j++) { GameObject val4 = new GameObject("MySix_lightning"); val4.transform.SetParent(val3, false); LineRenderer val5 = val4.AddComponent<LineRenderer>(); val5.useWorldSpace = false; val5.positionCount = 12; ((Renderer)val5).sharedMaterial = _material; val5.numCapVertices = 2; ((Renderer)val5).enabled = false; _arcs[j] = val5; } GameObject val6 = new GameObject("MySix_lightning_flash"); val6.transform.SetParent(val3, false); val6.transform.localPosition = Centre; _flash = val6.AddComponent<Light>(); _flash.type = (LightType)2; _flash.range = 9f; _flash.intensity = 0f; _next = Time.time + Random.Range(1f, 5f); } private void Update() { float time = Time.time; if (time >= _next) { bool lit = Lit; Strike(lit, lit && Random.value < 0.3f); if (lit && Random.value < 0.4f) { Strike(big: true, across: false); } _next = time + (lit ? Random.Range(0.6f, 2f) : Random.Range(4f, 11f)); } for (int i = 0; i < 3; i++) { if (((Renderer)_arcs[i]).enabled) { if (time >= _until[i]) { ((Renderer)_arcs[i]).enabled = false; } else { Jag(_arcs[i], _shape[i], 0.06f); } } } _flash.intensity = ((time < _flashUntil) ? Mathf.Lerp(0f, 3f, (_flashUntil - time) / 0.18f) : 0f); } public void Strike(bool big, bool across) { //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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_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_013d: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0195: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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) if (_arcs == null) { return; } int num = 0; for (int i = 0; i < 3; i++) { if (!((Renderer)_arcs[i]).enabled) { num = i; break; } } LineRenderer val = _arcs[num]; Vector3 val2; Vector3 val3; if (across) { float num2 = Random.Range(20f, 160f); val2 = OnRing(num2, 0.05f); val3 = OnRing(num2 + 180f + Random.Range(-30f, 30f), 0.05f); } else { float num3 = Random.Range(-40f, 220f); float num4 = (big ? Random.Range(35f, 75f) : Random.Range(15f, 35f)); val2 = OnRing(num3, Random.Range(0.18f, 0.3f)); val3 = OnRing(num3 + ((Random.value < 0.5f) ? (0f - num4) : num4), Random.Range(0.18f, 0.3f)); } Vector3[] array = (Vector3[])(object)new Vector3[12]; Vector3 val4 = (val2 + val3) * 0.5f - Centre; Vector3 val5 = ((Vector3)(ref val4)).normalized * Vector3.Distance(val2, val3) * (across ? 0f : 0.25f); for (int j = 0; j < 12; j++) { float num5 = (float)j / 11f; array[j] = Vector3.Lerp(val2, val3, num5) + val5 * Mathf.Sin(num5 * (float)Math.PI); } _shape[num] = array; Color colour = Colour; Color startColor = (val.endColor = colour); val.startColor = startColor; float num6 = (val.startWidth = (big ? Random.Range(0.06f, 0.1f) : Random.Range(0.035f, 0.055f))); val.endWidth = num6 * 0.4f; Jag(val, array, big ? 0.08f : 0.05f); ((Renderer)val).enabled = true; _until[num] = Time.time + (big ? Random.Range(0.12f, 0.25f) : Random.Range(0.07f, 0.14f)); _flash.color = colour; _flashUntil = Time.time + (big ? 0.18f : 0.1f); } private static Vector3 OnRing(float angle, float beyond) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) float num = angle * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num) * 1.3f, Mathf.Sin(num) * 1.35f, 0f); return Centre + val + ((Vector3)(ref val)).normalized * beyond + Vector3.forward * Random.Range(-0.2f, 0.2f); } private static void Jag(LineRenderer line, Vector3[] path, float amount) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < path.Length; i++) { bool flag = i == 0 || i == path.Length - 1; line.SetPosition(i, flag ? path[i] : (path[i] + Random.insideUnitSphere * amount)); } } } public static class LoadingTint { [HarmonyPatch(typeof(TeleportWorld), "Teleport")] public static class Teleport { private static void Postfix(TeleportWorld __instance, Player __0) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__0 == (Object)null) && !((Object)(object)__0 != (Object)(object)Player.m_localPlayer) && ((Character)__0).IsTeleporting()) { _tint = ((TeleportRules.TierOf(__instance) != null) ? new Color?(GlowOf(__instance)) : ((Color?)null)); } } } [HarmonyPatch(typeof(Hud), "UpdateBlackScreen")] public static class BlackScreen { private static void Postfix(Hud __instance, Player __0) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject teleportingProgress = __instance.m_teleportingProgress; if ((Object)(object)teleportingProgress == (Object)null) { return; } bool flag = (Object)(object)__0 != (Object)null && ((Character)__0).IsTeleporting(); if (flag && teleportingProgress.activeInHierarchy) { if (_tint.HasValue && !_applied) { Apply(teleportingProgress, _tint.Value); } else if (!_tint.HasValue && _applied) { Restore(); } return; } CanvasGroup loadingScreen = __instance.m_loadingScreen; bool flag2 = (Object)(object)loadingScreen != (Object)null && ((Component)loadingScreen).gameObject.activeSelf && loadingScreen.alpha > 0f; if (!flag && !flag2) { if (_applied) { Restore(); } _tint = null; } } } private static Color? _tint; private static bool _applied; private static readonly Dictionary<Graphic, Color> Original = new Dictionary<Graphic, Color>(); private static readonly Dictionary<(Sprite, int), Sprite> Repainted = new Dictionary<(Sprite, int), Sprite>(); private static readonly Dictionary<Image, Sprite> OriginalSprite = new Dictionary<Image, Sprite>(); public static bool Applied => _applied; private static Color GlowOf(TeleportWorld portal) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0044: 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_002d: 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_0059: Unknown result type (might be due to invalid IL or missing references) Color colorTargetfound = portal.m_colorTargetfound; float num = Mathf.Max(colorTargetfound.r, Mathf.Max(colorTargetfound.g, colorTargetfound.b)); return (Color)((num > 0f) ? new Color(colorTargetfound.r / num, colorTargetfound.g / num, colorTargetfound.b / num, 1f) : Color.white); } private static void Apply(GameObject swirl, Color tint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float saturation = default(float); float num2 = default(float); Color.RGBToHSV(tint, ref num, ref saturation, ref num2); int num3 = Mathf.RoundToInt(num * 24f) % 24; Graphic[] componentsInChildren = swirl.GetComponentsInChildren<Graphic>(true); foreach (Graphic val in componentsInChildren) { Image val2 = (Image)(object)((val is Image) ? val : null); if (val2 != null && (Object)(object)val2.sprite != (Object)null && !(val is Text)) { if (!OriginalSprite.ContainsKey(val2)) { OriginalSprite[val2] = val2.sprite; } Sprite val3 = OriginalSprite[val2]; if (!Repainted.TryGetValue((val3, num3), out var value)) { value = (Repainted[(val3, num3)] = Repaint.HueSprite(val3, (float)num3 / 24f, saturation)); } if ((Object)(object)value != (Object)null) { val2.sprite = value; } } else { if (!Original.ContainsKey(val)) { Original[val] = val.color; } Color val5 = Original[val]; Color color = Color.Lerp(val5, new Color(tint.r, tint.g, tint.b, val5.a), 0.6f); color.a = val5.a; val.color = color; } } _applied = true; } private static void Restore() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Graphic, Color> item in Original) { if ((Object)(object)item.Key != (Object)null) { item.Key.color = item.Value; } } foreach (KeyValuePair<Image, Sprite> item2 in OriginalSprite) { if ((Object)(object)item2.Key != (Object)null) { item2.Key.sprite = item2.Value; } } _applied = false; } } public static class Pairing { [HarmonyPatch(typeof(Game), "ConnectPortals")] public static class PartMixed { private static void Prefix(Game __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) if (!On || SetConnection == null) { return; } foreach (ZDO portal in ZDOMan.instance.GetPortalList()) { ZDOID connectionZDOID = portal.GetConnectionZDOID((ConnectionType)1); if (!((ZDOID)(ref connectionZDOID)).IsNone()) { ZDO zDO = ZDOMan.instance.GetZDO(connectionZDOID); if (zDO != null && !SameType(portal, zDO)) { SetConnection.Invoke(__instance, new object[3] { portal, ZDOID.None, false }); } } } } } [HarmonyPatch(typeof(Game), "FindRandomUnconnectedPortal")] public static class SameTypeSearch { private static bool Prefix(Game __instance, List<ZDO> portals, ZDO skip, string tag, ref ZDO __result) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!On) { return true; } List<ZDO> list = new List<ZDO>(); foreach (ZDO portal in portals) { if (portal != skip && !(portal.GetString(ZDOVars.s_tag, "") != tag) && SameType(portal, skip) && !(portal.GetConnectionZDOID((ConnectionType)1) != ZDOID.None) && (!(IsConnecting != null) || !(bool)IsConnecting.Invoke(__instance, new object[1] { portal }))) { list.Add(portal); } } __result = ((list.Count == 0) ? null : list[Random.Range(0, list.Count)]); return false; } } public static Setting<bool> SameTypeOnly; private static readonly MethodInfo SetConnection = AccessTools.Method(typeof(Game), "SetConnection", new Type[3] { typeof(ZDO), typeof(ZDOID), typeof(bool) }, (Type[])null); private static readonly MethodInfo IsConnecting = AccessTools.Method(typeof(Game), "IsCurrentlyConnectingPortal", new Type[1] { typeof(ZDO) }, (Type[])null); private static bool On => SameTypeOnly == null || SameTypeOnly.Value; public static bool SameType(ZDO a, ZDO b) { return a != null && b != null && a.GetPrefab() == b.GetPrefab(); } } public static class PlacementGlow { [HarmonyPatch(typeof(Player), "SetupPlacementGhost")] public static class Setup { private static void Postfix(Player __instance) { try { Light(Ghost.Invoke(__instance)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("placement glow: " + ex.Message)); } } } public const float Strength = 0.75f; private static readonly FieldRef<Player, GameObject> Ghost = AccessTools.FieldRefAccess<Player, GameObject>("m_placementGhost"); private static readonly FieldRef<TeleportWorld, float> Alpha = AccessTools.FieldRefAccess<TeleportWorld, float>("m_colorAlpha"); public static bool Light(GameObject ghost) { //IL_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references) TeleportWorld val = (((Object)(object)ghost != (Object)null) ? ghost.GetComponent<TeleportWorld>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val.m_model == (Object)null) { return false; } Alpha.Invoke(val) = 0.75f; Material material = ((Renderer)val.m_model).material; material.EnableKeyword("_EMISSION"); material.SetColor("_EmissionColor", Color.Lerp(val.m_colorUnconnected, val.m_colorTargetfound, 0.75f)); return true; } } public static class PortalPrefabs { private struct Spot { public float Angle; public float Out; public float Forward; public float Size; public float Twist; public float Lift; public float Wobble; public float Sink; public float Tilt; public float Back; public bool Along; public bool Radial; public bool Mirror; public bool Fixed; public Vector3 Euler; public Spot(float angle, float @out, float forward, float size, bool along, float twist = 0f, float lift = 0f, float wobble = 20f, float sink = 0.02f) { //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) Angle = angle; Out = @out; Forward = forward; Size = size; Along = along; Twist = twist; Lift = lift; Wobble = wobble; Sink = sink; Radial = false; Mirror = false; Tilt = 0f; Fixed = false; Euler = Vector3.zero; Back = 0f; } public static Spot Set(float angle, float size, float forward, Vector3 euler) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Spot result = new Spot(angle, 0.1f, forward, size, along: false); result.Fixed = true; result.Euler = euler; return result; } public static Spot Out_(float angle, float size, float tilt, bool mirror) { Spot result = new Spot(angle, 0.15f, 0f, size, along: false); result.Radial = true; result.Tilt = tilt; result.Mirror = mirror; return result; } } public const string SourcePrefab = "portal_wood"; private const int WoodAmount = 20; private const int SurtlingCores = 2; private const int BiomeMaterial = 10; private static GameObject _holder; private static CraftingStation _workbench; private static readonly Dictionary<string, GameObject> Built = new Dictionary<string, GameObject>(); private static readonly Vector3 RingCentre = new Vector3(0f, 1.45f, 0f); private const float RingX = 1.3f; private const float RingY = 1.35f; private static bool NeedsWorkbench => !(Plugin.NoWorkbench?.Value ?? false); public static IEnumerable<GameObject> Prefabs => Built.Values; private static bool Graphics => (int)SystemInfo.graphicsDeviceType != 4; public static void ApplyWorkbenchRule() { foreach (GameObject prefab in Prefabs) { prefab.GetComponent<Piece>().m_craftingStation = (NeedsWorkbench ? _workbench : null); } } public static bool Build(GameObject source, Func<string, GameObject> find) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (Built.Count == Tiers.All.Length) { return true; } if ((Object)(object)source == (Object)null) { return false; } if ((Object)(object)_holder == (Object)null) { _holder = new GameObject("MySix_ProgressivePortals_Prefabs"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); } Tier[] all = Tiers.All; foreach (Tier tier in all) { if (!Built.ContainsKey(tier.Prefab)) { GameObject val = Make(tier, source, find); if ((Object)(object)val == (Object)null) { return false; } Built[tier.Prefab] = val; } } return true; } private static GameObject Make(Tier tier, GameObject source, Func<string, GameObject> find) { //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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01c8: Expected O, but got Unknown //IL_01ca: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) GameObject obj = find(tier.Wood); ItemDrop val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null); GameObject obj2 = find("SurtlingCore"); ItemDrop val2 = ((obj2 != null) ? obj2.GetComponent<ItemDrop>() : null); GameObject val3 = find(tier.Material); ItemDrop val4 = ((val3 != null) ? val3.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val4 == (Object)null) { Plugin.Log.LogWarning((object)(tier.Prefab + ": the game has no " + tier.Wood + ", SurtlingCore or " + tier.Material + " yet")); return null; } GameObject val5 = Object.Instantiate<GameObject>(source, _holder.transform, false); ((Object)val5).name = tier.Prefab; val5.AddComponent<BiomePortal>().m_tier = tier.Prefab; Piece component = val5.GetComponent<Piece>(); if ((Object)(object)_workbench == (Object)null) { _workbench = component.m_craftingStation; } component.m_craftingStation = (NeedsWorkbench ? _workbench : null); component.m_name = tier.NameToken; component.m_description = tier.DescriptionToken; component.m_resources = (Requirement[])(object)new Requirement[3] { new Requirement { m_resItem = val, m_amount = 20, m_recover = true }, new Requirement { m_resItem = val2, m_amount = 2, m_recover = true }, new Requirement { m_resItem = val4, m_amount = 10, m_recover = true } }; TeleportWorld component2 = val5.GetComponent<TeleportWorld>(); component2.m_allowAllItems = false; if (Graphics) { component2.m_colorTargetfound = tier.Glow * tier.GlowStrength; MeshRenderer[] componentsInChildren = val5.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val6 in componentsInChildren) { ((Renderer)val6).sharedMaterials = ((Renderer)val6).sharedMaterials.Select((Material m) => ((Object)(object)m == (Object)null) ? null : Repaint.Frame(m, tier)).ToArray(); } Recolour(component2, tier); Reshape.Apply(val5, tier, find); if (tier.Yggdrasil) { ColorShift colorShift = val5.AddComponent<ColorShift>(); colorShift.m_tier = tier.Prefab; colorShift.m_from = tier.Glow; colorShift.m_to = new Color(0.45f, 0.8f, 1f); val5.AddComponent<Lightning>(); } Effects.Apply(val5, tier, find); MeshRenderer component3 = ((Component)val5.transform.Find("New/small_portal")).GetComponent<MeshRenderer>(); Texture marks = (((Renderer)component3).sharedMaterial.HasProperty("_EmissionMap") ? ((Renderer)component3).sharedMaterial.GetTexture("_EmissionMap") : null); if (tier.Level == 1) { Bark(val5, find, "SwampTree1", new Color(0.78f, 0.8f, 0.72f)); } else if (tier.Level == 2) { BarkBlend(val5, find, new(string, string)[2] { ("Pinetree_01_Stub", "bark3"), ("Birch1", "birch") }, new Color(0.92f, 0.95f, 1f)); MeshRenderer component4 = ((Component)val5.transform.Find("New/small_portal")).GetComponent<MeshRenderer>(); GameObject obj3 = find("caverock_ice_stalagtite"); object obj4; if (obj3 == null) { obj4 = null; } else { MeshRenderer componentInChildren = obj3.GetComponentInChildren<MeshRenderer>(true); obj4 = ((componentInChildren != null) ? ((Renderer)componentInChildren).sharedMaterial : null); } Material ice = (Material)obj4; FrostPaint.Apply(component4, ((Component)component4).GetComponent<MeshFilter>().sharedMesh, ice, Reshape.FrostWeight); } else if (tier.Yggdrasil) { WorldTree(val5, find); } else if (tier.Level == 4) { Bark(val5, find, "YggdrasilWood", new Color(0.85f, 0.8f, 0.95f)); } if (tier.Level == 1) { Repaint.Carve(component3, marks, 0f, (Color?)new Color(0.9f, 0.84f, 0.66f), "_MainTex"); } else if (tier.Level == 5) { Repaint.Carve(component3, marks, 0f, (Color?)new Color(0.55f, 0.25f, 0.75f), "_MainTex"); } else if (tier.Yggdrasil) { Repaint.Carve(component3, marks, 0f, (Color?)new Color(0.35f, 0.85f, 0.45f), "_MainTex"); } else if (tier.Level != 3) { Repaint.Carve(component3, marks, 0.75f); } if (tier.Yggdrasil) { Repaint.Carve(component3, marks, 0f, Color.black, "_EmissiveMaskTex"); } Decorate(val5, tier, val3, Layout(tier)); if (tier.Yggdrasil) { Decorate(val5, tier, find("YggaShoot_small1"), new Spot[1] { Spot.Set(80f, 0.9f, 0.02f, new Vector3(0f, 40f, 0f)) }); } else if (tier.Level == 5) { Transform val7 = val5.transform.Find("New/MySix_decoration_AncientSeed"); Sparkle(val7, val3); Reshape.Vines(val5, tier, Seeds(val7)); GreydwarfHeads(val5, find, tier); } else if (tier.Level == 1) { Decorate(val5, tier, find("TrophySkeleton"), Skulls()); } else if (tier.Level == 4) { Decorate(val5, tier, find("Mandible"), Mandibles()); Decorate(val5, tier, find("TrophySeeker"), Wings()); Decorate(val5, tier, find("QueenDrop"), QueenPlates()); Decorate(val5, tier, find("TrophySeekerBrute"), Head()); } Sprite val8 = Icons.Load(tier.Prefab); if ((Object)(object)val8 != (Object)null) { component.m_icon = val8; } else if ((Object)(object)component.m_icon != (Object)null) { component.m_icon = Repaint.Icon(component.m_icon, tier); } } Plugin.Log.LogInfo((object)($"{tier.Prefab} made from {((Object)source).name}: {20} {tier.Wood}, {2} SurtlingCore, " + string.Format("{0} {1}, lets through {2}", 10, tier.Material, string.Join(", ", Tiers.Allowed(tier, hildir: false))))); return val5; } private static void Recolour(TeleportWorld portal, Tier tier) { if ((Object)(object)portal.m_target_found != (Object)null) { RecolourEffect(((Component)portal.m_target_found).transform, tier); } if (portal.m_connected?.m_effectPrefabs == null) { return; } EffectData[] effectPrefabs = portal.m_connected.m_effectPrefabs; foreach (EffectData val in effectPrefabs) { if (!((Object)(object)val?.m_prefab == (Object)null) && !((Object)(object)val.m_prefab.GetComponent<ZNetView>() != (Object)null)) { GameObject val2 = Object.Instantiate<GameObject>(val.m_prefab, _holder.transform, false); ((Object)val2).name = ((Object)val.m_prefab).name + "_" + tier.Prefab; RecolourEffect(val2.transform, tier); val.m_prefab = val2; } } } internal static void RecolourEffect(Transform root, Tier tier) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Invalid comparison between Unknown and I4 //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01a3: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = ((Component)root).GetComponentsInChildren<Light>(true); foreach (Light val in componentsInChildren) { val.color = tier.Glow; } ParticleSystem[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren2) { MainModule main = val2.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; if ((int)((MinMaxGradient)(ref startColor)).mode == 2) { Color colorMax = ((MinMaxGradient)(ref startColor)).colorMax; if (((Color)(ref colorMax)).maxColorComponent < 0.1f) { continue; } } if ((int)((MinMaxGradient)(ref startColor)).mode == 2 && Warm(((MinMaxGradient)(ref startColor)).colorMax)) { ((MainModule)(ref main)).startColor = new MinMaxGradient(tier.GlowDeep, tier.Glow); } else { ((MainModule)(ref main)).startColor = Repaint.Gradient(startColor, tier); } ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = Repaint.Gradient(((ColorOverLifetimeModule)(ref colorOverLifetime)).color, tier); } TrailModule trails = val2.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).colorOverLifetime = Repaint.Gradient(((TrailModule)(ref trails)).colorOverLifetime, tier); } CustomDataModule customData = val2.customData; if (((CustomDataModule)(ref customData)).enabled) { ParticleSystemCustomData[] array = (ParticleSystemCustomData[])(object)new ParticleSystemCustomData[2] { default(ParticleSystemCustomData), (ParticleSystemCustomData)1 }; foreach (ParticleSystemCustomData val3 in array) { if ((int)((CustomDataModule)(ref customData)).GetMode(val3) == 2) { ((CustomDataModule)(ref customData)).SetColor(val3, Repaint.Gradient(((CustomDataModule)(ref customData)).GetColor(val3), tier)); } } } ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).sharedMaterials = ((Renderer)component).sharedMaterials.Select((Material m) => Repaint.Particle(m, tier)).ToArray(); } } } private static bool Warm(Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(c, ref num, ref num2, ref num3); return num2 >= 0.15f; } private static string Describe(MinMaxGradient g) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode; ParticleSystemGradientMode val = mode; if ((int)val != 1) { if ((int)val == 3) { return "two gradients " + string.Join(" ", ((MinMaxGradient)(ref g)).gradientMax.colorKeys.Select((GradientColorKey k) => $"{k.time:0.00}:{k.color}")); } return ((object)((MinMaxGradient)(ref g)).mode/*cast due to .constrained prefix*/).ToString() + " " + ((object)((MinMaxGradient)(ref g)).color/*cast due to .constrained prefix*/).ToString() + " " + ((object)((MinMaxGradient)(ref g)).colorMin/*cast due to .constrained prefix*/).ToString() + " " + ((object)((MinMaxGradient)(ref g)).colorMax/*cast due to .constrained prefix*/).ToString(); } return "gradient " + string.Join(" ", ((MinMaxGradient)(ref g)).gradient.colorKeys.Select((GradientColorKey k) => $"{k.time:0.00}:{k.color}")); } private static IEnumerable<Spot> Mandibles() { yield return Spot.Out_(14f, 1f, -22f, mirror: true); yield return Spot.Out_(166f, 1f, 22f, mirror: false); yield return Spot.Out_(-22f, 0.9f, -12f, mirror: true); yield return Spot.Out_(202f, 0.9f, 12f, mirror: false); } private static IEnumerable<Spot> Wings() { yield return new Spot(84f, 0.15f, -0.14f, 1.1f, along: false) { Radial = true, Tilt = 8f, Back = 0.8f, Mirror = false }; yield return new Spot(96f, 0.15f, -0.14f, 1.1f, along: false) { Radial = true, Tilt = -8f, Back = 0.8f, Mirror = true }; } private static IEnumerable<Spot> QueenPlates() { yield return new Spot(30f, 0.15f, 0.02f, 0.62f, along: false, 8f, -18f, 6f); yield return new Spot(157f, 0.15f, -0.02f, 0.58f, along: false, -6f, -20f, 6f); yield return new Spot(-38f, 0.15f, 0f, 0.55f, along: false, 4f, -16f, 6f); } private static List<(Vector3 centre, float radius)> Seeds(Transform root) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005b: 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_006e: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) List<(Vector3, float)> list = new List<(Vector3, float)>(); if ((Object)(object)root == (Object)null) { return list; } foreach (Transform item3 in root) { Transform val = item3; MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); Mesh val2 = ((component != null) ? component.sharedMesh : null); if (!((Object)(object)val2 == (Object)null)) { Vector3 localPosition = val.localPosition; Quaternion localRotation = val.localRotation; Bounds bounds = val2.bounds; Vector3 item = localPosition + localRotation * Vector3.Scale(((Bounds)(ref bounds)).center, val.localScale); bounds = val2.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; float item2 = ((Vector3)(ref extents)).magnitude * Mathf.Abs(val.localScale.x) * 0.55f; list.Add((item, item2)); } } return list; } private static void Sparkle(Transform seeds, GameObject item) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0144: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_01a9: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0102: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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) ParticleSystem val = (((Object)(object)item != (Object)null) ? item.GetComponent<ParticleSystem>() : null); Light val2 = (((Object)(object)item != (Object)null) ? item.GetComponentInChildren<Light>(true) : null); if ((Object)(object)seeds == (Object)null || (Object)(object)val == (Object)null) { return; } foreach (Transform item2 in ((IEnumerable)seeds).Cast<Transform>().ToList()) { MeshFilter component = ((Component)item2).GetComponent<MeshFilter>(); Mesh val3 = ((component != null) ? component.sharedMesh : null); if (!((Object)(object)val3 == (Object)null)) { Bounds bounds; if ((Object)(object)val2 != (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(((Component)val2).gameObject, seeds, false); ((Object)val4).name = "MySix_seed_light"; Transform transform = val4.transform; Vector3 localPosition = item2.localPosition; Quaternion localRotation = item2.localRotation; bounds = val3.bounds; transform.localPosition = localPosition + localRotation * Vector3.Scale(((Bounds)(ref bounds)).center, item2.localScale); val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one; } GameObject val5 = new GameObject("MySix_seed_sparkle"); val5.transform.SetParent(seeds, false); Transform transform2 = val5.transform; Vector3 localPosition2 = item2.localPosition; Quaternion localRotation2 = item2.localRotation; bounds = val3.bounds; transform2.localPosition = localPosition2 + localRotation2 * Vector3.Scale(((Bounds)(ref bounds)).center, item2.localScale); ParticleSystem val6 = val5.AddComponent<ParticleSystem>(); ((Renderer)val5.GetComponent<ParticleSystemRenderer>()).sharedMaterial = ((Renderer)((Component)val).GetComponent<ParticleSystemRenderer>()).sharedMaterial; val6.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val6.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1.4f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.02f, 0.12f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.04f, 0.12f); MeshRenderer component2 = ((Component)item2).GetComponent<MeshRenderer>(); Material val7 = ((component2 != null) ? ((Renderer)component2).sharedMaterial : null); Color val8 = (((Object)(object)val7 != (Object)null && val7.HasProperty("_EmissionColor")) ? val7.GetColor("_EmissionColor") : Color.white); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(Mathf.Clamp01(val8.r * 1.4f + 0.2f), Mathf.Clamp01(val8.g * 1.4f + 0.2f), Mathf.Clamp01(val8.b * 1.4f + 0.2f), 0.9f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 20; EmissionModule emission = val6.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(6f); ShapeModule shape = val6.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; bounds = val3.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; ((ShapeModule)(ref shape)).radius = ((Vector3)(ref extents)).magnitude * Mathf.Abs(item2.localScale.x) * 0.5f; } } } private static void GreydwarfHeads(GameObject prefab, Func<string, GameObject> find, Tier tier) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: 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_01c7: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: 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) Transform val = prefab.transform.Find("New") ?? prefab.transform; Transform transform = new GameObject("MySix_greydwarf_heads").transform; transform.SetParent(val, false); Reshape.Surface surface = Reshape.SurfaceOf(tier); Dictionary<Material, Material> eyes = new Dictionary<Material, Material>(); (string, float, float)[] array = new(string, float, float)[4] { ("TrophyGreydwarfBrute", 90f, 0.85f), ("TrophyGreydwarf", 22f, 0.55f), ("TrophyGreydwarfShaman", 140f, 0.6f), ("TrophyGreydwarf", 205f, 0.5f) }; for (int i = 0; i < array.Length; i++) { (string, float, float) tuple = array[i]; string item = tuple.Item1; float item2 = tuple.Item2; float item3 = tuple.Item3; GameObject obj = find(item); Transform val2 = ((obj != null) ? obj.transform.Find("attach") : null); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)(tier.Prefab + ": no " + item + " head to set on it")); continue; } Transform transform2 = new GameObject(item).transform; transform2.SetParent(transform, false); Bounds val3 = default(Bounds); bool flag = false; MeshRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val4 in componentsInChildren) { MeshFilter component = ((Component)val4).GetComponent<MeshFilter>(); Mesh val5 = ((component != null) ? component.sharedMesh : null); if (!((Object)(object)val5 == (Object)null)) { GameObject val6 = new GameObject(((Object)val4).name); val6.transform.SetParent(transform2, false); Matrix4x4 val7 = val2.worldToLocalMatrix * ((Component)val4).transform.localToWorldMatrix; val6.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val7)).GetColumn(3)); val6.transform.localRotation = Quaternion.LookRotation(Vector4.op_Implicit(((Matrix4x4)(ref val7)).GetColumn(2)), Vector4.op_Implicit(((Matrix4x4)(ref val7)).GetColumn(1))); Transform transform3 = val6.transform; Vector4 column = ((Matrix4x4)(ref val7)).GetColumn(0); float magnitude = ((Vector4)(ref column)).magnitude; column = ((Matrix4x4)(ref val7)).GetColumn(1); float magnitude2 = ((Vector4)(ref column)).magnitude; column = ((Matrix4x4)(ref val7)).GetColumn(2); transform3.localScale = new Vector3(magnitude, magnitude2, ((Vector4)(ref column)).magnitude); val6.AddComponent<MeshFilter>().sharedMesh = val5; MeshRenderer val8 = val6.AddComponent<MeshRenderer>(); ((Renderer)val8).sharedMaterials = ((Renderer)val4).sharedMaterials.Select(Eye).ToArray(); ((Renderer)val8).shadowCastingMode = (ShadowCastingMode)1; if (((Object)val4).name == "model" && (Object)(object)((Component)val4).transform.parent == (Object)(object)val2) { val3 = GeometryUtility.CalculateBounds(val5.vertices, val7); flag = true; } } } if (flag) { float num = item3 / Mathf.Max(((Bounds)(ref val3)).size.y, 0.01f); transform2.localScale = Vector3.one * num; float num2 = item2 * ((float)Math.PI / 180f); Vector3 normal = new Vector3(Mathf.Cos(num2) / 1.3f, Mathf.Sin(num2) / 1.35f, 0f); Vector3 normalized = ((Vector3)(ref normal)).normalized; Vector3 val9 = RingCentre + new Vector3(Mathf.Cos(num2) * 1.3f, Mathf.Sin(num2) * 1.35f, 0f); if (surface != null && surface.Closest(val9 + normalized * 0.6f, out var point, out normal)) { val9 = point; } if (item2 == 90f) { transform2.localPosition = val9 + new Vector3(0f, -0.35f, 0.16f) - Vector3.Scale(new Vector3(((Bounds)(ref val3)).center.x, ((Bounds)(ref val3)).min.y, ((Bounds)(ref val3)).center.z), transform2.localScale); } else { transform2.localPosition = val9 + new Vector3(0f, 0f, 0.24f) - normalized * 0.08f - Vector3.Scale(((Bounds)(ref val3)).center, transform2.localScale); } } } Material Eye(Material m) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0097: Expected O, but got Unknown //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) if ((Object)(object)m == (Object)null || !((Object)m).name.StartsWith("eye", StringComparison.Ordinal) || !m.HasProperty("_EmissionColor")) { return m; } if (!eyes.TryGetValue(m, out var value)) { Color val10 = default(Color); ((Color)(ref val10))..ctor(0.42f, 0.02f, 0.9f); value = new Material(m) { name = ((Object)m).name + "_" + tier.Prefab, color = val10 }; value.EnableKeyword("_EMISSION"); value.SetColor("_EmissionColor", val10 * 0.8f); eyes[m] = value; } return value; } } private static IEnumerable<Spot> Skulls() { yield return Spot.Set(90f, 0.62f, 0.27f, Vector3.zero); yield return Spot.Set(28f, 0.42f, 0.27f, new Vector3(0f, 0f, -25f)); yield return Spot.Set(152f, 0.42f, 0.27f, new Vector3(0f, 0f, 25f)); } private static IEnumerable<Spot> Head() { yield return Spot.Set(90f, 0.95f, 0.18f, Vector3.zero); } private static IEnumerable<Spot> Layout(Tier tier) { Random eitr; if (tier.Yggdrasil) { eitr = new Random(5); float[] array = new float[4] { 52f, 70f, 110f, 128f }; foreach (float a in array) { yield return new Spot(a + E(-6f, 6f), 0.1f, ((eitr.NextDouble() < 0.5) ? (-1f) : 1f) * 0.24f, E(0.1f, 0.17f), along: true, 0f, 0f, 20f, -0.3f); } float[] array2 = new float[2] { 35f, 150f }; foreach (float a2 in array2) { yield return new Spot(a2 + E(-5f, 5f), 0.2f, E(-0.08f, 0.08f), E(0.12f, 0.2f), along: false, 0f, 0f, 20f, -0.35f); } yield break; } switch (tier.Level) { case 1: { for (float a5 = -46f; a5 <= 226f; a5 += 22f) { yield return new Spot(a5, 0.1f, 0.24f, 1.08f, along: true, 5f, 0f, 20f, 0.12f); } yield return new Spot(90f, 0.05f, 0.22f, 0.95f, along: true); yield break; } case 2: { Random glands = new Random(2); for (float a3 = -14f; a3 <= 194f; a3 += 15f + (float)glands.NextDouble() * 8f) { yield return new Spot(a3, 0.22f, ((float)glands.NextDouble() - 0.5f) * 0.12f, 0.38f + (float)glands.NextDouble() * 0.22f, along: false, 0f, 0f, 20f, -0.18f); } yield break; } case 3: yield break; case 5: { (float, float, float)[] array3 = new(float, float, float)[6] { (-30f, 0.14f, 0.85f), (12f, -0.12f, 0.75f), (48f, 0.16f, 0.7f), (132f, -0.14f, 0.7f), (168f, 0.12f, 0.75f), (210f, -0.14f, 0.85f) }; for (int k = 0; k < array3.Length; k++) { var (a4, f, size) = array3[k]; yield return new Spot(a4, 0.2f, f, size, along: false, 20f, 0f, 25f, -0.22f); } yield break; } } Random scales = new Random(4); float[] array4 = new float[2] { -1f, 1f }; foreach (float row in array4) { for (float a6 = -64f + ((row < 0f) ? 0f : 6f); a6 <= 244f; a6 += R(9f, 16f)) { if (!(a6 > 78f) || !(a6 < 102f)) { yield return new Spot(a6, 0.15f, row * 0.05f, R(0.3f, 0.5f), along: false, R(-10f, 10f), R(-30f, -14f), 12f); } } } float E(float num, float b) { return num + (float)eitr.NextDouble() * (b - num); } } private static void Decorate(GameObject prefab, Tier tier, GameObject item, IEnumerable<Spot> spots) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_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_015f: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: 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_02bf: 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) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: 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_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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_040e: 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_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due