Decompiled source of SkyfallIsles v0.1.49

plugins/SkyfallIsles/SkyfallIsles.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Photon.Pun;
using Photon.Realtime;
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using Zorro.Core;
using pworld.Scripts.Extensions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Skyfall Isles")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.49.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkyfallIsles
{
	internal class Builder
	{
		private class KitMats
		{
			public BiomeKit kit;

			public Material top;

			public Material rock;

			public Material slip;

			public Material shaky;

			public Material shakyTop;

			public Material dark;

			public Material root;

			public Color vtx = Color.white;
		}

		private class MeshParts
		{
			public readonly List<Vector3> v = new List<Vector3>();

			public readonly List<Vector2> uv = new List<Vector2>();

			public readonly List<int>[] tri = new List<int>[2]
			{
				new List<int>(),
				new List<int>()
			};

			private readonly Transform _space;

			public MeshParts(Transform space)
			{
				_space = space;
			}

			private int P(Vector3 world, Vector2 uv0)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				v.Add(_space.InverseTransformPoint(world));
				uv.Add(uv0);
				return v.Count - 1;
			}

			public void Tube(Vector3 a, Vector3 b, float r0, float r1, int sides, int sub, float twist = 0f)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: 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_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = b - a;
				if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f))
				{
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					Vector3 val2 = Vector3.Cross(normalized, (Mathf.Abs(normalized.y) > 0.9f) ? Vector3.right : Vector3.up);
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					Vector3 val3 = Vector3.Cross(normalized, normalized2);
					int count = v.Count;
					for (int i = 0; i <= sides; i++)
					{
						float num = (float)i / (float)sides * MathF.PI * 2f + twist;
						Vector3 val4 = normalized2 * Mathf.Cos(num) + val3 * Mathf.Sin(num);
						P(a + val4 * r0, new Vector2((float)i / (float)sides, 0f));
						P(b + val4 * Mathf.Max(r1, 0.001f), new Vector2((float)i / (float)sides, ((Vector3)(ref val)).magnitude * 0.25f));
					}
					List<int> list = tri[sub];
					for (int j = 0; j < sides; j++)
					{
						int num2 = count + j * 2;
						list.Add(num2);
						list.Add(num2 + 2);
						list.Add(num2 + 1);
						list.Add(num2 + 1);
						list.Add(num2 + 2);
						list.Add(num2 + 3);
					}
				}
			}

			public void Lump(Vector3 c, float r, Rng rng, int sub)
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				int num = 4;
				int num2 = 6;
				int count = v.Count;
				float num3 = rng.R(0f, 6.3f);
				float num4 = rng.R(0f, 6.3f);
				float num5 = rng.R(0.6f, 1f);
				Vector3 val = default(Vector3);
				for (int i = 0; i <= num; i++)
				{
					float num6 = (float)i / (float)num * MathF.PI;
					for (int j = 0; j <= num2; j++)
					{
						float num7 = (float)j / (float)num2 * MathF.PI * 2f;
						((Vector3)(ref val))..ctor(Mathf.Sin(num6) * Mathf.Sin(num7), Mathf.Cos(num6), Mathf.Sin(num6) * Mathf.Cos(num7));
						float num8 = 1f + 0.25f * Mathf.Sin(val.x * 3.1f + num3) * Mathf.Sin(val.z * 2.7f + num4);
						Vector3 val2 = val * r * num8;
						val2.y *= num5;
						P(c + val2, new Vector2((float)j / (float)num2, (float)i / (float)num));
					}
				}
				List<int> list = tri[sub];
				int num9 = num2 + 1;
				for (int k = 0; k < num; k++)
				{
					for (int l = 0; l < num2; l++)
					{
						int num10 = count + k * num9 + l;
						int num11 = count + (k + 1) * num9 + l;
						list.Add(num10);
						list.Add(num11 + 1);
						list.Add(num10 + 1);
						list.Add(num10);
						list.Add(num11);
						list.Add(num11 + 1);
					}
				}
			}

			public Mesh Build(string name)
			{
				//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_001c: Expected O, but got Unknown
				if (v.Count == 0)
				{
					return null;
				}
				Mesh val = new Mesh
				{
					name = name
				};
				if (v.Count > 65000)
				{
					val.indexFormat = (IndexFormat)1;
				}
				val.SetVertices(v);
				val.SetUVs(0, uv);
				val.subMeshCount = 2;
				val.SetTriangles(tri[0], 0);
				val.SetTriangles(tri[1], 1);
				val.RecalculateNormals();
				val.RecalculateBounds();
				return val;
			}
		}

		private const string Cat = "建造";

		private readonly SceneInfo _info;

		private readonly Plan _plan;

		private readonly Transform _root;

		private readonly int _layer;

		private readonly Rng _rng;

		private Material _top;

		private Material _rock;

		private Material _slip;

		private Material _shaky;

		private Material _wood;

		private Material _poison;

		private Material _spike;

		private Material _mush;

		private Material _spore;

		private Material _ruin;

		private Material _spider;

		private Material _thorn;

		private Material _dark;

		private Material _stainPoison;

		private Material _stainSpore;

		public readonly Dictionary<int, SkyIsland> Islands = new Dictionary<int, SkyIsland>();

		public readonly Dictionary<int, ShakyRock> Shaky = new Dictionary<int, ShakyRock>();

		public readonly Dictionary<int, SkyBridge> Bridges = new Dictionary<int, SkyBridge>();

		public readonly Dictionary<int, SpikeTrap> Spikes = new Dictionary<int, SpikeTrap>();

		public readonly Dictionary<int, SpiderAmbush> Spiders = new Dictionary<int, SpiderAmbush>();

		public readonly List<Vector4> SporeZones = new List<Vector4>();

		public readonly Dictionary<int, TempleMachine> Temples = new Dictionary<int, TempleMachine>();

		public readonly List<TornadoPad> Pads = new List<TornadoPad>();

		public readonly Dictionary<int, List<Vector4>> Avoid = new Dictionary<int, List<Vector4>>();

		public int shelterCount;

		public int waterfallCount;

		public int bigRuinCount;

		public int giantCount;

		private Material _gold;

		private Material _stainGold;

		private Material _stainWind;

		private readonly List<KitMats> _kits = new List<KitMats>();

		public readonly Dictionary<string, int> kitUse = new Dictionary<string, int>();

		public int undersideParts;

		public int landmarkCount;

		public int propsDropped;

		public int undersideSolid;

		private readonly Dictionary<IslandSpec, int> _zoneCache = new Dictionary<IslandSpec, int>();

		public int decorCount;

		public int beamCount;

		public int ruinCount;

		public int noColliderFixed;

		public int darkFaceTotal;

		public int darkIslands;

		public int stainCount;

		public int chainPads;

		public readonly SortedDictionary<string, int> featureCount = new SortedDictionary<string, int>(StringComparer.Ordinal);

		public readonly List<SteamVent> Vents = new List<SteamVent>();

		public readonly List<FireJet> Fires = new List<FireJet>();

		public int ambientCount;

		public int decorWanted;

		public readonly SortedDictionary<string, int> decorRejected = new SortedDictionary<string, int>(StringComparer.Ordinal);

		public int treeMesh;

		public int treeCaps;

		public int pricklyMade;

		public int resat;

		private Vector3[] _beachMesh;

		private static Texture2D _cloudTex;

		private KitMats KitFor(IslandSpec s)
		{
			if (_kits.Count <= 1 || s.kind == IslandKind.Shore)
			{
				if (_kits.Count <= 0)
				{
					return null;
				}
				return _kits[0];
			}
			return _kits[Mathf.Clamp(ZoneOf(s), 0, _kits.Count - 1)];
		}

		private int ZoneOf(IslandSpec s)
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (_zoneCache.TryGetValue(s, out var value))
			{
				return value;
			}
			List<int> route = _plan.route;
			int tier = s.tier;
			if (tier == 0 && s.kind != IslandKind.Shore && (s.kind == IslandKind.Debris || s.kind == IslandKind.Ledge || s.kind == IslandKind.Giant || s.top.y > _plan.S.y + 25f) && route.Count > 0)
			{
				float num = float.MaxValue;
				for (int i = 0; i < route.Count; i++)
				{
					IslandSpec islandSpec = _plan.Get(route[i]);
					float num2 = Mathf.Abs(islandSpec.top.y - s.top.y) * 2f;
					Vector2 val = new Vector2(islandSpec.top.x - s.top.x, islandSpec.top.z - s.top.z);
					float num3 = num2 + ((Vector2)(ref val)).magnitude * 0.5f;
					if (num3 < num)
					{
						num = num3;
						tier = islandSpec.tier;
					}
				}
			}
			value = _plan.KitOfTier(tier);
			if ((s.kind == IslandKind.Step || s.kind == IslandKind.Ledge) && tier + 1 < route.Count)
			{
				int num4 = _plan.KitOfTier(tier + 1);
				if (num4 != value)
				{
					IslandSpec islandSpec2 = _plan.Get(route[tier]);
					IslandSpec islandSpec3 = _plan.Get(route[tier + 1]);
					float num5 = ((Mathf.Abs(islandSpec3.top.y - islandSpec2.top.y) < 1f) ? 0f : ((s.top.y - islandSpec2.top.y) / (islandSpec3.top.y - islandSpec2.top.y)));
					float num6 = ((float)(s.shapeSeed & 0xFFFF) / 65535f - 0.5f) * 0.2f;
					if (num5 + num6 > 0.7f)
					{
						value = num4;
					}
				}
			}
			_zoneCache[s] = value;
			return value;
		}

		private void MakeKitMaterials()
		{
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: 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_03f3: 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_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: 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)
			List<BiomeKit> list = ((_info.kits.Count > 0) ? _info.kits : new List<BiomeKit>
			{
				new BiomeKit
				{
					name = "Shore",
					trees = _info.protoTrees,
					rocks = _info.protoRocks,
					bushes = _info.protoBushes
				}
			});
			bool flag = (Object)(object)_top != (Object)null && ((IEnumerable<string>)new string[5] { "_BaseColor", "_Color", "_Tint", "_MainColor", "_TintColor" }).Any((Func<string, bool>)_top.HasProperty);
			int num = 0;
			List<GameObject>[] array = new List<GameObject>[3] { _info.protoTrees, _info.protoRocks, _info.protoBushes };
			foreach (List<GameObject> list2 in array)
			{
				num += list2.RemoveAll(SceneScan.IsJunk);
			}
			foreach (BiomeKit item in list)
			{
				array = new List<GameObject>[3] { item.trees, item.rocks, item.bushes };
				foreach (List<GameObject> list3 in array)
				{
					num += list3.RemoveAll(SceneScan.IsJunk);
				}
			}
			if (num > 0)
			{
				Log.Info("建造", $"去掉了 {num} 种像箱子/箱盖的装饰原型");
			}
			for (int j = 0; j < list.Count; j++)
			{
				BiomeKit biomeKit = list[j];
				KitMats kitMats = new KitMats
				{
					kit = biomeKit
				};
				Color val = (_info.topNeedsColor ? _info.topColor : Color.white);
				if (j == 0)
				{
					kitMats.top = _top;
					kitMats.rock = _rock;
					kitMats.slip = _slip;
					kitMats.shaky = _shaky;
					kitMats.dark = _dark;
					kitMats.vtx = val;
					kitMats.shakyTop = _shaky;
				}
				else
				{
					if (_info.topNeedsColor)
					{
						kitMats.top = _top;
						kitMats.vtx = new Color(val.r * biomeKit.topTint.r, val.g * biomeKit.topTint.g, val.b * biomeKit.topTint.b, val.a);
					}
					else
					{
						kitMats.top = (flag ? Fx.Tint(_top, biomeKit.topTint) : _top);
						kitMats.vtx = val;
					}
					kitMats.rock = (((Object)(object)biomeKit.rockMat != (Object)null) ? biomeKit.rockMat : Fx.Tint(_rock, biomeKit.rockTint));
					kitMats.slip = Fx.Tint(kitMats.rock, new Color(0.55f, 0.62f, 0.75f), 0.85f);
					kitMats.shaky = _shaky;
					kitMats.shakyTop = _shaky;
					kitMats.dark = DarkOf(kitMats.rock, new Color(0.3f, 0.29f, 0.3f), biomeKit.name + " 岩石") ?? _dark;
				}
				kitMats.root = Fx.Tint(_wood ?? kitMats.rock, biomeKit.rootTint) ?? kitMats.rock;
				_kits.Add(kitMats);
			}
		}

		public void Keep(int island, Vector3 p, float r)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!Avoid.TryGetValue(island, out var value))
			{
				value = (Avoid[island] = new List<Vector4>());
			}
			value.Add(new Vector4(p.x, p.y, p.z, r));
		}

		private bool FreeSpot(int island, Vector3 p, float r)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004a: Unknown result type (might be due to invalid IL or missing references)
			if (!Avoid.TryGetValue(island, out var value))
			{
				return true;
			}
			foreach (Vector4 item in value)
			{
				Vector2 val = new Vector2(item.x - p.x, item.z - p.z);
				if (((Vector2)(ref val)).magnitude < item.w + r)
				{
					return false;
				}
			}
			return true;
		}

		public Builder(SceneInfo info, Plan plan, Transform root)
		{
			_info = info;
			_plan = plan;
			_root = root;
			_layer = info.terrainLayer;
			_rng = new Rng(plan.seed ^ 0x51ED);
		}

		public void Build(bool vinesAsBeams)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0131: 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_013f: 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_01b1: 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_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			MakeMaterials();
			foreach (IslandSpec island in _plan.islands)
			{
				try
				{
					BuildIsland(island);
				}
				catch (Exception arg)
				{
					Log.Error("建造", $"岛 #{island.id} ({island.kind}) 建造失败: {arg}");
				}
			}
			BuildSeabed();
			foreach (IslandSpec island2 in _plan.islands)
			{
				if (island2.host >= 0)
				{
					Keep(island2.host, island2.top, island2.radius + 1.5f);
				}
			}
			foreach (TempleSpec temple in _plan.temples)
			{
				Keep(temple.island, temple.plate, 3f);
				foreach (Vector4 pillar in temple.pillars)
				{
					Keep(temple.island, new Vector3(pillar.x, pillar.y, pillar.z), 2.6f);
				}
			}
			foreach (PadSpec pad in _plan.pads)
			{
				Keep(pad.island, pad.pos, 3.5f);
			}
			foreach (VentSpec vent in _plan.vents)
			{
				Keep(vent.island, vent.pos, 2.6f);
			}
			foreach (MobSpec mob in _plan.mobs)
			{
				if (mob.parent < 0)
				{
					Keep(mob.island, mob.pos, (mob.type == MobType.Skeleton) ? 1.6f : 1.2f);
				}
			}
			foreach (FireSpec fire in _plan.fires)
			{
				Keep(fire.island, fire.pos, 2f);
			}
			foreach (IslandSpec island3 in _plan.islands)
			{
				if (Islands.TryGetValue(island3.id, out var value))
				{
					try
					{
						Dress(island3, value);
					}
					catch (Exception arg2)
					{
						Log.Error("建造", $"岛 #{island3.id} 装饰失败: {arg2}");
					}
				}
			}
			foreach (TempleSpec temple2 in _plan.temples)
			{
				try
				{
					BuildTemple(temple2);
				}
				catch (Exception arg3)
				{
					Log.Error("建造", $"神殿 #{temple2.id} 失败: {arg3}");
				}
			}
			foreach (PadSpec pad2 in _plan.pads)
			{
				try
				{
					BuildPad(pad2);
				}
				catch (Exception arg4)
				{
					Log.Error("建造", $"旋风跳台 #{pad2.id} 失败: {arg4}");
				}
			}
			foreach (VentSpec vent2 in _plan.vents)
			{
				try
				{
					BuildVent(vent2);
				}
				catch (Exception arg5)
				{
					Log.Error("建造", $"喷气口 #{vent2.id} 失败: {arg5}");
				}
			}
			foreach (FireSpec fire2 in _plan.fires)
			{
				try
				{
					BuildFire(fire2);
				}
				catch (Exception arg6)
				{
					Log.Error("建造", $"喷火柱 #{fire2.id} 失败: {arg6}");
				}
			}
			foreach (IslandSpec giant in _plan.giants)
			{
				try
				{
					BuildGiant(giant);
				}
				catch (Exception arg7)
				{
					Log.Error("建造", $"远景巨岛失败: {arg7}");
				}
			}
			foreach (BridgeSpec bridge in _plan.bridges)
			{
				try
				{
					BuildBridge(bridge);
				}
				catch (Exception arg8)
				{
					Log.Error("建造", $"木桥 #{bridge.id} 失败: {arg8}");
				}
			}
			foreach (PatchSpec patch in _plan.patches)
			{
				try
				{
					BuildPatch(patch);
				}
				catch (Exception arg9)
				{
					Log.Error("建造", $"毒菌 #{patch.id} 失败: {arg9}");
				}
			}
			foreach (SpiderSpec spider in _plan.spiders)
			{
				try
				{
					BuildSpider(spider);
				}
				catch (Exception arg10)
				{
					Log.Error("建造", $"蜘蛛 #{spider.id} 失败: {arg10}");
				}
			}
			if (vinesAsBeams)
			{
				foreach (VineSpec vine in _plan.vines)
				{
					try
					{
						BuildBeam(vine);
					}
					catch (Exception arg11)
					{
						Log.Error("建造", $"石梁 #{vine.id} 失败: {arg11}");
					}
				}
			}
			int num = 0;
			foreach (KeyValuePair<int, SkyIsland> island4 in Islands)
			{
				IslandSpec spec = island4.Value.spec;
				if ((!spec.drift && !spec.shaky) || (Object)(object)island4.Value.visual == (Object)null)
				{
					continue;
				}
				Renderer[] componentsInChildren = ((Component)island4.Value.visual).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val in componentsInChildren)
				{
					if (val is ParticleSystemRenderer)
					{
						continue;
					}
					Material[] sharedMaterials = val.sharedMaterials;
					bool flag = false;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						Material val2 = Fx.LocalUV(sharedMaterials[j]);
						if ((Object)(object)val2 != (Object)(object)sharedMaterials[j])
						{
							sharedMaterials[j] = val2;
							flag = true;
						}
					}
					if (flag)
					{
						val.sharedMaterials = sharedMaterials;
						num++;
					}
				}
			}
			Log.Info("建造", $"会动的岛: {num} 个模型改用跟着岛走的贴图(新建材质 {Fx.localUVCount} 个)");
			Physics.SyncTransforms();
			try
			{
				CheckColliders();
			}
			catch (Exception ex)
			{
				Log.Error("建造", "碰撞检查出错: " + ex);
			}
			Log.Info("建造", $"建造完成: 岛 {Islands.Count},抖石 {Shaky.Count},木桥 {Bridges.Count},尖刺 {Spikes.Count},蜘蛛 {Spiders.Count},孢子区 {SporeZones.Count},装饰 {decorCount},遗迹 {ruinCount},石梁(藤蔓替代) {beamCount},悬崖上能站的深色地皮 {darkFaceTotal} 块({darkIslands} 座岛),毒/孢子范围染色 {stainCount} 处,挡风石 {shelterCount},瀑布 {waterfallCount},巨型遗迹 {bigRuinCount},远景巨岛 {giantCount},神殿 {Temples.Count},旋风跳台 {Pads.Count},补碰撞的装饰 {noColliderFixed}(树: 按模型形状 {treeMesh},按倾斜补柱 {treeCaps})");
			Log.Info("建造", string.Format("浮岛风格: {0};岛底垂根/钟乳石/碎石 {1} 件({2} 座岛的岛底有碰撞),地标 {3} 个,氛围特效 {4} 处,因为会戳进别的岛而放弃的装饰 {5} 个,补上扎刺效果的仙人掌碰撞体 {6} 个,按模型底部重新放到地面的 {7} 个", string.Join(",", kitUse.Select((KeyValuePair<string, int> kv) => kv.Key + " " + kv.Value + " 座")), undersideParts, undersideSolid, landmarkCount, ambientCount, propsDropped, pricklyMade, resat));
			Log.Info("建造", string.Format("装饰: 想放 {0} 件,放了 {1} 件;没放成的原因: {2}", decorWanted, decorCount, string.Join(",", decorRejected.Select((KeyValuePair<string, int> kv) => kv.Key + " " + kv.Value))));
			Log.Info("建造", $"机关: 喷气口 {Vents.Count}(其中弹射 {Vents.Count((SteamVent v) => v.launcher)}),喷火柱 {Fires.Count}");
			Log.Info("建造", "区域景观: " + string.Join(",", featureCount.Select((KeyValuePair<string, int> kv) => kv.Key + " " + kv.Value)));
		}

		private void MakeMaterials()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			_top = _info.topMat;
			_rock = _info.rockMat;
			_slip = Fx.Tint(_rock, new Color(0.55f, 0.62f, 0.75f), 0.85f);
			_shaky = ShakyMaterial(_rock);
			_wood = _info.woodMat ?? Fx.Tint(_rock, new Color(0.8f, 0.58f, 0.36f));
			_poison = _info.poisonMat ?? Fx.Tint(_rock, new Color(0.65f, 0.35f, 0.85f), 0.6f);
			_spike = Fx.Tint(_rock, new Color(0.35f, 0.35f, 0.38f), 0.6f);
			_mush = _info.mushroomMat ?? Fx.Tint(_rock, new Color(1.35f, 0.5f, 0.42f));
			_spore = Fx.Tint(_top, new Color(1.25f, 1.2f, 0.95f));
			_ruin = Fx.Tint(_rock, new Color(1.15f, 1.12f, 1.05f));
			_spider = Fx.Tint(_rock, new Color(0.18f, 0.14f, 0.14f), 0.5f);
			_thorn = _info.thornMat ?? _spike;
			_dark = DarkOf(_rock, new Color(0.3f, 0.29f, 0.3f), "岩石") ?? DarkOf(_top, new Color(0.3f, 0.29f, 0.3f), "地面") ?? _rock;
			_stainPoison = DarkOf(_top, new Color(0.62f, 0.28f, 0.78f), "地面") ?? _poison;
			_stainSpore = DarkOf(_top, new Color(1.15f, 0.95f, 0.38f), "地面") ?? _spore;
			_gold = Fx.Tint(_ruin, new Color(1.35f, 1.12f, 0.55f), 0.7f);
			_stainGold = DarkOf(_top, new Color(1.3f, 1.05f, 0.45f), "地面") ?? _gold;
			_stainWind = DarkOf(_top, new Color(0.8f, 0.92f, 1.15f), "地面") ?? _top;
			MakeKitMaterials();
		}

		public void ChainPad(Vector3 end)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = end - Vector3.up * 0.55f;
			GameObject val2 = NewGO("SKI_ChainPad", _root, val, Quaternion.Euler(0f, (end.x * 53f + end.z * 31f) % 360f, 0f));
			Mesh val3 = MeshGen.Cylinder(1.25f, 1.6f, 1.1f, 9);
			GameObject val4 = NewGO("Pad", val2.transform, val - Vector3.up * 1.1f, val2.transform.rotation);
			AddMesh(val4, val3, _top, _rock);
			if (((Renderer)val4.GetComponent<MeshRenderer>()).sharedMaterials.Length > val3.subMeshCount)
			{
				((Renderer)val4.GetComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[1] { _rock };
			}
			MeshCollider obj = val4.AddComponent<MeshCollider>();
			obj.sharedMesh = val3;
			obj.convex = true;
			Mesh val5 = MeshGen.Blob(1.3f, (int)(end.x * 100f + end.z * 7f), 0.3f, 0.8f);
			GameObject val6 = NewGO("Knob", val2.transform, val - Vector3.up * 1.6f, val2.transform.rotation);
			AddMesh(val6, val5, _rock);
			MeshCollider obj2 = val6.AddComponent<MeshCollider>();
			obj2.sharedMesh = val5;
			obj2.convex = true;
			chainPads++;
		}

		private static Material ShakyMaterial(Material rock)
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00bb: 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_011f: 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)
			Shader val = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Universal Render Pipeline/Simple Lit");
			if ((Object)(object)val == (Object)null)
			{
				Material[] array = Resources.FindObjectsOfTypeAll<Material>();
				foreach (Material val2 in array)
				{
					if ((Object)(object)val2 != (Object)null && (Object)(object)val2.shader != (Object)null && (((Object)val2.shader).name == "Universal Render Pipeline/Lit" || ((Object)val2.shader).name == "Universal Render Pipeline/Simple Lit"))
					{
						val = val2.shader;
						break;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Log.Warn("建造", "会掉落的石头: 没找到通用着色器,改用强染色的岩石");
				return Fx.Tint(rock, new Color(1.9f, 0.6f, 0.15f));
			}
			Material val3 = new Material(val)
			{
				name = "SKI_ShakyOrange"
			};
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(1f, 0.45f, 0.05f);
			if (val3.HasProperty("_BaseColor"))
			{
				val3.SetColor("_BaseColor", val4);
			}
			if (val3.HasProperty("_Color"))
			{
				val3.SetColor("_Color", val4);
			}
			if (val3.HasProperty("_Smoothness"))
			{
				val3.SetFloat("_Smoothness", 0.2f);
			}
			if (val3.HasProperty("_EmissionColor"))
			{
				val3.EnableKeyword("_EMISSION");
				val3.SetColor("_EmissionColor", new Color(0.45f, 0.12f, 0f));
				val3.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
			}
			Log.Info("建造", "会掉落的石头: 纯橙色发光材质(" + ((Object)val).name + ")");
			return val3;
		}

		private static Material DarkOf(Material src, Color mul, string label)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)src == (Object)null)
			{
				return null;
			}
			string text = ((IEnumerable<string>)new string[5] { "_BaseColor", "_Color", "_Tint", "_MainColor", "_TintColor" }).FirstOrDefault((Func<string, bool>)src.HasProperty);
			if (text == null)
			{
				Log.Warn("建造", label + "材质 " + ((Object)src).name + " 没有颜色属性,没法染色");
				return null;
			}
			Material result = Fx.Tint(src, mul);
			Log.Info("建造", $"染色材质: {label} {((Object)src).name} 的 {text} × {mul}");
			return result;
		}

		private GameObject NewGO(string name, Transform parent, Vector3 pos, Quaternion rot, int layer = -1)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0037: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.transform.SetPositionAndRotation(pos, rot);
			val.layer = ((layer >= 0) ? layer : _layer);
			return val;
		}

		private static void AddMesh(GameObject go, Mesh m, params Material[] mats)
		{
			go.AddComponent<MeshFilter>().sharedMesh = m;
			((Renderer)go.AddComponent<MeshRenderer>()).sharedMaterials = mats;
		}

		private void BuildIsland(IslandSpec s)
		{
			//IL_0045: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if (s.kind == IslandKind.Shore && _info.beachH != null)
			{
				BuildBeach(s);
				return;
			}
			GameObject val = NewGO($"SKI_{s.kind}_{s.id}", _root, s.top, Quaternion.Euler(s.tiltX, s.yaw, s.tiltZ));
			KitMats kitMats = KitFor(s);
			kitUse.TryGetValue(kitMats.kit.name, out var value);
			kitUse[kitMats.kit.name] = value + 1;
			Color vtx = kitMats.vtx;
			Mesh val2 = MeshGen.Island(s, vtx, val.transform.rotation);
			if (MeshGen.lastDarkFaces > 0)
			{
				darkFaceTotal += MeshGen.lastDarkFaces;
				darkIslands++;
			}
			bool flag = s.shaky || s.drift;
			Transform transform = val.transform;
			if (flag)
			{
				transform = NewGO("Visual", val.transform, s.top, val.transform.rotation).transform;
			}
			AddMesh(((Component)transform).gameObject, val2, s.shaky ? (kitMats.shakyTop ?? kitMats.top) : kitMats.top, s.slippery ? kitMats.slip : (s.shaky ? kitMats.shaky : kitMats.rock), kitMats.dark);
			MeshCollider val3 = val.AddComponent<MeshCollider>();
			val3.sharedMesh = val2;
			try
			{
				Underside(s, val3, transform, kitMats);
			}
			catch (Exception ex)
			{
				Log.Warn("建造", $"岛 #{s.id} 底部装饰失败: {ex.Message}");
			}
			Rigidbody val4 = null;
			if (flag)
			{
				val4 = val.AddComponent<Rigidbody>();
				val4.isKinematic = true;
				val4.useGravity = false;
				val4.interpolation = (RigidbodyInterpolation)1;
			}
			SkyIsland skyIsland = val.AddComponent<SkyIsland>();
			skyIsland.spec = s;
			skyIsland.col = val3;
			skyIsland.visual = transform;
			Islands[s.id] = skyIsland;
			ClimbModifierSurface val5 = null;
			if (s.slippery || s.shaky)
			{
				val5 = val.AddComponent<ClimbModifierSurface>();
			}
			if (s.slippery)
			{
				val5.staminaUsageMultiplier = 1.5f;
				val5.speedMultiplier = 0.85f;
				val5.onClimbAction = (Action<Character>)Delegate.Combine(val5.onClimbAction, (Action<Character>)delegate(Character c)
				{
					if ((Object)(object)c != (Object)null && c.IsLocal)
					{
						c.data.slippy = Mathf.Max(c.data.slippy, 0.6f);
					}
				});
			}
			if (s.shaky)
			{
				ShakyRock sr = val.AddComponent<ShakyRock>();
				sr.id = s.id;
				sr.visual = transform;
				sr.col = (Collider)(object)val3;
				sr.rb = val4;
				sr.respawn = ((s.respawn > 0f) ? s.respawn : _plan.g.RespawnSeconds);
				sr.radius = s.radius;
				sr.shakeTime = s.shakeTime;
				val5.onClimbAction = (Action<Character>)Delegate.Combine(val5.onClimbAction, new Action<Character>(sr.Touch));
				CollisionModifier obj = val.AddComponent<CollisionModifier>();
				obj.applyEffects = false;
				obj.knockback = 0f;
				obj.damage = 0f;
				obj.onCollide = (Action<Character, CollisionModifier, Collision, Bodypart>)Delegate.Combine(obj.onCollide, (Action<Character, CollisionModifier, Collision, Bodypart>)delegate(Character c, CollisionModifier m, Collision col, Bodypart b)
				{
					sr.Touch(c);
				});
				Shaky[s.id] = sr;
			}
			if (s.drift)
			{
				DriftIsland driftIsland = val.AddComponent<DriftIsland>();
				driftIsland.amp = s.driftAmp;
				driftIsland.period = s.driftPeriod;
				driftIsland.phase = s.driftPhase;
				driftIsland.rb = val4;
				driftIsland.sway = s.driftH;
				driftIsland.heading = s.driftHeading;
				driftIsland.spin = s.spin;
				driftIsland.fig = s.driftFig;
				driftIsland.rockAmp = s.rockAmp;
				driftIsland.rockPeriod = s.rockPeriod;
				driftIsland.rockHeading = s.rockHeading;
				driftIsland.tumble = s.tumble;
			}
		}

		private void BuildBeach(IslandSpec s)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = NewGO($"SKI_{s.kind}_{s.id}", _root, Vector3.zero, Quaternion.identity);
			Color col = (_info.topNeedsColor ? _info.topColor : Color.white);
			float reach = _info.beachR + 10f + 16f;
			List<IslandSpec> list = _plan.islands.Where(delegate(IslandSpec o)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				if (o.kind != IslandKind.Shore)
				{
					Vector2 val4 = new Vector2(o.top.x - _info.spawnCenter.x, o.top.z - _info.spawnCenter.z);
					return ((Vector2)(ref val4)).magnitude < reach + o.Reach;
				}
				return false;
			}).ToList();
			Mesh val2 = MeshGen.Beach(_info, _plan.seaY, col, 0f, list);
			_beachMesh = val2.vertices;
			Mesh m = MeshGen.Beach(_info, _plan.seaY, col, 0.12f, list);
			if (list.Count > 0)
			{
				Log.Info("建造", $"海滩: 有 {list.Count} 个岛伸到复制的海滩上方,岛下面的沙地会压低,不会把岛埋住");
			}
			AddMesh(val, m, _top);
			MeshCollider val3 = val.AddComponent<MeshCollider>();
			val3.sharedMesh = val2;
			SkyIsland skyIsland = val.AddComponent<SkyIsland>();
			skyIsland.spec = s;
			skyIsland.col = val3;
			skyIsland.visual = val.transform;
			Islands[s.id] = skyIsland;
			Log.Info("建造", $"海滩: 按原版地形复制({val2.vertexCount} 个顶点)");
		}

		private void BuildSeabed()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			Bounds region = _plan.region;
			float num = Mathf.Max(((Bounds)(ref region)).size.x, ((Bounds)(ref region)).size.z) + 500f;
			GameObject val = NewGO("SKI_Seabed", _root, new Vector3(((Bounds)(ref region)).center.x, _plan.seaY - 10f, ((Bounds)(ref region)).center.z), Quaternion.identity);
			AddMesh(val, MeshGen.Plane(num, 0.1f), _top);
			BoxCollider obj = val.AddComponent<BoxCollider>();
			obj.size = new Vector3(num, 1f, num);
			obj.center = new Vector3(0f, -0.5f, 0f);
			Log.Info("建造", $"海床: Y={_plan.seaY - 9.5f:F1} 边长 {num:F0}m");
		}

		private bool RayTop(SkyIsland isl, Vector3 xz, out RaycastHit hit)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(new Vector3(xz.x, isl.spec.top.y + 25f, xz.z), Vector3.down);
			if (((Collider)isl.col).Raycast(val, ref hit, 60f))
			{
				return ((RaycastHit)(ref hit)).normal.y > 0.7f;
			}
			return false;
		}

		private Vector3 RandomTopPoint(IslandSpec s, float minFrac, float maxFrac)
		{
			//IL_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			float num = _rng.R(0f, MathF.PI * 2f);
			float num2 = s.radius * Mathf.Sqrt(_rng.R(minFrac * minFrac, maxFrac * maxFrac));
			return s.top + new Vector3(Mathf.Sin(num), 0f, Mathf.Cos(num)) * num2;
		}

		private void Dress(IslandSpec s, SkyIsland isl)
		{
			//IL_00b7: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: 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_03af: 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_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_068f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			Transform visual = isl.visual;
			if (s.theme == Theme.Wind)
			{
				BuildShelters(s, isl);
			}
			for (int i = 0; i < s.bigRuins; i++)
			{
				BuildBigRuin(s, isl);
			}
			bool flag = s.kind == IslandKind.Main || s.kind == IslandKind.Apex || s.kind == IslandKind.Throne;
			List<Vector3> list = new List<Vector3>();
			if (flag && s.decor >= 8)
			{
				int num = Mathf.Clamp(s.decor / 7, 2, 5);
				for (int j = 0; j < num; j++)
				{
					list.Add(RandomTopPoint(s, (s.kind == IslandKind.Throne) ? Mathf.Min(0.9f, (s.flat + 6f) / s.radius) : 0.2f, 0.72f));
				}
			}
			BiomeKit kit = KitFor(s).kit;
			List<GameObject> list2 = ((kit.trees.Count > 0) ? kit.trees : _info.protoTrees);
			List<GameObject> list3 = ((kit.rocks.Count > 0) ? kit.rocks : _info.protoRocks);
			List<GameObject> list4 = ((kit.bushes.Count > 0) ? kit.bushes : _info.protoBushes);
			if (s.mushroom)
			{
				Vector3 val = ((((Vector3)(ref s.mushroomDir)).sqrMagnitude > 0.1f) ? ((Vector3)(ref s.mushroomDir)).normalized : Vector3.forward);
				Keep(s.id, s.top + val * s.radius * 0.55f, 4f);
				Keep(s.id, s.top + val * s.radius * 0.3f, 4f);
			}
			if (s.kind == IslandKind.Main)
			{
				try
				{
					Landmark(s, isl, list2, list3);
				}
				catch (Exception ex)
				{
					Log.Warn("建造", $"岛 #{s.id} 地标失败: {ex.Message}");
				}
			}
			try
			{
				ZoneFeatures(s, isl);
			}
			catch (Exception ex2)
			{
				Log.Warn("建造", $"岛 #{s.id} 区域景观失败: {ex2.Message}");
			}
			int num2 = 0;
			for (int k = 0; k < s.decor * 3 && num2 < s.decor; k++)
			{
				float num3 = _rng.F();
				bool num4 = flag || s.radius >= 7f;
				bool flag2 = list.Count > 0 && _rng.P(0.7f);
				List<GameObject> list5;
				if (num4 && num3 < (flag2 ? 0.6f : 0.4f) && list2.Count > 0)
				{
					list5 = list2;
				}
				else if (num3 < 0.8f && list3.Count > 0)
				{
					list5 = list3;
				}
				else if (list4.Count > 0)
				{
					list5 = list4;
				}
				else
				{
					if (list3.Count <= 0)
					{
						break;
					}
					list5 = list3;
				}
				GameObject val2 = list5[_rng.I(0, list5.Count)];
				float num5 = ((s.kind == IslandKind.Throne) ? ((s.flat + 3f) / s.radius) : 0.1f);
				Vector3 val4;
				if (flag2)
				{
					Vector3 val3 = list[_rng.I(0, list.Count)];
					float num6 = _rng.R(0f, MathF.PI * 2f);
					val4 = val3 + new Vector3(Mathf.Sin(num6), 0f, Mathf.Cos(num6)) * _rng.R(1.5f, 8f);
					Vector3 val5 = val4 - s.top;
					if (((Vector3)(ref val5)).magnitude > s.radius * 0.85f)
					{
						Rej("出界");
						continue;
					}
				}
				else
				{
					val4 = RandomTopPoint(s, Mathf.Min(num5, 0.9f), 0.85f);
				}
				if (!FreeSpot(s.id, val4, (list5 == list2) ? 2f : 1.2f))
				{
					Rej("太挤");
					continue;
				}
				if (!RayTop(isl, val4, out var hit))
				{
					Rej("不是平地");
					continue;
				}
				if (list5 != list4 && Overhead(((RaycastHit)(ref hit)).point, 2f, (list5 == list2) ? 14f : 6f, s))
				{
					if (list5 != list2 || list3.Count <= 0 || Overhead(((RaycastHit)(ref hit)).point, 2f, 6f, s))
					{
						Rej("头顶有岛");
						continue;
					}
					list5 = list3;
					val2 = list3[_rng.I(0, list3.Count)];
				}
				GameObject val6 = Object.Instantiate<GameObject>(val2, visual, false);
				val6.SetActive(true);
				Rigidbody[] componentsInChildren = val6.GetComponentsInChildren<Rigidbody>(true);
				for (int l = 0; l < componentsInChildren.Length; l++)
				{
					componentsInChildren[l].isKinematic = true;
				}
				val6.transform.position = ((RaycastHit)(ref hit)).point - Vector3.up * 0.15f;
				val6.transform.rotation = Quaternion.Euler(0f, _rng.R(0f, 360f), 0f);
				val6.transform.localScale = val2.transform.localScale * _rng.R(0.8f, 1.25f) * ((flag2 && list5 == list2) ? _rng.R(1f, 1.35f) : 1f);
				((Object)val6).name = ((list5 == list4) ? "SKI_Bush_" : ((list5 == list2) ? "SKI_Tree_" : "SKI_Rock_")) + ((Object)val2).name;
				SitOnGround(val6, ((RaycastHit)(ref hit)).point.y);
				if (PropHits(val6, s))
				{
					Object.DestroyImmediate((Object)(object)val6);
					propsDropped++;
					Rej("戳到别的岛");
					continue;
				}
				bool flag3 = ((Object)val2).name.ToLowerInvariant().Contains("cactus") || (Object)(object)val2.GetComponentInChildren<StickyCactus>(true) != (Object)null;
				if (list5 != list4)
				{
					EnsureColliders(val6, list5 == list2 && !flag3);
				}
				if (flag3)
				{
					MakePrickly(val6);
				}
				Bounds val7 = SceneScan.MeshBounds(val6);
				Keep(s.id, ((RaycastHit)(ref hit)).point, Mathf.Clamp(Mathf.Max(((Bounds)(ref val7)).extents.x, ((Bounds)(ref val7)).extents.z) * ((list5 == list2) ? 0.35f : 0.75f), 0.4f, 4f));
				decorCount++;
				num2++;
			}
			decorWanted += s.decor;
			if (s.ruins)
			{
				BuildRuins(s, isl);
			}
			if (s.mushroom)
			{
				BuildMushroom(s, isl);
			}
			if (s.spike)
			{
				BuildSpike(s, isl);
			}
			if (s.thorns)
			{
				BuildThorns(s, isl);
			}
			if (s.spores)
			{
				BuildSpores(s, isl);
			}
			for (int m = 0; m < s.waterfalls; m++)
			{
				BuildWaterfall(s, isl, m);
			}
			if (s.kind == IslandKind.Main || s.kind == IslandKind.Throne || s.kind == IslandKind.Apex)
			{
				try
				{
					BuildAmbient(s, KitFor(s).kit.name);
				}
				catch (Exception ex3)
				{
					Log.Warn("建造", $"岛 #{s.id} 氛围特效失败: {ex3.Message}");
				}
			}
		}

		private void Feat(string k)
		{
			featureCount.TryGetValue(k, out var value);
			featureCount[k] = value + 1;
		}

		private static int ZoneKind(string biome)
		{
			string text = (biome ?? "").ToLowerInvariant();
			if (text.Contains("alpine") || text.Contains("snow") || text.Contains("tundra"))
			{
				return 1;
			}
			if (text.Contains("volcan") || text.Contains("caldera") || text.Contains("kiln"))
			{
				return 2;
			}
			if (text.Contains("tropic") || text.Contains("jungle") || text.Contains("roots") || text.Contains("swamp"))
			{
				return 3;
			}
			if (text.Contains("mesa") || text.Contains("desert"))
			{
				return 4;
			}
			return 0;
		}

		private void ZoneFeatures(IslandSpec s, SkyIsland isl)
		{
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			bool flag = s.kind == IslandKind.Main || s.kind == IslandKind.Throne || s.kind == IslandKind.Apex;
			int num;
			if (flag)
			{
				num = Mathf.Clamp(Mathf.RoundToInt(s.radius / 9f), 2, 6);
			}
			else if ((s.kind == IslandKind.Satellite || s.kind == IslandKind.Hub) && s.radius >= 6f)
			{
				num = (_rng.P(0.6f) ? 1 : 0);
			}
			else
			{
				if (s.kind != IslandKind.Step || !(s.radius >= 5f) || s.drift || s.shaky)
				{
					return;
				}
				num = (_rng.P(0.25f) ? 1 : 0);
			}
			if (s.kind == IslandKind.Throne)
			{
				num = Mathf.Min(num, 2);
			}
			KitMats kitMats = KitFor(s);
			int num2 = ZoneKind(kitMats.kit.name);
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < 6; j++)
				{
					float minFrac = ((s.kind == IslandKind.Throne) ? Mathf.Min(0.9f, (s.flat + 4f) / s.radius) : (flag ? 0.25f : 0.1f));
					Vector3 val = RandomTopPoint(s, minFrac, flag ? 0.78f : 0.55f);
					float r = (flag ? 4.5f : 2.5f);
					if (FreeSpot(s.id, val, r) && RayTop(isl, val, out var hit) && !Overhead(((RaycastHit)(ref hit)).point, r, num2 switch
					{
						3 => 4f, 
						2 => 8f, 
						1 => 14f, 
						_ => 9f, 
					} + 2f, s))
					{
						GameObject val2 = NewGO("SKI_Zone_" + kitMats.kit.name, isl.visual, ((RaycastHit)(ref hit)).point, Quaternion.Euler(0f, _rng.R(0f, 360f), 0f));
						float num3 = (flag ? 1f : 0.65f);
						switch (num2)
						{
						case 1:
							IceSpires(val2.transform, kitMats, num3);
							Feat("冰柱群");
							break;
						case 2:
							BasaltCluster(val2.transform, kitMats, num3);
							Feat("玄武岩柱群");
							break;
						case 3:
							FallenLog(val2.transform, kitMats, num3);
							Feat("倒下的巨木");
							break;
						case 4:
							BasaltCluster(val2.transform, kitMats, num3 * 1.2f);
							Feat("岩柱");
							break;
						default:
							SeaStack(val2.transform, kitMats, num3);
							Feat("海蚀石柱");
							break;
						}
						Keep(s.id, ((RaycastHit)(ref hit)).point, r);
						break;
					}
				}
			}
			if (!flag || (num2 != 1 && num2 != 2))
			{
				return;
			}
			for (int k = 0; k < num + 1; k++)
			{
				Vector3 val3 = RandomTopPoint(s, 0.15f, 0.8f);
				if (FreeSpot(s.id, val3, 2.5f) && RayTop(isl, val3, out var hit2))
				{
					GameObject val4 = NewGO("SKI_ZoneAccent", isl.visual, ((RaycastHit)(ref hit2)).point, Quaternion.Euler(0f, _rng.R(0f, 360f), 0f));
					if (num2 == 1)
					{
						SnowDrift(val4.transform, kitMats);
						Feat("雪堆");
					}
					else
					{
						Vent(val4.transform, kitMats);
						Feat("冒烟的地缝");
					}
					Keep(s.id, ((RaycastHit)(ref hit2)).point, 2.5f);
				}
			}
		}

		private GameObject SolidPiece(Transform parent, string name, Mesh mesh, Material mat, Vector3 localPos, Quaternion localRot)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = NewGO(name, parent, parent.TransformPoint(localPos), parent.rotation * localRot);
			AddMesh(val, mesh, mat);
			MeshCollider obj = val.AddComponent<MeshCollider>();
			obj.sharedMesh = mesh;
			obj.convex = true;
			return val;
		}

		private void BasaltCluster(Transform root, KitMats km, float sc)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			int num = _rng.I(6, 11);
			float num2 = _rng.R(0.75f, 1.05f) * sc;
			float num3 = _rng.R(5f, 8f) * sc;
			Vector3 localPos = default(Vector3);
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i * 2.39996f;
				float num5 = num2 * 1.75f * Mathf.Sqrt((float)i);
				((Vector3)(ref localPos))..ctor(Mathf.Sin(num4) * num5, -0.6f, Mathf.Cos(num4) * num5);
				float num6 = Mathf.Max(1.2f * sc, num3 * (1f - num5 / (num2 * 1.75f * Mathf.Sqrt((float)num) + 0.5f)) * _rng.R(0.7f, 1.1f));
				Mesh mesh = MeshGen.Cylinder(num2, num2 * 0.97f, num6 + 0.6f, 6);
				SolidPiece(root, "Basalt", mesh, km.rock, localPos, Quaternion.Euler(_rng.R(-3f, 3f), 30f + _rng.R(-4f, 4f), _rng.R(-3f, 3f)));
			}
		}

		private void IceSpires(Transform root, KitMats km, float sc)
		{
			//IL_00e7: 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)
			int num = _rng.I(2, 5);
			Vector3 localPos = default(Vector3);
			for (int i = 0; i < num; i++)
			{
				float num2 = ((i == 0) ? 1f : _rng.R(0.4f, 0.7f));
				float height = _rng.R(8f, 13f) * sc * num2;
				float num3 = _rng.R(1.1f, 1.6f) * sc * Mathf.Sqrt(num2);
				float num4 = _rng.R(0f, MathF.PI * 2f);
				float num5 = ((i == 0) ? 0f : (_rng.R(1.8f, 3.4f) * sc));
				((Vector3)(ref localPos))..ctor(Mathf.Sin(num4) * num5, -0.5f, Mathf.Cos(num4) * num5);
				Mesh mesh = MeshGen.Cylinder(num3, num3 * 0.12f, height, 5);
				ClimbModifierSurface obj = SolidPiece(root, "IceSpire", mesh, km.slip, localPos, Quaternion.Euler(_rng.R(-9f, 9f), _rng.R(0f, 360f), _rng.R(-9f, 9f))).AddComponent<ClimbModifierSurface>();
				obj.staminaUsageMultiplier = 1.4f;
				obj.speedMultiplier = 0.85f;
			}
		}

		private void SnowDrift(Transform root, KitMats km)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			float num = _rng.R(1.6f, 3f);
			Mesh mesh = MeshGen.Blob(num, _rng.Int(), 0.18f, 0.35f);
			SolidPiece(root, "SnowDrift", mesh, km.top, new Vector3(0f, (0f - num) * 0.15f, 0f), Quaternion.identity);
		}

		private SteamVent Vent(Transform root, KitMats km, bool steam = false)
		{
			//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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_017f: 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_0184: 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_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_01bb: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: 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_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			float num = (steam ? 1.2f : _rng.R(1f, 1.7f));
			Mesh mesh = MeshGen.Blob(num, _rng.Int(), 0.35f, 0.45f);
			SolidPiece(root, "VentRock", mesh, km.dark ?? km.rock, new Vector3(0f, (0f - num) * 0.1f, 0f), Quaternion.identity);
			string from;
			Material val = Fx.ParticleMaterial(out from);
			if ((Object)(object)val == (Object)null)
			{
				SteamVent steamVent = ((Component)root).gameObject.AddComponent<SteamVent>();
				steamVent.radius = num + 0.6f;
				return steamVent;
			}
			GameObject val2 = NewGO("Smoke", root, root.position + Vector3.up * (num * 0.5f), Quaternion.identity, 0);
			ParticleSystem val3 = val2.AddComponent<ParticleSystem>();
			val3.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val3.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).prewarm = true;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(3f, 5f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.8f, 1.6f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.8f, 1.6f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(steam ? new Color(0.95f, 0.95f, 0.95f, 0.55f) : new Color(0.25f, 0.23f, 0.22f, 0.45f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.03f);
			((MainModule)(ref main)).maxParticles = 160;
			EmissionModule emission = val3.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(9f);
			ShapeModule shape = val3.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = 12f;
			((ShapeModule)(ref shape)).radius = 0.3f;
			((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f);
			SizeOverLifetimeModule sizeOverLifetime = val3.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.6f, 1f, 2.8f));
			ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val4 = new Gradient();
			val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.15f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4);
			ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = val;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			val3.Play();
			SteamVent steamVent2 = ((Component)root).gameObject.AddComponent<SteamVent>();
			steamVent2.smoke = val3;
			steamVent2.radius = num + 0.6f;
			steamVent2.period = _rng.R(4f, 6.5f);
			steamVent2.phase = _rng.R(0f, 4f);
			return steamVent2;
		}

		private void BuildVent(VentSpec v)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			if (Islands.TryGetValue(v.island, out var value))
			{
				Vector3 val = v.pos;
				if (RayTop(value, val, out var hit))
				{
					val = ((RaycastHit)(ref hit)).point;
				}
				else if (RayTop(value, Vector3.Lerp(val, value.spec.top, 0.5f), out hit))
				{
					val = ((RaycastHit)(ref hit)).point;
				}
				GameObject val2 = NewGO("SKI_Vent_" + v.id, value.visual, val, Quaternion.identity);
				bool flag = ((Vector3)(ref v.target)).sqrMagnitude > 0.01f;
				SteamVent steamVent = Vent(val2.transform, KitFor(value.spec), flag);
				steamVent.id = v.id;
				steamVent.launcher = flag;
				steamVent.target = v.target;
				if (flag)
				{
					steamVent.period = 3.2f;
					steamVent.phase = (float)v.id * 0.37f % 3.2f;
				}
				Stain(value, val, Vector3.up, 1.9f, _stainWind, "喷气口");
				Vents.Add(steamVent);
			}
		}

		private void BuildFire(FireSpec f)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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)
			if (Islands.TryGetValue(f.island, out var value))
			{
				Vector3 val = f.pos;
				if (RayTop(value, val, out var hit))
				{
					val = ((RaycastHit)(ref hit)).point;
				}
				else if (RayTop(value, value.spec.top, out hit))
				{
					val = ((RaycastHit)(ref hit)).point;
				}
				KitMats kitMats = KitFor(value.spec);
				GameObject val2 = NewGO("SKI_FireJet_" + f.id, value.visual, val, Quaternion.identity);
				SolidPiece(val2.transform, "FireRing", MeshGen.Cylinder(0.75f, 0.6f, 0.35f, 8), kitMats.dark ?? _spike, new Vector3(0f, -0.15f, 0f), Quaternion.identity);
				Stain(value, val, Vector3.up, 1.5f, _stainPoison, "喷火柱");
				FireJet fireJet = val2.AddComponent<FireJet>();
				fireJet.id = f.id;
				fireJet.period = f.period;
				fireJet.phase = f.phase;
				string from;
				Material val3 = Fx.ParticleMaterial(out from);
				if ((Object)(object)val3 != (Object)null)
				{
					fireJet.flame = Flame(val2.transform, val3, sparks: false);
					fireJet.sparks = Flame(val2.transform, val3, sparks: true);
				}
				Fires.Add(fireJet);
			}
		}

		private ParticleSystem Flame(Transform parent, Material mat, bool sparks)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_028f: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = NewGO(sparks ? "Sparks" : "Flame", parent, parent.position + Vector3.up * 0.2f, Quaternion.identity, 0);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).startLifetime = (sparks ? new MinMaxCurve(0.5f, 0.9f) : new MinMaxCurve(0.35f, 0.6f));
			((MainModule)(ref main)).startSpeed = (sparks ? new MinMaxCurve(1.5f, 3f) : new MinMaxCurve(6f, 9f));
			((MainModule)(ref main)).startSize = (sparks ? new MinMaxCurve(0.05f, 0.1f) : new MinMaxCurve(0.6f, 1.1f));
			((MainModule)(ref main)).startColor = (sparks ? new MinMaxGradient(new Color(1f, 0.85f, 0.3f, 1f), new Color(1f, 0.5f, 0.1f, 1f)) : new MinMaxGradient(new Color(1f, 0.6f, 0.15f, 0.9f), new Color(1f, 0.3f, 0.05f, 0.9f)));
			((MainModule)(ref main)).maxParticles = (sparks ? 60 : 260);
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = (sparks ? 25f : 7f);
			((ShapeModule)(ref shape)).radius = 0.35f;
			((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(new Color(1f, 0.95f, 0.6f), 0f),
				new GradientColorKey(new Color(0.9f, 0.2f, 0.05f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.8f, 0.6f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			if (!sparks)
			{
				SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0.3f));
			}
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = mat;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			val2.Play();
			return val2;
		}

		private void FallenLog(Transform root, KitMats km, float sc)
		{
			//IL_0070: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			float num = _rng.R(0.9f, 1.4f) * sc;
			float num2 = _rng.R(9f, 15f) * sc;
			Material mat = km.root ?? _wood;
			Mesh mesh = MeshGen.Cylinder(num, num * 0.8f, num2, 10);
			SolidPiece(root, "Log", mesh, mat, new Vector3((0f - num2) * 0.5f, num * 0.75f, 0f), Quaternion.Euler(_rng.R(-3f, 3f), 0f, -90f + _rng.R(-4f, 4f)));
			if (_rng.P(0.6f))
			{
				float num3 = num * 1.25f;
				float height = _rng.R(1.4f, 2.6f) * sc;
				SolidPiece(root, "Stump", MeshGen.Cylinder(num3, num3 * 0.9f, height, 10), mat, new Vector3((0f - num2) * 0.5f - num3 * 1.2f, -0.4f, 0f), Quaternion.identity);
			}
		}

		private void SeaStack(Transform root, KitMats km, float sc)
		{
			//IL_0096: 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)
			int num = _rng.I(3, 5);
			float num2 = -0.4f;
			float num3 = _rng.R(1.8f, 2.4f) * sc;
			for (int i = 0; i < num; i++)
			{
				Mesh mesh = MeshGen.Blob(num3, _rng.Int(), 0.22f, 0.7f);
				SolidPiece(root, "StackRock", mesh, km.rock, new Vector3(_rng.R(-0.4f, 0.4f) * num3, num2 + num3 * 0.6f, _rng.R(-0.4f, 0.4f) * num3), Quaternion.Euler(_rng.R(-15f, 15f), _rng.R(0f, 360f), _rng.R(-15f, 15f)));
				num2 += num3 * 1.05f;
				num3 *= _rng.R(0.65f, 0.8f);
			}
		}

		private void Rej(string why)
		{
			decorRejected.TryGetValue(why, out var value);
			decorRejected[why] = value + 1;
		}

		private void BuildAmbient(IslandSpec s, string biome)
		{
			//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_0113: 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_013e: 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_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_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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: 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_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: 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_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: 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_0481: 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_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: 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_0654: 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_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: 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_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: 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_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			string text = (biome ?? "").ToLowerInvariant();
			int num = ((text.Contains("alpine") || text.Contains("snow") || text.Contains("tundra")) ? 1 : ((text.Contains("volcan") || text.Contains("caldera") || text.Contains("kiln")) ? 2 : ((text.Contains("tropic") || text.Contains("jungle") || text.Contains("roots") || text.Contains("swamp")) ? 3 : ((text.Contains("mesa") || text.Contains("desert")) ? 4 : 0))));
			if (num == 0)
			{
				return;
			}
			string from;
			Material val = Fx.ParticleMaterial(out from);
			if (!((Object)(object)val == (Object)null))
			{
				float num2 = s.radius * 2.6f;
				GameObject val2 = NewGO("SKI_Ambient_" + biome, _root, s.top + Vector3.up * ((num == 2) ? 2f : 16f), Quaternion.identity, 0);
				ParticleSystem val3 = val2.AddComponent<ParticleSystem>();
				val3.Stop(true, (ParticleSystemStopBehavior)0);
				MainModule main = val3.main;
				((MainModule)(ref main)).loop = true;
				((MainModule)(ref main)).playOnAwake = true;
				((MainModule)(ref main)).prewarm = true;
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
				ShapeModule shape = val3.shape;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
				NoiseModule noise = val3.noise;
				((NoiseModule)(ref noise)).enabled = true;
				EmissionModule emission = val3.emission;
				ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
				Gradient val4 = new Gradient();
				Color val5 = default(Color);
				Color val6 = default(Color);
				switch (num)
				{
				case 1:
					((MainModule)(ref main)).startLifetime = new MinMaxCurve(7f, 10f);
					((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.2f, 0.6f);
					((MainModule)(ref main)).startSize = new MinMaxCurve(0.06f, 0.16f);
					((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.03f);
					((MainModule)(ref main)).maxParticles = 900;
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num2 * num2 * 0.035f, 40f, 110f));
					((ShapeModule)(ref shape)).scale = new Vector3(num2, 3f, num2);
					((ShapeModule)(ref shape)).rotation = new Vector3(0f, 0f, 0f);
					((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.8f);
					((NoiseModule)(ref noise)).frequency = 0.3f;
					((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.2f);
					((Color)(ref val5))..ctor(1f, 1f, 1f, 0.95f);
					((Color)(ref val6))..ctor(0.9f, 0.95f, 1f, 0.8f);
					break;
				case 2:
					((MainModule)(ref main)).startLifetime = new MinMaxCurve(3f, 6f);
					((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.5f, 1.6f);
					((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.13f);
					((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.06f);
					((MainModule)(ref main)).maxParticles = 500;
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num2 * num2 * 0.018f, 25f, 70f));
					((ShapeModule)(ref shape)).scale = new Vector3(num2, 1f, num2);
					((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f);
					((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(1.2f);
					((NoiseModule)(ref noise)).frequency = 0.6f;
					((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.5f);
					((Color)(ref val5))..ctor(1f, 0.55f, 0.15f, 1f);
					((Color)(ref val6))..ctor(1f, 0.25f, 0.05f, 1f);
					break;
				case 3:
					((MainModule)(ref main)).startLifetime = new MinMaxCurve(6f, 9f);
					((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.1f, 0.4f);
					((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.11f);
					((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.003f);
					((MainModule)(ref main)).maxParticles = 400;
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num2 * num2 * 0.012f, 18f, 50f));
					((ShapeModule)(ref shape)).scale = new Vector3(num2, 12f, num2);
					((ShapeModule)(ref shape)).position = new Vector3(0f, -9f, 0f);
					((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.6f);
					((NoiseModule)(ref noise)).frequency = 0.25f;
					((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.15f);
					((Color)(ref val5))..ctor(1f, 0.97f, 0.7f, 0.9f);
					((Color)(ref val6))..ctor(0.8f, 1f, 0.55f, 0.8f);
					break;
				default:
					((MainModule)(ref main)).startLifetime = new MinMaxCurve(3f, 5f);
					((MainModule)(ref main)).startSpeed = new MinMaxCurve(1.5f, 3f);
					((MainModule)(ref main)).startSize = new MinMaxCurve(0.08f, 0.2f);
					((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.01f);
					((MainModule)(ref main)).maxParticles = 400;
					((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num2 * num2 * 0.012f, 18f, 50f));
					((ShapeModule)(ref shape)).scale = new Vector3(num2, 4f, num2);
					((ShapeModule)(ref shape)).position = new Vector3(0f, -13f, 0f);
					((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(1.5f);
					((NoiseModule)(ref noise)).frequency = 0.4f;
					((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.4f);
					((Color)(ref val5))..ctor(0.95f, 0.82f, 0.6f, 0.6f);
					((Color)(ref val6))..ctor(0.9f, 0.75f, 0.5f, 0.4f);
					break;
				}
				((MainModule)(ref main)).startColor = new MinMaxGradient(val5, val6);
				val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.white, 0f),
					new GradientColorKey(Color.white, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
				{
					new GradientAlphaKey(0f, 0f),
					new GradientAlphaKey(1f, 0.15f),
					new GradientAlphaKey(1f, 0.75f),
					new GradientAlphaKey(0f, 1f)
				});
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4);
				ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
				((Renderer)component).sharedMaterial = val;
				((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)component).receiveShadows = false;
				component.renderMode = (ParticleSystemRenderMode)0;
				val3.Play();
				ambientCount++;
			}
		}

		private void BuildShelters(IslandSpec s, SkyIsland isl)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((((Vector3)(ref s.windDir)).sqrMagnitude > 0.1f) ? ((Vector3)(ref s.windDir)).normalized : Vector3.forward);
			int num = Mathf.Clamp(Mathf.RoundToInt(s.radius / 4f), 6, 11);
			int num2 = 0;
			int num3 = 0;
			while (num2 < num && num3 < num * 6)
			{
				Vector3 val2 = RandomTopPoint(s, 0.12f, 0.8f);
				if (FreeSpot(s.id, val2, 3f) && RayTop(isl, val2, out var hit))
				{
					float num4 = _rng.R(3.8f, 6f);
					float num5 = _rng.R(2.6f, 4f);
					float num6 = _rng.R(1.3f, 1.9f);
					Quaternion rot = Quaternion.LookRotation(val) * Quaternion.Euler(_rng.R(-4f, 4f), _rng.R(-15f, 15f), _rng.R(-5f, 5f));
					GameObject val3 = NewGO("SKI_WindBreak", isl.visual, ((RaycastHit)(ref hit)).point + Vector3.up * (num5 * 0.5f - 0.5f), rot);
					val3.transform.localScale = new Vector3(num4 * 0.5f, num5 * 0.5f, num6 * 0.5f);
					Mesh val4 = MeshGen.Blob(1f, _rng.Int(), 0.22f);
					AddMesh(val3, val4, _rock);
					MeshCollider obj = val3.AddComponent<MeshCollider>();
					obj.sharedMesh = val4;
					obj.convex = true;
					Keep(s.id, ((RaycastHit)(ref hit)).point, Mathf.Max(num4, num6) * 0.5f + 1f);
					shelterCount++;
					num2++;
				}
				num3++;
			}
			Stain(isl, s.top + val * s.radius * 0f, Vector3.up, Mathf.Min(4.5f, s.radius * 0.2f), _stainWind, "风口标记");
		}

		private void BuildTemple(TempleSpec t)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_0244: 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_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			if (!Islands.TryGetValue(t.island, out var value))
			{
				return;
			}
			GameObject val = NewGO("SKI_Temple_" + t.id, value.visual, t.plate, Quaternion.identity);
			TempleMachine templeMachine = val.AddComponent<TempleMachine>();
			templeMachine.id = t.id;
			Vector3 val2 = t.plate;
			if (RayTop(value, t.plate, out var hit))
			{
				val2 = ((RaycastHit)(ref hit)).point;
			}
			GameObject val3 = NewGO("Plate", val.transform, val2 + Vector3.up * 0.02f, Quaternion.identity);
			AddMesh(val3, MeshGen.Cylinder(1.5f, 1.38f, 0.22f, 20), _gold);
			val3.AddComponent<MeshCollider>().sharedMesh = MeshGen.Cylinder(1.5f, 1.38f, 0.22f, 20);
			Stain(value, val2, Vector3.up, 2.4f, _stainGold, "神殿压力板");
			templeMachine.plate = val3.transform;
			templeMachine.plateCenter = val2;
			Vector3 point = default(Vector3);
			foreach (Vector4 pillar in t.pillars)
			{
				((Vector3)(ref point))..ctor(pillar.x, pillar.y, pillar.z);
				if (RayTop(value, point, out var hit2))
				{
					point = ((RaycastHit)(ref hit2)).point;
				}
				float w = pillar.w;
				GameObject val4 = NewGO("TempleColumn", val.transform, point + Vector3.up * (-0.4f - w), Quaternion.Euler(0f, _rng.R(0f, 360f), 0f));
				Mesh val5 = MeshGen.Cylinder(1.3f, 1.2f, w, 12);
				AddMesh(val4, val5, _ruin);
				MeshCollider obj