Decompiled source of PeakProceduralParkour v1.1.3
PeakProceduralParkour.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("1.1.3.0")] [module: RefSafetyRules(11)] namespace PeakProceduralParkour { internal sealed class HazardNetworkCoordinator : MonoBehaviour { private const string PlayerInstalledKey = "PeakProceduralParkourInstalled"; private const string PlayerProtocolKey = "PeakProceduralParkourProtocol"; private const string PlayerEnabledKey = "PeakProceduralParkourEnabled"; private const string RoomSeedKey = "PeakProceduralParkourSeed"; private const string RoomOwnerActorKey = "PeakProceduralParkourOwnerActor"; private const string RoomProtocolKey = "PeakProceduralParkourRoomProtocol"; private const string RoomEnabledKey = "PeakProceduralParkourRoomEnabled"; private const int SyncProtocolVersion = 1; private int _localSessionSeed; private string _lastLoggedSnapshot; internal bool IsReadyForGeneration { get; private set; } internal bool UseSharedSeed { get; private set; } internal int ActiveSeed { get; private set; } private void Awake() { _localSessionSeed = BuildLocalSeed(); RefreshState(); } private void Update() { if (!IsReadyForGeneration || PhotonNetwork.InRoom) { RefreshState(); } } private void RefreshState() { PublishPlayerMarker(); if (!PeakProceduralParkourPlugin.Instance.ModEnabled.Value) { TryClearOwnedRoomSeed(); IsReadyForGeneration = true; UseSharedSeed = false; ActiveSeed = _localSessionSeed; LogStateIfChanged("本地禁用", masterInstalled: false, null, null); return; } if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || PhotonNetwork.LocalPlayer == null) { IsReadyForGeneration = true; UseSharedSeed = false; ActiveSeed = _localSessionSeed; LogStateIfChanged("本地模式", masterInstalled: false, null, null); return; } TryPublishRoomSeed(); Player masterClient = PhotonNetwork.MasterClient; bool flag = masterClient != null && PlayerHasInstalledMod(masterClient); bool flag2 = masterClient != null && PlayerHasActiveMod(masterClient); if (flag2 && masterClient != null && TryGetSharedRoomSeed(masterClient, out var sharedSeed)) { IsReadyForGeneration = true; UseSharedSeed = true; ActiveSeed = sharedSeed; LogStateIfChanged("共享模式", masterInstalled: true, masterClient.ActorNumber, sharedSeed); } else if (flag2 && masterClient != null) { IsReadyForGeneration = false; UseSharedSeed = true; ActiveSeed = 0; LogStateIfChanged("共享等待", masterInstalled: true, masterClient.ActorNumber, null); } else { IsReadyForGeneration = true; UseSharedSeed = false; ActiveSeed = _localSessionSeed; LogStateIfChanged(flag ? "房主未启用-本地模式" : "房主未安装-本地模式", masterInstalled: false, (masterClient != null) ? new int?(masterClient.ActorNumber) : null, null); } } private void PublishPlayerMarker() { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return; } Hashtable customProperties = PhotonNetwork.LocalPlayer.CustomProperties; bool flag = false; int num; if (customProperties != null && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourInstalled")) { object obj = customProperties[(object)"PeakProceduralParkourInstalled"]; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } int num2 = num & (flag ? 1 : 0); bool flag2 = customProperties != null && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourProtocol") && customProperties[(object)"PeakProceduralParkourProtocol"] is int num3 && num3 == 1; bool flag4 = customProperties != null && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourEnabled") && customProperties[(object)"PeakProceduralParkourEnabled"] is bool flag3 && flag3 == PeakProceduralParkourPlugin.Instance.ModEnabled.Value; if (((uint)num2 & (flag2 ? 1u : 0u) & (flag4 ? 1u : 0u)) == 0) { Hashtable val = new Hashtable { [(object)"PeakProceduralParkourInstalled"] = true, [(object)"PeakProceduralParkourProtocol"] = 1, [(object)"PeakProceduralParkourEnabled"] = PeakProceduralParkourPlugin.Instance.ModEnabled.Value }; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } private void TryPublishRoomSeed() { //IL_0101: 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_0123: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || !PhotonNetwork.IsMasterClient) { return; } if (!PlayerHasActiveMod(PhotonNetwork.LocalPlayer)) { TryClearOwnedRoomSeed(); return; } Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; bool flag = false; int num3; if (customProperties != null && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourSeed") && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourOwnerActor") && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourRoomProtocol") && ((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourRoomEnabled") && customProperties[(object)"PeakProceduralParkourOwnerActor"] is int num && num == PhotonNetwork.LocalPlayer.ActorNumber && customProperties[(object)"PeakProceduralParkourRoomProtocol"] is int num2 && num2 == 1) { object obj = customProperties[(object)"PeakProceduralParkourRoomEnabled"]; if (obj is bool) { flag = (bool)obj; num3 = 1; } else { num3 = 0; } } else { num3 = 0; } if (((uint)num3 & (flag ? 1u : 0u)) == 0) { int num4 = BuildSharedRoomSeed(); Hashtable val = new Hashtable { [(object)"PeakProceduralParkourSeed"] = num4, [(object)"PeakProceduralParkourOwnerActor"] = PhotonNetwork.LocalPlayer.ActorNumber, [(object)"PeakProceduralParkourRoomProtocol"] = 1, [(object)"PeakProceduralParkourRoomEnabled"] = true }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } private void TryClearOwnedRoomSeed() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || !PhotonNetwork.IsMasterClient || PhotonNetwork.LocalPlayer == null) { return; } Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; if (customProperties == null || !((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourOwnerActor")) { return; } object obj = customProperties[(object)"PeakProceduralParkourOwnerActor"]; if (!(obj is int)) { return; } int num = (int)obj; if (num != PhotonNetwork.LocalPlayer.ActorNumber) { return; } if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PeakProceduralParkourRoomEnabled")) { object obj2 = customProperties[(object)"PeakProceduralParkourRoomEnabled"]; if (obj2 is bool && !(bool)obj2) { return; } } Hashtable val = new Hashtable { [(object)"PeakProceduralParkourRoomEnabled"] = false }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } private bool PlayerHasInstalledMod(Player player) { if (player == null || player.CustomProperties == null) { return false; } bool flag = false; int num; if (((Dictionary<object, object>)(object)player.CustomProperties).ContainsKey((object)"PeakProceduralParkourInstalled")) { object obj = player.CustomProperties[(object)"PeakProceduralParkourInstalled"]; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0 && ((Dictionary<object, object>)(object)player.CustomProperties).ContainsKey((object)"PeakProceduralParkourProtocol") && player.CustomProperties[(object)"PeakProceduralParkourProtocol"] is int num2) { return num2 == 1; } return false; } private bool PlayerHasActiveMod(Player player) { bool flag = false; int num; if (PlayerHasInstalledMod(player) && ((Dictionary<object, object>)(object)player.CustomProperties).ContainsKey((object)"PeakProceduralParkourEnabled")) { object obj = player.CustomProperties[(object)"PeakProceduralParkourEnabled"]; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } return (byte)(num & (flag ? 1 : 0)) != 0; } private bool TryGetSharedRoomSeed(Player masterClient, out int sharedSeed) { sharedSeed = 0; Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null); if (val == null) { return false; } if (!((Dictionary<object, object>)(object)val).ContainsKey((object)"PeakProceduralParkourSeed") || !((Dictionary<object, object>)(object)val).ContainsKey((object)"PeakProceduralParkourOwnerActor") || !((Dictionary<object, object>)(object)val).ContainsKey((object)"PeakProceduralParkourRoomProtocol") || !((Dictionary<object, object>)(object)val).ContainsKey((object)"PeakProceduralParkourRoomEnabled")) { return false; } if (!(val[(object)"PeakProceduralParkourOwnerActor"] is int num) || num != masterClient.ActorNumber) { return false; } if (!(val[(object)"PeakProceduralParkourRoomProtocol"] is int num2) || num2 != 1) { return false; } object obj = val[(object)"PeakProceduralParkourRoomEnabled"]; if (!(obj is bool) || !(bool)obj) { return false; } if (!(val[(object)"PeakProceduralParkourSeed"] is int num3)) { return false; } sharedSeed = num3; return true; } private int BuildLocalSeed() { return (Environment.TickCount * 397) ^ Guid.NewGuid().GetHashCode(); } private int BuildSharedRoomSeed() { int num = ((PhotonNetwork.CurrentRoom != null && !string.IsNullOrEmpty(PhotonNetwork.CurrentRoom.Name)) ? PhotonNetwork.CurrentRoom.Name.GetHashCode() : 0); int num2 = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0); return (num * 397) ^ num2 ^ DateTime.UtcNow.Ticks.GetHashCode(); } private void LogStateIfChanged(string modeLabel, bool masterInstalled, int? masterActor, int? sharedSeed) { string text = ((PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.Name : "Offline"); int num = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : (-1)); string text2 = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", modeLabel, IsReadyForGeneration, UseSharedSeed, sharedSeed.HasValue ? sharedSeed.Value.ToString() : "NA", masterActor.HasValue ? masterActor.Value.ToString() : "NA", masterInstalled, num, text); if (!(text2 == _lastLoggedSnapshot)) { _lastLoggedSnapshot = text2; PeakProceduralParkourPlugin.Instance.ModLogger.LogInfo((object)string.Format("[联机同步] 模式={0} 就绪={1} 共享模式={2} 共享种子={3} 房主Actor={4} 识别房主安装={5} 本地Actor={6} 房间={7}", modeLabel, IsReadyForGeneration, UseSharedSeed, sharedSeed.HasValue ? sharedSeed.Value.ToString() : "未就绪", masterActor.HasValue ? masterActor.Value.ToString() : "无", masterInstalled, num, text)); } } } [BepInPlugin("com.github.thanks.peak.procedural.parkour", "Peak Procedural Parkour", "1.1.3")] public sealed class PeakProceduralParkourPlugin : BaseUnityPlugin { internal const string PluginGuid = "com.github.thanks.peak.procedural.parkour"; internal const string PluginName = "Peak Procedural Parkour"; internal const string PluginVersion = "1.1.3"; internal static PeakProceduralParkourPlugin Instance { get; private set; } internal ConfigEntry<bool> ModEnabled { get; private set; } internal ConfigEntry<float> CampfireSafeRadius { get; private set; } internal ConfigEntry<float> PeakCampfireSafeRadiusMultiplier { get; private set; } internal ConfigEntry<float> SpawnDensity { get; private set; } internal ConfigEntry<float> CorridorIntensity { get; private set; } internal ConfigEntry<int> JumpRouteBundles { get; private set; } internal ConfigEntry<float> GeometryScaleMultiplier { get; private set; } internal ConfigEntry<float> HazardSpacingMultiplier { get; private set; } internal ConfigEntry<float> TrapFallSeconds { get; private set; } internal ConfigEntry<float> TrapRepeatDelay { get; private set; } internal HazardNetworkCoordinator NetworkCoordinator { get; private set; } internal ManualLogSource ModLogger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown Instance = this; ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable runtime obstacle and trap generation."); CampfireSafeRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "CampfireSafeRadius", 28f, "Safe radius around campfires where hazards will not spawn."); PeakCampfireSafeRadiusMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PeakCampfireSafeRadiusMultiplier", 1.8f, new ConfigDescription("Multiplier for safe radius around peak (high altitude) campfires.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>())); SpawnDensity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SpawnDensity", 1.85f, "Multiplies the number of spawned hazards per segment."); CorridorIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "CorridorIntensity", 1.8f, "Adds extra traps and larger geometry between one campfire and the next."); JumpRouteBundles = ((BaseUnityPlugin)this).Config.Bind<int>("General", "JumpRouteBundles", 2, "How many multi-lane jump route sets to build in each campfire corridor."); GeometryScaleMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "GeometryScaleMultiplier", 18f, new ConfigDescription("Overall hazard size multiplier. 10 means vanilla-like, 50 means very large set pieces.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 50f), Array.Empty<object>())); HazardSpacingMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HazardSpacingMultiplier", 2.8f, new ConfigDescription("Higher values spread obstacles farther apart to avoid clustered layouts.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f), Array.Empty<object>())); TrapFallSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TrapFallSeconds", 1.2f, "Fall duration applied when a trap catches a player."); TrapRepeatDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TrapRepeatDelay", 1.75f, "Cooldown before the same trap can affect the same player again."); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; NetworkCoordinator = ((Component)this).gameObject.AddComponent<HazardNetworkCoordinator>(); ((Component)this).gameObject.AddComponent<RuntimeHazardBuilder>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Peak Procedural Parkour 1.1.3 loaded."); } } internal sealed class RuntimeHazardBuilder : MonoBehaviour { private enum SampleMode { Ground, Slope, Mixed } private readonly struct ScenePropTemplate { public GameObject Source { get; } public Vector3 BoundsSize { get; } public int Score { get; } public ScenePropTemplate(GameObject source, Vector3 boundsSize, int score) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Source = source; BoundsSize = boundsSize; Score = score; } } private readonly struct CorridorInfo { public Vector3 Start { get; } public Vector3 End { get; } public Vector3 Direction { get; } public Vector3 Cross { get; } public float Length { get; } public bool IsValid { get; } public CorridorInfo(Vector3 start, Vector3 end) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Start = start; End = end; Vector3 val = end - start; Direction = ((Vector3)(ref val)).normalized; val = Vector3.Cross(Vector3.up, Direction); Cross = ((Vector3)(ref val)).normalized; Length = Vector3.Distance(start, end); int num; if (Length > 18f) { val = Direction; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { val = Cross; num = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? 1 : 0); goto IL_0089; } } num = 0; goto IL_0089; IL_0089: IsValid = (byte)num != 0; } } private readonly struct SegmentData { public int Index { get; } public BiomeType Biome { get; } public GameObject Parent { get; } public Campfire Campfire { get; } public SegmentData(int index, BiomeType biome, GameObject parent, Campfire campfire) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Index = index; Biome = biome; Parent = parent; Campfire = campfire; } } private enum LaneArchetype { Mainline, Risky, Technical, HighArc } private readonly struct LaneVariant { public LaneArchetype Archetype { get; } public RouteProfile Profile { get; } public bool PreferFlat { get; } public float RouteSpanScale { get; } public float MaxJumpScale { get; } public float DensityScale { get; } public float MinPlatformScale { get; } public float MaxPlatformScale { get; } public float SwayFrequencyScale { get; } public float SwayAmplitudeScale { get; } public float SwayPhase { get; } public float HeightAmplitudeScale { get; } public float RiseBudgetScale { get; } public float RiseBudgetMin { get; } public float RiseBudgetMax { get; } public float BaseHeightBias { get; } public float NarrowChanceBias { get; } public float LengthScale { get; } public float WidthScale { get; } public float OffsetJitterScale { get; } public float SupportChance { get; } public PrimitiveType PrimaryBoardShape { get; } public PrimitiveType AlternateBoardShape { get; } public float AlternateBoardChanceBias { get; } public PrimitiveType SupportShape { get; } public bool ForceGapMarkers { get; } public float GapMarkerChanceBonus { get; } public float ProgressiveExponentMin { get; } public float ProgressiveExponentMax { get; } public LaneVariant(LaneArchetype archetype, RouteProfile profile, bool preferFlat, float routeSpanScale, float maxJumpScale, float densityScale, float minPlatformScale, float maxPlatformScale, float swayFrequencyScale, float swayAmplitudeScale, float swayPhase, float heightAmplitudeScale, float riseBudgetScale, float riseBudgetMin, float riseBudgetMax, float baseHeightBias, float narrowChanceBias, float lengthScale, float widthScale, float offsetJitterScale, float supportChance, PrimitiveType primaryBoardShape, PrimitiveType alternateBoardShape, float alternateBoardChanceBias, PrimitiveType supportShape, bool forceGapMarkers, float gapMarkerChanceBonus, float progressiveExponentMin, float progressiveExponentMax) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Archetype = archetype; Profile = profile; PreferFlat = preferFlat; RouteSpanScale = routeSpanScale; MaxJumpScale = maxJumpScale; DensityScale = densityScale; MinPlatformScale = minPlatformScale; MaxPlatformScale = maxPlatformScale; SwayFrequencyScale = swayFrequencyScale; SwayAmplitudeScale = swayAmplitudeScale; SwayPhase = swayPhase; HeightAmplitudeScale = heightAmplitudeScale; RiseBudgetScale = riseBudgetScale; RiseBudgetMin = riseBudgetMin; RiseBudgetMax = riseBudgetMax; BaseHeightBias = baseHeightBias; NarrowChanceBias = narrowChanceBias; LengthScale = lengthScale; WidthScale = widthScale; OffsetJitterScale = offsetJitterScale; SupportChance = supportChance; PrimaryBoardShape = primaryBoardShape; AlternateBoardShape = alternateBoardShape; AlternateBoardChanceBias = alternateBoardChanceBias; SupportShape = supportShape; ForceGapMarkers = forceGapMarkers; GapMarkerChanceBonus = gapMarkerChanceBonus; ProgressiveExponentMin = progressiveExponentMin; ProgressiveExponentMax = progressiveExponentMax; } } private readonly struct RouteProfile { public float DualLaneChance { get; } public float LaneSpreadMin { get; } public float LaneSpreadMax { get; } public float RouteSpanMin { get; } public float RouteSpanMax { get; } public float MaxJumpDistance { get; } public float PlatformDensityFactor { get; } public int MinPlatforms { get; } public int MaxPlatforms { get; } public float SwayFrequency { get; } public float SwayMin { get; } public float SwayMax { get; } public float StairRiseA { get; } public float StairRiseB { get; } public float StairRiseC { get; } public float BaseHeightMin { get; } public float BaseHeightMax { get; } public float DownStepClamp { get; } public float UpStepClamp { get; } public float NarrowPlatformChance { get; } public float EdgeLengthMin { get; } public float EdgeLengthMax { get; } public float EdgeWidthMin { get; } public float EdgeWidthMax { get; } public float NarrowLengthMin { get; } public float NarrowLengthMax { get; } public float NarrowWidthMin { get; } public float NarrowWidthMax { get; } public float MidLengthMin { get; } public float MidLengthMax { get; } public float MidWidthMin { get; } public float MidWidthMax { get; } public PrimitiveType BoardShape { get; } public bool AllowOccasionalAlternateBoard { get; } public PrimitiveType AlternateBoardShape { get; } public float AlternateBoardChance { get; } public PrimitiveType SupportShape { get; } public float SupportRadius { get; } public float SupportTilt { get; } public float BoardTilt { get; } public float CylinderBoardThickness { get; } public float BoxBoardThickness { get; } public float BoxBoardThicknessMin { get; } public float SphereBoardScale { get; } public bool AddGapMarkers { get; } public float GapMarkerChance { get; } public RouteProfile(float dualLaneChance, float laneSpreadMin, float laneSpreadMax, float routeSpanMin, float routeSpanMax, float maxJumpDistance, float platformDensityFactor, int minPlatforms, int maxPlatforms, float swayFrequency, float swayMin, float swayMax, float stairRiseA, float stairRiseB, float stairRiseC, float baseHeightMin, float baseHeightMax, float downStepClamp, float upStepClamp, float narrowPlatformChance, float edgeLengthMin, float edgeLengthMax, float edgeWidthMin, float edgeWidthMax, float narrowLengthMin, float narrowLengthMax, float narrowWidthMin, float narrowWidthMax, float midLengthMin, float midLengthMax, float midWidthMin, float midWidthMax, PrimitiveType boardShape, bool allowOccasionalAlternateBoard, PrimitiveType alternateBoardShape, float alternateBoardChance, PrimitiveType supportShape, float supportRadius, float supportTilt, float boardTilt, float cylinderBoardThickness, float boxBoardThickness, float boxBoardThicknessMin, float sphereBoardScale, bool addGapMarkers, float gapMarkerChance) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) DualLaneChance = dualLaneChance; LaneSpreadMin = laneSpreadMin; LaneSpreadMax = laneSpreadMax; RouteSpanMin = routeSpanMin; RouteSpanMax = routeSpanMax; MaxJumpDistance = maxJumpDistance; PlatformDensityFactor = platformDensityFactor; MinPlatforms = minPlatforms; MaxPlatforms = maxPlatforms; SwayFrequency = swayFrequency; SwayMin = swayMin; SwayMax = swayMax; StairRiseA = stairRiseA; StairRiseB = stairRiseB; StairRiseC = stairRiseC; BaseHeightMin = baseHeightMin; BaseHeightMax = baseHeightMax; DownStepClamp = downStepClamp; UpStepClamp = upStepClamp; NarrowPlatformChance = narrowPlatformChance; EdgeLengthMin = edgeLengthMin; EdgeLengthMax = edgeLengthMax; EdgeWidthMin = edgeWidthMin; EdgeWidthMax = edgeWidthMax; NarrowLengthMin = narrowLengthMin; NarrowLengthMax = narrowLengthMax; NarrowWidthMin = narrowWidthMin; NarrowWidthMax = narrowWidthMax; MidLengthMin = midLengthMin; MidLengthMax = midLengthMax; MidWidthMin = midWidthMin; MidWidthMax = midWidthMax; BoardShape = boardShape; AllowOccasionalAlternateBoard = allowOccasionalAlternateBoard; AlternateBoardShape = alternateBoardShape; AlternateBoardChance = alternateBoardChance; SupportShape = supportShape; SupportRadius = supportRadius; SupportTilt = supportTilt; BoardTilt = boardTilt; CylinderBoardThickness = cylinderBoardThickness; BoxBoardThickness = boxBoardThickness; BoxBoardThicknessMin = boxBoardThicknessMin; SphereBoardScale = sphereBoardScale; AddGapMarkers = addGapMarkers; GapMarkerChance = gapMarkerChance; } public static RouteProfile ForBiome(BiomeType biome, bool preferFlat) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown switch ((int)biome) { case 0: return new RouteProfile(preferFlat ? 0.78f : 0.52f, 20f, 34f, 0.18f, 0.31f, 5.2f, 0.76f, 6, 12, 2.4f, 0.9f, 2.8f, 1.6f, 0.95f, 2.6f, 0.5f, 1.15f, 1.1f, 1.68f, 0.26f, 5.6f, 7.2f, 3.4f, 4.6f, 2f, 2.6f, 1.15f, 1.7f, 2.8f, 4f, 1.8f, 2.6f, (PrimitiveType)3, allowOccasionalAlternateBoard: true, (PrimitiveType)2, 0.34f, (PrimitiveType)3, 0.42f, 6f, 10f, 0.18f, 0.22f, 0.18f, 0.42f, addGapMarkers: false, 0f); case 2: case 5: return new RouteProfile(preferFlat ? 0.58f : 0.34f, 16f, 28f, 0.17f, 0.3f, preferFlat ? 5f : 4.55f, 0.74f, 6, 11, 2.8f, 0.6f, 1.7f, 2.4f, 1.15f, 3.4f, 0.8f, 1.5f, 0.9f, 2.2f, 0.66f, 4.8f, 6.4f, 2.5f, 3.3f, 1.8f, 2.5f, 0.95f, 1.45f, 2.4f, 3.4f, 1.4f, 2.05f, (PrimitiveType)3, allowOccasionalAlternateBoard: true, (PrimitiveType)2, 0.36f, (PrimitiveType)2, 0.32f, 18f, 14f, 0.17f, 0.18f, 0.16f, 0.4f, addGapMarkers: false, 0f); case 3: return new RouteProfile(preferFlat ? 0.42f : 0.28f, 14f, 24f, 0.16f, 0.28f, preferFlat ? 5.4f : 4.8f, 0.8f, 5, 9, 1.9f, 0.45f, 1.2f, 2.1f, 0.8f, 3f, 0.9f, 1.8f, 0.9f, 2.1f, 0.6f, 4.4f, 5.8f, 2.4f, 3.2f, 1.9f, 2.4f, 1f, 1.5f, 2f, 3f, 1.45f, 2.1f, (PrimitiveType)2, allowOccasionalAlternateBoard: true, (PrimitiveType)0, 0.24f, (PrimitiveType)2, 0.36f, 8f, 6f, 0.2f, 0.2f, 0.18f, 0.48f, addGapMarkers: true, 0.24f); default: return new RouteProfile(preferFlat ? 0.72f : 0.48f, preferFlat ? 18f : 14f, preferFlat ? 30f : 22f, 0.16f, 0.3f, preferFlat ? 5.2f : 4.6f, 0.78f, 5, 11, 2f, 0.65f, 1.9f, 2.5f, 1.15f, 3.3f, 0.7f, preferFlat ? 1.3f : 1.7f, 0.95f, 2.05f, 0.5f, 5f, 6.8f, 3.2f, 4.2f, 1.9f, 2.6f, 1.1f, 1.7f, 2.4f, 3.4f, 1.6f, 2.4f, (PrimitiveType)2, allowOccasionalAlternateBoard: true, (PrimitiveType)2, 0.22f, (PrimitiveType)2, 0.4f, 0f, 8f, 0.2f, 0.2f, 0.18f, 0.42f, addGapMarkers: false, 0f); } } } private readonly struct SpawnPlan { public int WallCount { get; } public int GroundTrapCount { get; } public int SlopeTrapCount { get; } public SpawnPlan(int wallCount, int groundTrapCount, int slopeTrapCount) { WallCount = wallCount; GroundTrapCount = groundTrapCount; SlopeTrapCount = slopeTrapCount; } public static SpawnPlan ForBiome(BiomeType biome, float density) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown SpawnPlan spawnPlan = (int)biome switch { 0 => new SpawnPlan(2, 2, 2), 1 => new SpawnPlan(3, 3, 2), 2 => new SpawnPlan(3, 3, 3), 3 => new SpawnPlan(4, 4, 3), 5 => new SpawnPlan(3, 3, 4), 6 => new SpawnPlan(4, 4, 3), 7 => new SpawnPlan(3, 4, 2), 8 => new SpawnPlan(3, 4, 2), 9 => new SpawnPlan(4, 3, 3), _ => new SpawnPlan(3, 3, 2), }; return new SpawnPlan(Mathf.Max(1, Mathf.RoundToInt((float)spawnPlan.WallCount * density)), Mathf.Max(1, Mathf.RoundToInt((float)spawnPlan.GroundTrapCount * density)), Mathf.Max(1, Mathf.RoundToInt((float)spawnPlan.SlopeTrapCount * density))); } } private sealed class PoissonDiskSampler { private readonly Bounds _bounds; private readonly float _minDistance; private readonly float _cellSize; private readonly int _gridWidth; private readonly int _gridHeight; private readonly int[,] _grid; private readonly List<Vector3> _points; private readonly List<Vector3> _active; private readonly Random _random; private readonly float _heightBias; public PoissonDiskSampler(Bounds bounds, float minDistance, Random random, float heightBias = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) _bounds = bounds; _minDistance = minDistance; _cellSize = minDistance / Mathf.Sqrt(2f); _gridWidth = Mathf.CeilToInt(((Bounds)(ref bounds)).size.x / _cellSize) + 2; _gridHeight = Mathf.CeilToInt(((Bounds)(ref bounds)).size.z / _cellSize) + 2; _grid = new int[_gridWidth, _gridHeight]; _points = new List<Vector3>(); _active = new List<Vector3>(); _random = random; _heightBias = heightBias; for (int i = 0; i < _gridWidth; i++) { for (int j = 0; j < _gridHeight; j++) { _grid[i, j] = -1; } } } public List<Vector3> Generate(int maxPoints, Func<Vector3, bool> validatePoint, int maxAttempts = 30) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007a: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) //IL_0128: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0225: 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_022d: 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_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) Random random = _random; Bounds bounds = _bounds; float min = ((Bounds)(ref bounds)).min.x + _minDistance; bounds = _bounds; float num = NextRange(random, min, ((Bounds)(ref bounds)).max.x - _minDistance); bounds = _bounds; float y = ((Bounds)(ref bounds)).center.y; Random random2 = _random; bounds = _bounds; float min2 = ((Bounds)(ref bounds)).min.z + _minDistance; bounds = _bounds; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, y, NextRange(random2, min2, ((Bounds)(ref bounds)).max.z - _minDistance)); if (!validatePoint(val)) { for (int i = 0; i < 10; i++) { Random random3 = _random; bounds = _bounds; float min3 = ((Bounds)(ref bounds)).min.x + _minDistance; bounds = _bounds; float num2 = NextRange(random3, min3, ((Bounds)(ref bounds)).max.x - _minDistance); bounds = _bounds; float y2 = ((Bounds)(ref bounds)).center.y; Random random4 = _random; bounds = _bounds; float min4 = ((Bounds)(ref bounds)).min.z + _minDistance; bounds = _bounds; ((Vector3)(ref val))..ctor(num2, y2, NextRange(random4, min4, ((Bounds)(ref bounds)).max.z - _minDistance)); if (validatePoint(val)) { break; } } } AddPoint(val); Vector3 val3 = default(Vector3); while (_active.Count > 0 && _points.Count < maxPoints) { int index = _random.Next(_active.Count); Vector3 val2 = _active[index]; bool flag = false; for (int j = 0; j < maxAttempts; j++) { float num3 = (float)(_random.NextDouble() * 3.1415927410125732 * 2.0); float num4 = _minDistance + (float)(_random.NextDouble() * (double)_minDistance); float num5 = val2.x + Mathf.Cos(num3) * num4; float num6 = val2.z + Mathf.Sin(num3) * num4; bounds = _bounds; float y3 = ((Bounds)(ref bounds)).center.y; float num7 = (float)(_random.NextDouble() - 0.5); bounds = _bounds; float num8 = y3 + num7 * ((Bounds)(ref bounds)).size.y * _heightBias; ((Vector3)(ref val3))..ctor(num5, num8, num6); if (IsInBounds(val3) && IsFarEnough(val3) && validatePoint(val3)) { AddPoint(val3); flag = true; break; } } if (!flag) { _active.RemoveAt(index); } } return _points; } private void AddPoint(Vector3 point) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references) _points.Add(point); _active.Add(point); float x = point.x; Bounds bounds = _bounds; int num = Mathf.FloorToInt((x - ((Bounds)(ref bounds)).min.x) / _cellSize); float z = point.z; bounds = _bounds; int num2 = Mathf.FloorToInt((z - ((Bounds)(ref bounds)).min.z) / _cellSize); if (num >= 0 && num < _gridWidth && num2 >= 0 && num2 < _gridHeight) { _grid[num, num2] = _points.Count - 1; } } private bool IsInBounds(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //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_0045: 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_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_0060: Unknown result type (might be due to invalid IL or missing references) float x = point.x; Bounds bounds = _bounds; if (x >= ((Bounds)(ref bounds)).min.x) { float x2 = point.x; bounds = _bounds; if (x2 <= ((Bounds)(ref bounds)).max.x) { float z = point.z; bounds = _bounds; if (z >= ((Bounds)(ref bounds)).min.z) { float z2 = point.z; bounds = _bounds; return z2 <= ((Bounds)(ref bounds)).max.z; } } } return false; } private bool IsFarEnough(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) float x = point.x; Bounds bounds = _bounds; int num = Mathf.FloorToInt((x - ((Bounds)(ref bounds)).min.x) / _cellSize); float z = point.z; bounds = _bounds; int num2 = Mathf.FloorToInt((z - ((Bounds)(ref bounds)).min.z) / _cellSize); int num3 = Mathf.Max(0, num - 2); int num4 = Mathf.Min(_gridWidth - 1, num + 2); int num5 = Mathf.Max(0, num2 - 2); int num6 = Mathf.Min(_gridHeight - 1, num2 + 2); for (int i = num3; i <= num4; i++) { for (int j = num5; j <= num6; j++) { int num7 = _grid[i, j]; if (num7 >= 0 && num7 < _points.Count) { Vector3 val = _points[num7]; float num8 = point.x - val.x; float num9 = point.z - val.z; if (num8 * num8 + num9 * num9 < _minDistance * _minDistance) { return false; } } } } return true; } } private sealed class HeightLayerSampler { private readonly Bounds _bounds; private readonly int _layerCount; private readonly float[] _layerHeights; private readonly List<Vector3>[] _layerPoints; private readonly Random _random; public HeightLayerSampler(Bounds bounds, int layerCount, Random random) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) _bounds = bounds; _layerCount = Mathf.Max(1, layerCount); _random = random; _layerHeights = new float[_layerCount]; _layerPoints = new List<Vector3>[_layerCount]; float num = ((Bounds)(ref bounds)).size.y / (float)(_layerCount + 1); for (int i = 0; i < _layerCount; i++) { _layerHeights[i] = ((Bounds)(ref bounds)).min.y + num * (float)(i + 1); _layerPoints[i] = new List<Vector3>(); } } public int GetLayerForHeight(float height) { for (int i = 0; i < _layerCount; i++) { if (height <= _layerHeights[i]) { return i; } } return _layerCount - 1; } public void AddPoint(Vector3 point) { //IL_0001: 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) int layerForHeight = GetLayerForHeight(point.y); _layerPoints[layerForHeight].Add(point); } public bool IsFarEnoughInLayer(Vector3 point, float minDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) int layerForHeight = GetLayerForHeight(point.y); List<Vector3> list = _layerPoints[layerForHeight]; float num = minDistance * minDistance; for (int i = 0; i < list.Count; i++) { Vector3 val = list[i]; float num2 = point.x - val.x; float num3 = point.z - val.z; if (num2 * num2 + num3 * num3 < num) { return false; } } if (layerForHeight > 0) { List<Vector3> list2 = _layerPoints[layerForHeight - 1]; for (int j = 0; j < list2.Count; j++) { Vector3 val2 = list2[j]; float num4 = point.x - val2.x; float num5 = point.z - val2.z; if (num4 * num4 + num5 * num5 < num * 0.64f) { return false; } } } if (layerForHeight < _layerCount - 1) { List<Vector3> list3 = _layerPoints[layerForHeight + 1]; for (int k = 0; k < list3.Count; k++) { Vector3 val3 = list3[k]; float num6 = point.x - val3.x; float num7 = point.z - val3.z; if (num6 * num6 + num7 * num7 < num * 0.64f) { return false; } } } return true; } public List<Vector3> GetAllPoints() { List<Vector3> list = new List<Vector3>(); for (int i = 0; i < _layerCount; i++) { list.AddRange(_layerPoints[i]); } return list; } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass51_0 { public RuntimeHazardBuilder <>4__this; public List<SegmentData> segmentData; } [CompilerGenerated] private sealed class <BuildForMapRoutine>d__51 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RuntimeHazardBuilder <>4__this; public MapHandler mapHandler; public bool recreateRoot; public int startIndex; public int buildUpToSegment; private <>c__DisplayClass51_0 <>8__1; public int generationSeed; public bool useSharedSeed; private Transform <rootTransform>5__2; private int <sceneSeed>5__3; private Vector3? <initialEntryAnchor>5__4; private int <placedCount>5__5; private float <playerScale>5__6; private int <boundedEndIndex>5__7; private int <i>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildForMapRoutine>d__51(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = default(<>c__DisplayClass51_0); <rootTransform>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Expected O, but got Unknown int num = <>1__state; RuntimeHazardBuilder runtimeHazardBuilder = <>4__this; Scene scene; switch (num) { default: return false; case 0: <>1__state = -1; <>8__1.<>4__this = <>4__this; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: { <>1__state = -1; if ((Object)mapHandler == (Object)null || !runtimeHazardBuilder.IsMapReady(mapHandler)) { return false; } if (recreateRoot || (Object)(object)runtimeHazardBuilder._currentRoot == (Object)null) { GameObject val = new GameObject("PeakProceduralParkour_RuntimeRoot"); val.transform.SetParent(((Component)mapHandler).transform, false); val.SetActive(true); runtimeHazardBuilder._currentRoot = val; } <rootTransform>5__2 = runtimeHazardBuilder._currentRoot.transform; <>8__1.segmentData = runtimeHazardBuilder.ReadSegments(mapHandler); if (<>8__1.segmentData.Count == 0) { PeakProceduralParkourPlugin.Instance.ModLogger.LogWarning((object)"Map found but no segment data was readable."); return false; } scene = ((Component)mapHandler).gameObject.scene; <sceneSeed>5__3 = CreateSceneSeed(((Scene)(ref scene)).name, <>8__1.segmentData); <initialEntryAnchor>5__4 = runtimeHazardBuilder.ResolveInitialEntryAnchor(mapHandler); <placedCount>5__5 = 0; <playerScale>5__6 = ResolvePlayerScale(((Component)mapHandler).gameObject.scene); int num2 = Mathf.Clamp(startIndex, 0, Mathf.Max(0, <>8__1.segmentData.Count - 1)); <boundedEndIndex>5__7 = Mathf.Clamp(buildUpToSegment, -1, <>8__1.segmentData.Count - 1); <i>5__8 = num2; goto IL_0400; } case 3: <>1__state = -1; goto IL_03ee; case 4: { <>1__state = -1; goto IL_03ee; } IL_03ee: <i>5__8++; goto IL_0400; IL_0400: if (<i>5__8 <= <boundedEndIndex>5__7) { if (<BuildForMapRoutine>g__ShouldBuildSegmentNow|51_1(<>8__1.segmentData[<i>5__8], <i>5__8, buildUpToSegment)) { if (!((Object)(object)runtimeHazardBuilder.<BuildForMapRoutine>g__FindSegmentRoot|51_0(<i>5__8, ref <>8__1) != (Object)null)) { int num3 = runtimeHazardBuilder.BuildSegment(<rootTransform>5__2, <>8__1.segmentData[<i>5__8], (<i>5__8 == 0) ? <initialEntryAnchor>5__4 : null, FindPreviousCampfireCenter(<>8__1.segmentData, <i>5__8), FindNextCampfireCenter(<>8__1.segmentData, <i>5__8), <sceneSeed>5__3, generationSeed, useSharedSeed, <playerScale>5__6); PeakProceduralParkourPlugin.Instance.ModLogger.LogInfo((object)$"[段构建] index={<i>5__8} biome={<>8__1.segmentData[<i>5__8].Biome} built={num3} activeSelf={<>8__1.segmentData[<i>5__8].Parent.activeSelf} activeInHierarchy={<>8__1.segmentData[<i>5__8].Parent.activeInHierarchy}"); <placedCount>5__5 += num3; runtimeHazardBuilder._currentBuiltUpToSegment = Mathf.Max(runtimeHazardBuilder._currentBuiltUpToSegment, <i>5__8); if (num3 >= 6) { <>2__current = (object)new WaitForSecondsRealtime(0.06f); <>1__state = 3; return true; } <>2__current = null; <>1__state = 4; return true; } runtimeHazardBuilder._currentBuiltUpToSegment = Mathf.Max(runtimeHazardBuilder._currentBuiltUpToSegment, <i>5__8); } goto IL_03ee; } if (<placedCount>5__5 > 0) { ManualLogSource modLogger = PeakProceduralParkourPlugin.Instance.ModLogger; object arg = <placedCount>5__5; scene = ((Component)mapHandler).gameObject.scene; modLogger.LogInfo((object)$"Built {arg} hazards for scene '{((Scene)(ref scene)).name}'."); } runtimeHazardBuilder._buildRoutine = null; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string ClimbProxyObjectName = "__PPP_ClimbProxy"; private const string SegmentRootNamePrefix = "Segment_"; private static readonly string[] TerminalVolcanoKeywords = new string[11] { "kiln", "furnace", "forge", "crucible", "vent", "chimney", "lava", "pit", "mouth", "smelter", "cauldron" }; private static readonly string[] GroundLuggageKeywords = new string[6] { "suitcase", "luggage", "baggage", "briefcase", "valise", "backpack" }; private static readonly Dictionary<int, Bounds[]> SegmentGroundLuggageCache = new Dictionary<int, Bounds[]>(); private static readonly FieldInfo SegmentsField = AccessTools.Field(typeof(MapHandler), "segments"); private static readonly FieldInfo HasFinishedStartRoutineField = AccessTools.Field(typeof(MapHandler), "hasFinishedStartRoutine"); private static readonly FieldInfo CurrentSegmentField = AccessTools.Field(typeof(MapHandler), "currentSegment"); private static readonly FieldInfo ClimbAlwaysRangeEnabledField = AccessTools.Field(typeof(ClimbModifierSurface), "hasAlwaysClimbableRange"); private static readonly FieldInfo ClimbAlwaysRangeField = AccessTools.Field(typeof(ClimbModifierSurface), "alwaysClimbableRange"); private static readonly FieldInfo ClimbOnlySlideDownField = AccessTools.Field(typeof(ClimbModifierSurface), "onlySlideDown"); private static readonly FieldInfo ClimbSpeedMultiplierField = AccessTools.Field(typeof(ClimbModifierSurface), "speedMultiplier"); private static readonly FieldInfo ClimbStaminaMultiplierField = AccessTools.Field(typeof(ClimbModifierSurface), "staminaUsageMultiplier"); private static readonly FieldInfo ClimbStaticCostField = AccessTools.Field(typeof(ClimbModifierSurface), "staticClimbCost"); private static readonly Type MapSegmentType = AccessTools.Inner(typeof(MapHandler), "MapSegment"); private static readonly PropertyInfo SegmentParentProperty = AccessTools.Property(MapSegmentType, "segmentParent"); private static readonly PropertyInfo SegmentCampfireProperty = AccessTools.Property(MapSegmentType, "segmentCampfire"); private static readonly PropertyInfo SegmentBiomeProperty = AccessTools.Property(MapSegmentType, "biome"); private float _nextRefreshTime; private float _sceneChangedAt; private int _currentMapInstanceId = int.MinValue; private int _currentBuiltSceneHandle = -1; private int _currentGenerationSeed = int.MinValue; private bool _currentSharedSeedMode; private int _currentSegmentNumber = int.MinValue; private int _currentLastRevivedSegment = int.MinValue; private int _currentActiveSegmentSignature = int.MinValue; private int _currentBuiltUpToSegment = int.MinValue; private GameObject _currentRoot; private Coroutine _buildRoutine; private readonly Dictionary<int, Bounds> _segmentBoundsCache = new Dictionary<int, Bounds>(); private readonly Dictionary<int, int> _segmentLayerCache = new Dictionary<int, int>(); private readonly Dictionary<int, ScenePropTemplate[]> _segmentPropCache = new Dictionary<int, ScenePropTemplate[]>(); private void Awake() { _sceneChangedAt = Time.unscaledTime; SceneManager.activeSceneChanged += OnActiveSceneChanged; SceneManager.sceneUnloaded += OnSceneUnloaded; } private void OnDestroy() { if (_buildRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_buildRoutine); _buildRoutine = null; } SceneManager.activeSceneChanged -= OnActiveSceneChanged; SceneManager.sceneUnloaded -= OnSceneUnloaded; } private void Update() { if (!PeakProceduralParkourPlugin.Instance.ModEnabled.Value) { DestroyCurrentRoot(); _currentMapInstanceId = int.MinValue; } else if (!(Time.unscaledTime < _nextRefreshTime)) { _nextRefreshTime = Time.unscaledTime + 1.25f; TryBuildForCurrentMap(); } } private void OnActiveSceneChanged(Scene _, Scene __) { _sceneChangedAt = Time.unscaledTime; _currentMapInstanceId = int.MinValue; _currentSegmentNumber = int.MinValue; _currentLastRevivedSegment = int.MinValue; _currentActiveSegmentSignature = int.MinValue; _currentBuiltUpToSegment = int.MinValue; _segmentBoundsCache.Clear(); _segmentLayerCache.Clear(); _segmentPropCache.Clear(); DestroyCurrentRoot(); } private void OnSceneUnloaded(Scene unloadedScene) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_currentRoot != (Object)null && _currentRoot.scene == unloadedScene) { DestroyCurrentRoot(); } if (_currentBuiltSceneHandle == ((Scene)(ref unloadedScene)).handle) { _currentMapInstanceId = int.MinValue; _currentBuiltSceneHandle = -1; _currentGenerationSeed = int.MinValue; _currentSharedSeedMode = false; _currentSegmentNumber = int.MinValue; _currentLastRevivedSegment = int.MinValue; _currentActiveSegmentSignature = int.MinValue; _currentBuiltUpToSegment = int.MinValue; _segmentBoundsCache.Clear(); _segmentLayerCache.Clear(); _segmentPropCache.Clear(); } } private void TryBuildForCurrentMap() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) HazardNetworkCoordinator networkCoordinator = PeakProceduralParkourPlugin.Instance.NetworkCoordinator; if (((Object)(object)networkCoordinator != (Object)null && !networkCoordinator.IsReadyForGeneration) || !IsLocalPlayerReady()) { return; } Scene activeScene = SceneManager.GetActiveScene(); MapHandler val = Object.FindAnyObjectByType<MapHandler>(); if ((Object)val == (Object)null || ((Component)val).gameObject.scene != activeScene || !IsMapReady(val)) { if ((Object)val == (Object)null) { _currentMapInstanceId = int.MinValue; DestroyCurrentRoot(); } return; } int instanceID = ((Object)val).GetInstanceID(); int num = (((Object)(object)networkCoordinator != (Object)null) ? networkCoordinator.ActiveSeed : Environment.TickCount); bool flag = (Object)(object)networkCoordinator != (Object)null && networkCoordinator.UseSharedSeed; int num2 = ((CurrentSegmentField != null) ? ((int)CurrentSegmentField.GetValue(val)) : int.MinValue); int lastRevivedSegment = val.LastRevivedSegment; int num3 = CalculateActiveSegmentSignature(val); int num4 = Mathf.Max(lastRevivedSegment + 2, num2 + 2); if ((Object)(object)_currentRoot != (Object)null && _currentRoot.scene != activeScene) { DestroyCurrentRoot(); _currentMapInstanceId = int.MinValue; } bool num5 = (Object)(object)_currentRoot != (Object)null && _currentMapInstanceId == instanceID && _currentBuiltSceneHandle == ((Scene)(ref activeScene)).handle && _currentGenerationSeed == num && _currentSharedSeedMode == flag; bool flag2 = num3 != _currentActiveSegmentSignature; if (num5) { int currentBuiltUpToSegment = _currentBuiltUpToSegment; _currentSegmentNumber = num2; _currentLastRevivedSegment = lastRevivedSegment; _currentActiveSegmentSignature = num3; int num6 = Mathf.Max(0, num2); PruneSegmentRoots(num6, num4); bool flag3 = flag2 && _buildRoutine == null; int num7 = (flag3 ? num6 : (_currentBuiltUpToSegment + 1)); int num8 = (flag3 ? Mathf.Max(num4, Mathf.Max(num2 + 2, lastRevivedSegment + 2)) : num4); if (_buildRoutine == null && (num4 > currentBuiltUpToSegment || flag3)) { PeakProceduralParkourPlugin.Instance.ModLogger.LogInfo((object)$"[增量构建] currentSegment={num2} lastRevived={lastRevivedSegment} requested={num4} builtUpTo={currentBuiltUpToSegment} signatureChanged={flag2} start={num7} end={num8}"); _buildRoutine = ((MonoBehaviour)this).StartCoroutine(BuildForMapRoutine(val, num, flag, num7, num8, recreateRoot: false)); } } else { DestroyCurrentRoot(); _currentMapInstanceId = instanceID; _currentBuiltSceneHandle = ((Scene)(ref activeScene)).handle; _currentGenerationSeed = num; _currentSharedSeedMode = flag; _currentSegmentNumber = num2; _currentLastRevivedSegment = lastRevivedSegment; _currentActiveSegmentSignature = num3; _currentBuiltUpToSegment = int.MinValue; if (_buildRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_buildRoutine); } PeakProceduralParkourPlugin.Instance.ModLogger.LogInfo((object)$"[首轮构建] currentSegment={num2} lastRevived={lastRevivedSegment} requested={num4} signature={num3}"); _buildRoutine = ((MonoBehaviour)this).StartCoroutine(BuildForMapRoutine(val, num, flag, 0, num4, recreateRoot: true)); } } private bool IsLocalPlayerReady() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime - _sceneChangedAt < 6f) { return false; } Player val = Object.FindAnyObjectByType<Player>(); if ((Object)(object)val == (Object)null) { return false; } return ((Component)val).gameObject.scene == SceneManager.GetActiveScene(); } private bool IsMapReady(MapHandler mapHandler) { if (SegmentsField == null) { return false; } if (HasFinishedStartRoutineField != null && !(bool)HasFinishedStartRoutineField.GetValue(mapHandler)) { return false; } if (SegmentsField.GetValue(mapHandler) is Array array) { return array.Length > 0; } return false; } [IteratorStateMachine(typeof(<BuildForMapRoutine>d__51))] private IEnumerator BuildForMapRoutine(MapHandler mapHandler, int generationSeed, bool useSharedSeed, int startIndex, int buildUpToSegment, bool recreateRoot) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BuildForMapRoutine>d__51(0) { <>4__this = this, mapHandler = mapHandler, generationSeed = generationSeed, useSharedSeed = useSharedSeed, startIndex = startIndex, buildUpToSegment = buildUpToSegment, recreateRoot = recreateRoot }; } private Vector3? ResolveInitialEntryAnchor(MapHandler mapHandler) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MapHandler.CurrentBaseCampSpawnPoint != (Object)null) { return MapHandler.CurrentBaseCampSpawnPoint.position; } Player val = Object.FindAnyObjectByType<Player>(); if ((Object)(object)val != (Object)null && ((Component)val).gameObject.scene == ((Component)mapHandler).gameObject.scene) { return ((Component)val).transform.position; } return null; } private List<SegmentData> ReadSegments(MapHandler mapHandler) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) List<SegmentData> list = new List<SegmentData>(); if (!(SegmentsField.GetValue(mapHandler) is Array array)) { return list; } for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value != null) { object? obj = SegmentParentProperty?.GetValue(value, null); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (!((Object)(object)val == (Object)null)) { object? obj2 = SegmentCampfireProperty?.GetValue(value, null); GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null); Campfire campfire = (((Object)(object)val2 != (Object)null) ? val2.GetComponentInChildren<Campfire>(true) : null); BiomeType biome = (BiomeType)((SegmentBiomeProperty != null) ? ((int)(BiomeType)SegmentBiomeProperty.GetValue(value, null)) : 0); list.Add(new SegmentData(i, biome, val, campfire)); } } } return list; } private int BuildSegment(Transform root, SegmentData segment, Vector3? initialEntryAnchor, Vector3? previousCampfireCenter, Vector3? nextCampfireCenter, int sceneSeed, int generationSeed, bool useSharedSeed, float playerScale) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_0064: 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_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected I4, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected I4, but got Unknown //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Invalid comparison between Unknown and I4 int instanceID = ((Object)segment.Parent).GetInstanceID(); if (!_segmentBoundsCache.TryGetValue(instanceID, out var bounds)) { if (!TryGetCombinedBounds(segment.Parent, out bounds)) { return 0; } _segmentBoundsCache[instanceID] = bounds; } GameObject segmentRoot = new GameObject($"Segment_{segment.Index}_{segment.Biome}"); segmentRoot.transform.SetParent(root, false); segmentRoot.SetActive(true); bool isInitialAscentSegment = segment.Index == 0 && initialEntryAnchor.HasValue; if (!_segmentLayerCache.TryGetValue(instanceID, out var segmentLayer)) { segmentLayer = ResolveVisibleLayer(segment.Parent); _segmentLayerCache[instanceID] = segmentLayer; } Vector3? currentCampfireCenter = (((Object)(object)segment.Campfire != (Object)null) ? new Vector3?(segment.Campfire.Center()) : null); List<Vector3> safeCenters = CollectSafeCenters(initialEntryAnchor, currentCampfireCenter, previousCampfireCenter, nextCampfireCenter); float safeRadius = ((safeCenters.Count > 0) ? Mathf.Max(6f, PeakProceduralParkourPlugin.Instance.CampfireSafeRadius.Value) : 0f); float density = Mathf.Clamp(PeakProceduralParkourPlugin.Instance.SpawnDensity.Value * (isInitialAscentSegment ? 1.35f : 1f), 0.25f, 3.6f); float corridorIntensity = Mathf.Clamp(PeakProceduralParkourPlugin.Instance.CorridorIntensity.Value * (isInitialAscentSegment ? 1.4f : 1f), 0.5f, 4f); float geometryScale = Mathf.Clamp(PeakProceduralParkourPlugin.Instance.GeometryScaleMultiplier.Value / 10f * playerScale, 0.9f, 6f); float spacingScale = Mathf.Clamp(Mathf.Max(PeakProceduralParkourPlugin.Instance.HazardSpacingMultiplier.Value, 2.8f), 1f, 4f); int seed = (useSharedSeed ? CombineSeed(sceneSeed, generationSeed, segment.Index, (int)segment.Biome) : CombineSeed(sceneSeed, generationSeed, segment.Index, (int)segment.Biome, Environment.TickCount, Guid.NewGuid().GetHashCode(), DateTime.UtcNow.Millisecond)); Random random = new Random(seed); List<Vector3> placed = new List<Vector3>(); List<Vector3> mechanismPlaced = new List<Vector3>(); int num = 0; CorridorInfo corridor = CreateCorridor(bounds, initialEntryAnchor, currentCampfireCenter, previousCampfireCenter, nextCampfireCenter, safeRadius); List<Vector3> visibilityAnchors = CollectVisibilityAnchors(segment.Parent, corridor, initialEntryAnchor, currentCampfireCenter, previousCampfireCenter, nextCampfireCenter); if (!isInitialAscentSegment && (int)segment.Biome == 3 && !currentCampfireCenter.HasValue && !nextCampfireCenter.HasValue && previousCampfireCenter.HasValue) { num += BuildTerminalKilnAscentRoute(); if (num < 8) { num += BuildTerminalVolcanoOverlookRoute(); } } else { if (corridor.IsValid) { num += BuildCampfireCorridorSet(); num += BuildMountainSurfaceParkourExtras(isInitialAscentSegment); num += BuildGroundBlockerSet(); } if (isInitialAscentSegment && num < 6 && corridor.IsValid) { num += BuildInitialAscentGuarantee(); } if (isInitialAscentSegment && initialEntryAnchor.HasValue) { num += BuildSpawnVisibleMainline(); } else if (!isInitialAscentSegment && corridor.IsValid && (previousCampfireCenter.HasValue || currentCampfireCenter.HasValue)) { num += BuildCampfireDepartureVisibleRoute(); } if (num < (isInitialAscentSegment ? 4 : 3)) { num += BuildVisibleFallbackRoutes(); } } if (num == 0) { Object.Destroy((Object)(object)segmentRoot); } return num; float BiasTowardClimb(float sourceT, float minOffset, float maxOffset, bool stronglyPreferClimb) { float result2 = Mathf.Clamp01(sourceT); float num95 = float.MinValue; for (int num96 = 0; num96 < 14; num96++) { float num97 = ((num96 == 0) ? Mathf.Clamp01(sourceT) : Mathf.Clamp01(sourceT + ((num96 % 2 == 0) ? 1f : (-1f)) * NextRange(random, minOffset, maxOffset))); float num98 = EvaluateClimbPreference(num97); float num99 = Mathf.Abs(num97 - sourceT) * (stronglyPreferClimb ? 0.5f : 0.72f); float num100 = num98 - num99; if (stronglyPreferClimb) { num100 += num98 * 0.32f; } if (num100 > num95) { num95 = num100; result2 = num97; } } return result2; } int BuildCampfireCorridorSet() { int num255 = 0; float startT3 = (isInitialAscentSegment ? 0.28f : 0.08f); float endT3 = (isInitialAscentSegment ? 0.96f : 0.92f); float startT4 = (isInitialAscentSegment ? 0.32f : 0.12f); float endT4 = (isInitialAscentSegment ? 0.92f : 0.88f); num255 += CreateContinuousRouteSet(segmentRoot.transform, segment, startT3, endT3, random, preferFlat: true, 5, 6); num255 += CreateContinuousRouteSet(segmentRoot.transform, segment, startT4, endT4, random, preferFlat: false, 5, 6); if (corridor.Length >= 95f && random.NextDouble() < 0.82) { num255 += CreateGrandTraverseSet(segmentRoot.transform, segment, random); } if (num255 < 7) { num255 += CreateContinuousRouteSet(segmentRoot.transform, segment, isInitialAscentSegment ? 0.36f : 0.16f, isInitialAscentSegment ? 0.94f : 0.84f, random, preferFlat: true, 5, 6); } if (num255 < 8) { num255 += CreateContinuousRouteSet(segmentRoot.transform, segment, isInitialAscentSegment ? 0.4f : 0.22f, isInitialAscentSegment ? 0.9f : 0.8f, random, preferFlat: false, 5, 6); } return num255; } int BuildCampfireDepartureVisibleRoute() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c7: 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_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_00aa: 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_014d: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Invalid comparison between Unknown and I4 //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Invalid comparison between Unknown and I4 //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Invalid comparison between Unknown and I4 //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Invalid comparison between Unknown and I4 //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Invalid comparison between Unknown and I4 //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Invalid comparison between Unknown and I4 //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_050d: 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_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) Vector3? val = previousCampfireCenter ?? currentCampfireCenter; if (!val.HasValue) { return 0; } Vector3 value = val.Value; Vector3 val2; Vector3 val3; if (!corridor.IsValid) { val2 = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center - value, Vector3.up); val3 = ((Vector3)(ref val2)).normalized; } else { val3 = corridor.Direction; } Vector3 val4 = val3; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = ((((Bounds)(ref bounds)).size.z >= ((Bounds)(ref bounds)).size.x) ? Vector3.forward : Vector3.right); } Vector3 val5; if (!corridor.IsValid) { val2 = Vector3.Cross(Vector3.up, val4); val5 = ((Vector3)(ref val2)).normalized; } else { val5 = corridor.Cross; } Vector3 val6 = val5; if (((Vector3)(ref val6)).sqrMagnitude < 0.01f) { val6 = Vector3.right; } float num7 = Mathf.Max(safeRadius + 5f, 10f); float num8 = Mathf.Lerp(16.4f, 23.8f, Mathf.InverseLerp(0.9f, 6f, geometryScale)); GameObject val7 = new GameObject($"Hazard_CampfireVisibleRoute_{segment.Index}"); val7.transform.SetParent(segmentRoot.transform, false); val7.SetActive(true); SetLayerRecursively(val7, segmentLayer); int num9 = 0; Vector3 val8 = Vector3.zero; float previousWidth = 0f; for (int k = 0; k < 9; k++) { float num10 = num7 + (float)k * num8; float num11 = Mathf.Sin((float)k * 0.85f) * Mathf.Lerp(0.4f, 3.1f, (float)k / 8f) * spacingScale; if (TryGetGroundPointFromWorldProbe(value + val4 * num10 + val6 * num11, (k <= 1) ? 4f : 6.5f, k <= 1, out var point2)) { float num12 = (1f + (float)k * 0.95f) * geometryScale; Vector3 val9 = point2 + Vector3.up * num12; PrimitiveType val10 = (PrimitiveType)((k < 2 || random.NextDouble() < 0.38) ? 2 : 3); float num13 = (((int)val10 == 3) ? (Mathf.Lerp(8f, 5.2f, (float)k / 8f) * geometryScale) : Mathf.Max(1.6f, num8 * 0.4f)); float num14 = (((int)val10 == 3) ? (Mathf.Lerp(5.2f, 3.5f, (float)k / 8f) * geometryScale) : (Mathf.Lerp(4.8f, 3f, (float)k / 8f) * geometryScale)); float num15 = (((int)val10 == 3) ? EstimatePlatformHorizontalWidth(val10, num13, num14, k == 0 || k == 8) : num14); if (num9 > 0) { val2 = Vector3.ProjectOnPlane(val9 - val8, Vector3.up); float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 21.2f * geometryScale) { continue; } float num16 = ResolveRequiredCenterSpacing(previousWidth, num15, 1.36f); if (magnitude < num16) { continue; } val9.y = Mathf.Clamp(val9.y, val8.y - 1.1f * geometryScale, val8.y + 2.4f * geometryScale); } float num17 = (((int)val10 == 3) ? Mathf.Max(num13 * 0.5f, num15 * 0.95f) : (num15 * 1.08f)); if (!IsNearPlacedPoint(val9, Mathf.Max(Mathf.Lerp(4.8f, 8.2f, (float)k / 8f) * geometryScale, num17), 10f)) { GameObject val11 = CreatePrimitive(val10, $"CampfireVisibleBoard_{k}", val7.transform, segmentLayer); val11.transform.position = val9; val11.transform.rotation = (((int)val10 == 3) ? (Quaternion.LookRotation(val4, Vector3.up) * Quaternion.Euler(NextRange(random, -4f, 5f), NextRange(random, -20f, 20f), NextRange(random, -4f, 4f))) : (Quaternion.LookRotation(val4, Vector3.up) * Quaternion.Euler(NextRange(random, -4f, 4f), NextRange(random, -14f, 14f), 90f + NextRange(random, -6f, 6f)))); if ((int)val10 == 3) { val11.transform.localScale = new Vector3(num13, Mathf.Max(0.74f, 0.78f * geometryScale), num14); EnsureBoxCollider(val11, new Vector3(0.98f, 1f, 0.98f), Vector3.zero); } else { val11.transform.localScale = new Vector3(num14, num13, num14); EnsureMeshCollider(val11, convex: false); } ApplyVisual(val11, segment.Parent, VisualKind.Platform); placed.Add(val9); float num18 = val9.y - point2.y; if (num18 > 0.7f) { GameObject obj = CreatePrimitive((PrimitiveType)2, $"CampfireVisibleSupport_{k}", val7.transform, segmentLayer); obj.transform.position = point2 + Vector3.up * (num18 * 0.5f); obj.transform.rotation = CreateNaturalDebrisRotation(random, NextRange(random, -18f, 18f), 4f, 4f); obj.transform.localScale = new Vector3(Mathf.Max(1.6f, Mathf.Lerp(2.8f, 1.7f, (float)k / 8f) * geometryScale), Mathf.Max(1.1f, num18 * 0.5f), Mathf.Max(1.6f, Mathf.Lerp(2.8f, 1.7f, (float)k / 8f) * geometryScale)); ApplyVisual(obj, segment.Parent, VisualKind.Blocker); EnsureMeshCollider(obj, convex: false); } if (k >= 2 && num18 > 1.2f * geometryScale && random.NextDouble() < 0.82) { CreateRouteMechanism(val7.transform, segment, segmentLayer, val9, point2, Mathf.Lerp(7f, 10.5f, (float)k / 8f) * geometryScale, Mathf.Lerp(2.4f, 4.2f, (float)k / 8f) * geometryScale, num18, random, mountainBias: true, val8); } val8 = val9; previousWidth = num15; num9++; } } } if (num9 < 4) { Object.Destroy((Object)(object)val7); return 0; } PeakProceduralParkourPlugin.Instance.ModLogger.LogInfo((object)$"[篝火后可见路线] segment={segment.Index} built={num9} anchor={value} safeRadius={safeRadius:F1}"); return 1; } int BuildGroundBlockerSet() { //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: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_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) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) if (!corridor.IsValid) { return 0; } int num32 = (((int)segment.Biome == 0 || (int)segment.Biome == 1 || (int)segment.Biome == 6) ? 1 : 0); int count = Mathf.Clamp(Mathf.RoundToInt(0.9f + density * 0.55f + corridorIntensity * 0.42f) + num32, 1, 3); float minT = (isInitialAscentSegment ? 0.34f : 0.14f); float maxT = (isInitialAscentSegment ? 0.9f : 0.82f); float[] array3 = CreateDistributedTargets(random, count, minT, maxT, 0.026f, 0.11f); int num33 = 0; for (int m = 0; m < array3.Length; m++) { if (TrySampleCorridorSurface(BiasTowardClimb(array3[m], 0.015f, 0.05f, stronglyPreferClimb: false), 0.03f, 10f * spacingScale, SampleMode.Ground, 10.5f * spacingScale, out var hit2)) { Vector3 val22 = Vector3.ProjectOnPlane(corridor.Direction, Vector3.up); if (((Vector3)(ref val22)).sqrMagnitude < 0.01f) { val22 = Vector3.forward; } ((Vector3)(ref val22)).Normalize(); Vector3 val23 = Vector3.Cross(Vector3.up, val22); Vector3 val24 = ((Vector3)(ref val23)).normalized; if (((Vector3)(ref val24)).sqrMagnitude < 0.01f) { val24 = Vector3.right; } float num34 = NextRange(random, 12.5f, 20.5f) * geometryScale; float num35 = NextRange(random, 4.2f, 6.6f) * geometryScale; float num36 = NextRange(random, 1.15f, 1.85f) * geometryScale; Vector3 val25 = ((RaycastHit)(ref hit2)).point + ((RaycastHit)(ref hit2)).normal * 0.22f + Vector3.up * (num36 * 0.5f); if (!OverlapsSafeZone(val25, Mathf.Max(num34 * 0.32f, 6.4f * geometryScale)) && !IsNearPlacedPoint(val25, Mathf.Max(num34 * 0.34f, 9.5f * geometryScale), 12f) && !IsNearMechanismPoint(val25, Mathf.Max(num34 * 0.72f, 18f * geometryScale), 18f)) { GameObject val26 = new GameObject($"Hazard_GroundBlocker_{segment.Index}_{m}"); val26.transform.SetParent(segmentRoot.transform, false); val26.SetActive(true); SetLayerRecursively(val26, segmentLayer); GameObject obj3 = CreatePrimitive((PrimitiveType)3, $"GroundBarrierBase_{m}", val26.transform, segmentLayer); obj3.transform.position = val25; obj3.transform.rotation = Quaternion.LookRotation(val22, Vector3.up) * Quaternion.Euler(NextRange(random, -4f, 4f), NextRange(random, -14f, 14f), NextRange(random, -2f, 2f)); obj3.transform.localScale = new Vector3(num34, num36, num35); EnsureBoxCollider(obj3, new Vector3(0.98f, 1f, 0.98f), Vector3.zero); ApplyVisual(obj3, segment.Parent, VisualKind.Blocker); placed.Add(val25); float num37 = NextRange(random, 0.65f, 1.1f) * geometryScale; for (int n = -1; n <= 1; n += 2) { GameObject obj4 = CreatePrimitive((PrimitiveType)2, $"GroundBarrierBrace_{m}_{n}", val26.transform, segmentLayer); obj4.transform.position = ((RaycastHit)(ref hit2)).point + val24 * (num34 * 0.26f * (float)n) + Vector3.up * Mathf.Max(num37, num36 * 0.5f); obj4.transform.rotation = CreateNaturalDebrisRotation(random, NextRange(random, -12f, 12f), 6f, 6f); obj4.transform.localScale = new Vector3(Mathf.Max(0.6f, num35 * 0.14f), Mathf.Max(num37, num36 * 0.56f), Mathf.Max(0.6f, num35 * 0.14f)); ApplyVisual(obj4, segment.Parent, VisualKind.Mechanism); EnsureMeshCollider(obj4, convex: false); } Vector3 val27 = val25 + Vector3.up * (num36 * 0.58f); float boardLength2 = Mathf.Max(num34 * 0.82f, 9.5f * geometryScale); float num38 = Mathf.Max(num35, 3.8f * geometryScale); float supportHeight2 = Mathf.Max(num36 * 1.25f, 1.5f * geometryScale); CreateAxleDrivenTrap(val26.transform, segment, segmentLayer, val27, boardLength2, num38, supportHeight2, random, num38 < 4.8f * geometryScale); mechanismPlaced.Add(val27); num33++; } } } return num33; } int BuildInitialAscentGuarantee() { int num31 = 0; num31 += CreateContinuousRouteSet(segmentRoot.transform, segment, 0.32f, 0.84f, random, preferFlat: true, 4, 5); num31 += CreateContinuousRouteSet(segmentRoot.transform, segment, 0.36f, 0.9f, random, preferFlat: false, 3, 4); if (num31 < 6) { num31 += CreateContinuousRouteSet(segmentRoot.transform, segment, 0.4f, 0.92f, random, preferFlat: true, 4, 5); } return num31; } int BuildMountainSurfaceParkourExtras(bool focusSpawnSide) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) int num101 = 0; int count2 = (focusSpawnSide ? Mathf.Clamp(Mathf.RoundToInt(10.4f + density * 3.2f + corridorIntensity * 1.55f), 12, 18) : Mathf.Clamp(Mathf.RoundToInt(7.6f + density * 2.35f + corridorIntensity * 1.12f), 9, 14)); float minT2 = (isInitialAscentSegment ? (focusSpawnSide ? 0.26f : 0.22f) : (focusSpawnSide ? 0.04f : 0.08f)); float maxT2 = (isInitialAscentSegment ? 0.985f : 0.95f); float[] array5 = CreateDistributedTargets(random, count2, minT2, maxT2, 0.018f, focusSpawnSide ? 0.066f : 0.082f); for (int num102 = 0; num102 < array5.Length; num102++) { float targetT2 = BiasTowardClimb(array5[num102], 0.03f, 0.12f, stronglyPreferClimb: true); if (TrySampleCorridorSurface(targetT2, 0.04f, 18f * spacingScale, SampleMode.Slope, 7f * spacingScale, out var hit3)) { placed.Add(((RaycastHit)(ref hit3)).point); num101 += CreateMountainSurfaceCluster(segmentRoot.transform, segment, hit3, targetT2, random, num102); } } return num101; } int BuildSpawnVisibleMainline() { //IL_0006: Unknown result type (m