The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of PEAKChoice v1.0.1
off_grid.PEAKChoice.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKChoice.Features; using PEAKChoice.Patches; using Photon.Pun; using UnityEngine; using pworld.Scripts.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("off_grid.PEAKChoice")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("PEAKChoice")] [assembly: AssemblyTitle("off_grid.PEAKChoice")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PEAKChoice { [BepInPlugin("off_grid.PEAKChoice", "PEAKChoice", "1.0.1")] public class PEAKChoice : BaseUnityPlugin { internal static Harmony Harmony = new Harmony("off_grid.PEAKChoice"); public ConfigFile config; internal static string ForceMap = "Any"; internal static int AnyWeight = 50; internal static bool BothMaps = false; internal static string LayoutOrder = "Beach > Jungle > Snow > Desert > Caldera > Volcano > Peak"; internal static bool ForceLayoutOrder = false; internal static string PeakZone = "Peak"; internal static bool AwaitRPC = true; internal static MethodInfo? WarpPlayer; internal static string Forced = "Mesa"; public static PEAKChoice Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; InitializeConfig(); Forced = Additions.GetTargetBiome(); if (BothMaps && !ForceLayoutOrder) { LayoutOrder = "Beach > Jungle > Snow > Desert > Caldera > Volcano > Peak"; } Logger.LogWarning((object)("< " + ((BothMaps && !ForceLayoutOrder) ? "Forced: Mesa & Alpine >" : (ForceLayoutOrder ? "Forced LayoutOrder, ignoring all other values >" : ("Forced biome set to: " + Forced + " >"))))); WarpPlayer = typeof(Character).GetMethod("WarpPlayer", BindingFlags.Instance | BindingFlags.NonPublic); Harmony.PatchAll(); Logger.LogInfo((object)"off_grid.PEAKChoice v1.0.1 has fully loaded!"); } private void InitializeConfig() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "DAa Mods/PEAKChoice"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string text2 = Path.Combine(text, "config.cfg"); config = new ConfigFile(text2, true); string value = config.Bind<string>("Version", "Current Version", "", (ConfigDescription)null).Value; if (value != "1.0.1") { config.Clear(); } DefineConfig(); Logger.LogWarning((object)"< Config initialized >"); } private void DefineConfig() { config.Bind<string>("Version", "Current Version", "1.0.1", "Autoupdates the config / lets the mod know what version of config it is."); ForceMap = config.Bind<string>("MAP", "ForceMap", "Any", "Map that will be forced: Alpine | Mesa | Any\n(HOST ONLY)").Value; AnyWeight = config.Bind<int>("MAP", "AnyWeight", 50, "Less percent = less Alpine / More percent = more Mesa.\n(HOST ONLY)").Value; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "off_grid.PEAKChoice"; public const string PLUGIN_NAME = "PEAKChoice"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace PEAKChoice.Patches { [HarmonyPatch(typeof(Character))] internal class CharacterPatch { } [HarmonyPatch(typeof(MapHandler))] public static class MapHandlerPatches { internal static Vector3? DesiredPosition; [HarmonyPrefix] [HarmonyPatch("DetectBiomes")] private static bool DetectBiomes_Prefix(MapHandler __instance) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0e63: Unknown result type (might be due to invalid IL or missing references) //IL_0eeb: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0f74: Unknown result type (might be due to invalid IL or missing references) //IL_0f7a: Invalid comparison between Unknown and I4 //IL_0fd9: Unknown result type (might be due to invalid IL or missing references) //IL_0fac: Unknown result type (might be due to invalid IL or missing references) //IL_0fb2: Invalid comparison between Unknown and I4 //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: 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_0744: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_07a6: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_0b3c: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08c4: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Unknown result type (might be due to invalid IL or missing references) //IL_0bef: Unknown result type (might be due to invalid IL or missing references) //IL_0c0d: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c74: Unknown result type (might be due to invalid IL or missing references) //IL_0c9a: Unknown result type (might be due to invalid IL or missing references) //IL_0cd0: Unknown result type (might be due to invalid IL or missing references) //IL_0cd9: Unknown result type (might be due to invalid IL or missing references) //IL_0ceb: Unknown result type (might be due to invalid IL or missing references) //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) //IL_0d15: Unknown result type (might be due to invalid IL or missing references) //IL_0d21: Unknown result type (might be due to invalid IL or missing references) //IL_0b62: Unknown result type (might be due to invalid IL or missing references) //IL_095b: Unknown result type (might be due to invalid IL or missing references) //IL_0d7b: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_0d51: Unknown result type (might be due to invalid IL or missing references) //IL_0d56: Unknown result type (might be due to invalid IL or missing references) //IL_0d5b: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_0dbc: Unknown result type (might be due to invalid IL or missing references) //IL_0dc1: Unknown result type (might be due to invalid IL or missing references) //IL_0dc5: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) //IL_0a19: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient && !PEAKChoice.AwaitRPC) { PEAKChoice.Logger.LogWarning((object)"< Using AwaitRPC, instead of calculating >"); return true; } __instance.biomes.Clear(); if (PEAKChoice.ForceLayoutOrder || PEAKChoice.BothMaps) { PEAKChoice.Logger.LogInfo((object)"< BEGINNING STEP 1/3 - Layout Order >"); Object.Destroy((Object)(object)GameObject.Find("FogSphereSystem")); PEAKChoice.Logger.LogInfo((object)"< Deleted FogSphereSystem >"); string[] source = PEAKChoice.LayoutOrder.Split('>'); List<string> list = (from s in source select s.Trim() into s where !string.IsNullOrEmpty(s) select s).ToList(); Transform transform = ((Component)__instance).transform; foreach (string item5 in list) { string name = item5.Trim(); BiomeType val = Additions.ParseBiomeName(name); __instance.biomes.Add(val); PEAKChoice.Logger.LogInfo((object)$"Added {val} to biomes list (USING - Layout Order)"); } PEAKChoice.Logger.LogInfo((object)"< BEGINNING STEP 2/3 - Layout Order >"); Dictionary<string, (Transform, Transform, Transform)> dictionary = new Dictionary<string, (Transform, Transform, Transform)>(StringComparer.OrdinalIgnoreCase); foreach (Transform item6 in ((Component)__instance).transform) { Transform val2 = item6; if (!((Object)val2).name.StartsWith("Biome_")) { continue; } foreach (Transform item7 in val2) { Transform val3 = item7; ((Component)val3).gameObject.SetActive(false); string name2 = ((Object)val3).name; switch (name2) { case "Volcano": dictionary["Volcano"] = (val3.Find(name2 + "_Segment"), val3.Find(name2 + "_Campfire"), val2.Find("VolcanoModel")); PEAKChoice.Logger.LogInfo((object)" --- > GOT TARGET: Volcano"); dictionary["Caldera"] = (val3.Find("Caldera_Segment"), val3.Find("Caldera_Segment/Enterance/LavaTemple/Ruin"), val3); PEAKChoice.Logger.LogInfo((object)" --- > GOT TARGET: Caldera"); dictionary["Peak"] = (val3.Find("Peak"), val3.Find("Peak/Flag_planted_seagull"), val3); PEAKChoice.Logger.LogInfo((object)" --- > GOT TARGET: Peak"); break; case "Desert": dictionary["Desert"] = (val3.Find(name2 + "_Segment"), val3.Find(name2 + "_Campfire/Snow_Campfire"), val3); PEAKChoice.Logger.LogInfo((object)" --- > GOT TARGET: Desert"); break; case "Jungle": dictionary["Jungle"] = (val3.Find(name2 + "_Segment"), val3.Find(name2 + "_Campfire/WallTop"), val3); PEAKChoice.Logger.LogInfo((object)" --- > GOT TARGET: Desert"); break; default: { Transform val4 = val3.Find(name2 + "_Segment"); Transform val5 = val3.Find(name2 + "_Campfire"); if ((Object)(object)val4 != (Object)null && (Object)(object)val5 != (Object)null) { dictionary[name2] = (val4, val5, val3); PEAKChoice.Logger.LogInfo((object)(" --- > GOT TARGET: " + name2)); } break; } } } } PEAKChoice.Logger.LogInfo((object)"< BEGINNING STEP 3/3 - Layout Order >"); float num = 0f; float num2 = 0f; Transform val6 = null; Transform val7 = null; Vector3? val8 = null; float num3 = 0f; float num4 = 0f; float thickness = 0.05f; float num5 = 0f; float num6 = 0f; float num7 = 0f; float num8 = 0f; Vector3? val9 = null; Vector3? val10 = null; Vector3? val11 = null; Vector3? val12 = null; Transform val13 = null; for (int i = 0; i < list.Count; i++) { string text = list[i]; if (!dictionary.TryGetValue(text, out var value)) { PEAKChoice.Logger.LogError((object)(" --- > FAILURE ON TARGET: " + text)); continue; } if ((Object)(object)value.Item1 == (Object)null) { PEAKChoice.Logger.LogError((object)"How?..."); continue; } Transform parent = value.Item1.parent; ((Component)value.Item1).gameObject.SetActive(true); value.Item1.localRotation = Quaternion.identity; value.Item1.localScale = Vector3.one; value.Item1.SetParent(((Component)__instance).transform, false); if ((Object)(object)value.Item2 != (Object)null) { ((Component)value.Item2).gameObject.SetActive(true); value.Item2.localRotation = Quaternion.identity; value.Item2.localScale = Vector3.one; value.Item2.SetParent(value.Item1, true); val7 = value.Item2; } if ((Object)(object)value.Item3 != (Object)null) { ((Component)value.Item3).gameObject.SetActive(true); value.Item3.localRotation = Quaternion.identity; value.Item3.localScale = Vector3.one; value.Item3.SetParent(value.Item1, true); } if (text == "Jungle") { Transform val14 = parent.Find("RainStorm"); val14.SetParent(value.Item1, true); PEAKChoice.Logger.LogInfo((object)(" --- > Attached objects to " + text)); } if (text == "Snow") { Transform val15 = parent.Find("SnowStorm"); val15.SetParent(value.Item1, true); PEAKChoice.Logger.LogInfo((object)(" --- > Attached objects to " + text)); } if (text == "Caldera") { Object.Destroy((Object)(object)((Component)value.Item1.Find("LavaRivers")).gameObject); Object.Destroy((Object)(object)((Component)value.Item1.Find("volcano Smoke")).gameObject); PEAKChoice.Logger.LogInfo((object)(" --- > Removed objects from " + text)); } if (text == "Peak") { Object.Destroy((Object)(object)((Component)value.Item1.Find("Pillar")).gameObject); PEAKChoice.Logger.LogInfo((object)(" --- > Removed objects from " + text)); } (Vector3 minLocal, Vector3 maxLocal, bool __found, Vector3 Highest) localMeshBounds = Additions.GetLocalMeshBounds(value.Item1, value.Item2, 220f); Vector3 item = localMeshBounds.minLocal; Vector3 item2 = localMeshBounds.maxLocal; bool item3 = localMeshBounds.__found; Vector3 item4 = localMeshBounds.Highest; Vector3 val16 = Additions.SampleEdgeWorldPoint(value.Item1, item.z, thickness, wantMax: false); float num9 = item2.z - item.z; float num10 = item2.y - item.y; PEAKChoice.Logger.LogInfo((object)$"{text} local z range: min={item.z:F2}, max={item2.z:F2}, segSizeZ={num9:F2}"); float num11 = 0f - item.z; float num12 = 0f - item.y; float num13 = 0f - item.z; float num14 = 0f - item.y; Transform val17 = Additions.FindChildByNameContains(value.Item1, "Ground"); Vector3 val18 = Vector3.zero; Vector3 val19 = Vector3.zero; if ((Object)(object)val17 != (Object)null) { Renderer componentInChildren = ((Component)val17).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren != (Object)null) { Bounds val20 = value.Item1.InverseTransformBounds(componentInChildren.bounds); val18 = ((Bounds)(ref val20)).max; val19 = ((Bounds)(ref val20)).min; } } Vector3 val21 = Vector3.zero; Vector3 val22 = Vector3.zero; Bounds bounds; if ((Object)(object)value.Item2 != (Object)null) { Renderer componentInChildren2 = ((Component)value.Item2).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren2 != (Object)null) { bounds = componentInChildren2.bounds; val21 = ((Bounds)(ref bounds)).max; bounds = componentInChildren2.bounds; val22 = ((Bounds)(ref bounds)).min; } } if (i > 0 && (Object)(object)val6 != (Object)null) { Vector3 val23 = transform.InverseTransformPoint(val8.Value); Vector3 val24 = transform.InverseTransformPoint(val16); float num15 = val23.z + num2 - item.z; float num16 = Mathf.Max(num6, num9) * 2f; float num17 = Mathf.Clamp(num15 - (0f - item.z), 0f - num16, num16); num11 = 0f - item.z + num17; Transform val25 = Additions.FindChildByNameContains(value.Item1, "Ground"); bool flag = false; Bounds val26 = default(Bounds); if ((Object)(object)val25 != (Object)null) { Renderer componentInChildren3 = ((Component)val25).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren3 != (Object)null) { val26 = value.Item1.InverseTransformBounds(componentInChildren3.bounds); flag = true; } } bool flag2 = false; Bounds val27 = default(Bounds); if ((Object)(object)val13 != (Object)null && (Object)(object)val6 != (Object)null) { Renderer componentInChildren4 = ((Component)val13).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren4 != (Object)null) { val27 = val6.InverseTransformBounds(componentInChildren4.bounds); flag2 = true; } } float num18 = float.NaN; if (flag2 && flag) { float num19 = val6.localPosition.y + ((Bounds)(ref val27)).max.y; num18 = num19 + num - ((Bounds)(ref val26)).min.y; PEAKChoice.Logger.LogInfo((object)$"Using ground-ground Y anchor: prevTopParentY={num19:F2}, currGroundMinLocal={((Bounds)(ref val26)).min.y:F2} -> computedParentLocalY={num18:F2}"); } else if ((Object)(object)val6 != (Object)null) { float num20 = val6.localPosition.y + num8; num18 = num20 + num - item.y; PEAKChoice.Logger.LogInfo((object)$"Fallback Y anchor: prevFrontY={num20:F2}, currMinLocalY={item.y:F2} -> computedParentLocalY={num18:F2}"); } else { num18 = num14; } float num21 = Mathf.Max(num5, num10) * 4f; float num22 = Mathf.Clamp(num18 - num14, 0f - num21, num21); num12 = num14 + num22; PEAKChoice.Logger.LogWarning((object)$" --- > Placing {text}: Z base={num13:F2}, computedZ={num15:F2}, appliedDeltaZ={num17:F2} -> desiredZ={num11:F2}"); PEAKChoice.Logger.LogWarning((object)$" --- > Placing {text}: Y base={num14:F2}, computedParentY={num18:F2}, appliedDeltaY={num22:F2} -> desiredY={num12:F2}"); } else { num11 = num13; num12 = num14; } value.Item1.localPosition = new Vector3(0f, num12, num11); if (i == 0) { DesiredPosition = new Vector3(0f, num12 + 30f, num11 - num9 / 2f); if (text == "Beach") { GameObject val28 = GameObject.Find("Misc/Water"); val28.transform.localPosition = value.Item1.localPosition; PEAKChoice.Logger.LogInfo((object)(" --- > Modified water to match " + text)); } } PEAKChoice.Logger.LogInfo((object)$"{text} --- > World: [([{val9} | {val10} | {val18} | {val19}] | [{val11} | {val12} | {val21} | {val22}] | {num3} | {num4}) | {val8} | {val16:F2}] | segment sizeZ/sizeY: {num9:F2}/{num10:F2} | segment minZ/minY: {item.z:F2}/{item.y:F2} | placed Z/Y: {num11:F2}/{num12:F2} | Campfire: [{item4} | {item3}]"); num3 = num11; num4 = num12; val6 = value.Item1; num5 = num10; num6 = num9; num7 = item2.z; num8 = item2.y; val8 = Additions.SampleEdgeWorldPoint(value.Item1, item2.z, thickness); val13 = Additions.FindChildByNameContains(value.Item1, "Ground"); val9 = Vector3.zero; val10 = Vector3.zero; if ((Object)(object)val13 != (Object)null) { Renderer componentInChildren5 = ((Component)val13).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren5 != (Object)null) { Bounds val29 = value.Item1.InverseTransformBounds(componentInChildren5.bounds); val9 = ((Bounds)(ref val29)).max; val10 = ((Bounds)(ref val29)).min; } } val11 = Vector3.zero; val12 = Vector3.zero; if ((Object)(object)value.Item2 != (Object)null) { Renderer componentInChildren6 = ((Component)value.Item2).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren6 != (Object)null) { bounds = componentInChildren6.bounds; val11 = ((Bounds)(ref bounds)).max; bounds = componentInChildren6.bounds; val12 = ((Bounds)(ref bounds)).min; } } } PEAKChoice.Logger.LogWarning((object)"< Layout Order finished >"); } else { GameObject val30 = GameObject.Find("Map/Biome_3/Snow"); GameObject val31 = GameObject.Find("Map/Biome_3/Desert"); if (PEAKChoice.Forced == "Mesa") { if ((Object)(object)val30 != (Object)null) { val30.SetActive(false); foreach (object item8 in val30.transform) { ((Component)(Transform)item8).gameObject.SetActive(false); } } if ((Object)(object)val31 != (Object)null) { val31.SetActive(true); } } else if (PEAKChoice.Forced == "Alpine") { if ((Object)(object)val30 != (Object)null) { val30.SetActive(true); foreach (object item9 in val31.transform) { ((Component)(Transform)item9).gameObject.SetActive(false); } } if ((Object)(object)val31 != (Object)null) { val31.SetActive(false); } } Biome val32 = default(Biome); for (int j = 0; j < ((Component)__instance).transform.childCount; j++) { Transform child = ((Component)__instance).transform.GetChild(j); for (int k = 0; k < child.childCount; k++) { if (((Component)child.GetChild(k)).TryGetComponent<Biome>(ref val32)) { if (PEAKChoice.Forced == "Mesa" && (int)val32.biomeType == 2) { __instance.biomes.Add((BiomeType)6); PEAKChoice.Logger.LogInfo((object)"Forced Mesa"); } else if (PEAKChoice.Forced == "Alpine" && (int)val32.biomeType == 6) { __instance.biomes.Add((BiomeType)2); PEAKChoice.Logger.LogInfo((object)"Forced Alpine"); } else { __instance.biomes.Add(val32.biomeType); PEAKChoice.Logger.LogInfo((object)("Added: " + ((Object)val32).name)); } } } } } PEAKChoice.Logger.LogWarning((object)"< Patched - DetectBiomes >"); return false; } [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(MapHandler __instance) { typeof(MapHandler).GetMethod("DetectBiomes", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(__instance, null); PEAKChoice.Logger.LogWarning((object)"< Patched - Awake >"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static IEnumerator Start_Postfix(IEnumerator __result, MapHandler __instance) { if (!PEAKChoice.ForceLayoutOrder && !PEAKChoice.BothMaps && PhotonNetwork.IsMasterClient) { yield return __result; for (int i = 1; i < __instance.segments.Length; i++) { MapSegment val = __instance.segments[i]; if (PEAKChoice.Forced == "Mesa" && (int)val.biome == 2) { val.variantBiome = (BiomeType)6; val.hasVariant = false; PEAKChoice.Logger.LogInfo((object)$"Forced segment {i} variant to Mesa"); } else if (PEAKChoice.Forced == "Alpine" && (int)val.biome == 6) { val.variantBiome = (BiomeType)2; val.hasVariant = false; PEAKChoice.Logger.LogInfo((object)$"Forced segment {i} variant to Alpine"); } } } PEAKChoice.Logger.LogWarning((object)"< Patched - Start >"); } } [HarmonyPatch(typeof(PointPinger))] internal class PointPingerPatch { [HarmonyPatch("ReceivePoint_Rpc")] [HarmonyPostfix] public static void Postfix_PingWarp_ReceivePoint_Rpc(PointPinger __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (PExt.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, HelperExtensions.ToLayerMask((LayerType)1), -1f)) { PEAKChoice.Logger.LogMessage((object)$"{((Object)((Component)((RaycastHit)(ref val)).collider).gameObject).name} --- > {((RaycastHit)(ref val)).point}"); } } } [HarmonyPatch(typeof(RunManager))] internal class RunManagerPatch { [HarmonyPatch("StartRun")] [HarmonyPrefix] public static bool Prefix_PeakToBeach_StartRun(RunManager __instance) { if (PEAKChoice.ForceLayoutOrder) { ((MonoBehaviour)__instance).StartCoroutine(Additions.Teleport()); PEAKChoice.Logger.LogWarning((object)"< Patched - StartRun >"); return true; } return true; } } } namespace PEAKChoice.Features { public static class Additions { private static Random rng = new Random(); internal static readonly Dictionary<string, (Transform seg, Transform fire, Vector3 segPos, Vector3 firePos)> TargetPositions = new Dictionary<string, (Transform, Transform, Vector3, Vector3)>(StringComparer.OrdinalIgnoreCase); internal static string GetTargetBiome() { switch (PEAKChoice.ForceMap.ToLower()) { case "mesa": return "Mesa"; case "alpine": return "Alpine"; case "any": { int num = rng.Next(0, 100); if (num < PEAKChoice.AnyWeight) { return "Alpine"; } return "Mesa"; } default: return "Mesa"; } } internal static IEnumerator Teleport() { if ((Object)(object)Character.localCharacter != (Object)null && MapHandlerPatches.DesiredPosition.HasValue) { PEAKChoice.WarpPlayer?.Invoke(Character.localCharacter, new object[2] { MapHandlerPatches.DesiredPosition, true }); PEAKChoice.Logger.LogInfo((object)" < Teleported you to start >"); } yield return (object)new WaitForSeconds(1f); } internal static BiomeType ParseBiomeName(string name) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) return (BiomeType)(name.ToLower() switch { "snow" => 2, "desert" => 6, "beach" => 0, "jungle" => 1, "caldera" => 3, "volcano" => 3, "peak" => 5, _ => 0, }); } internal static Transform FindChildByNameContains(Transform root, string keyword) { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)((Component)val).gameObject).name.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } return null; } internal static (Vector3 minLocal, Vector3 maxLocal, bool __found, Vector3 Highest) GetLocalMeshBounds(Transform root, Transform? anchor = null, float anchorRadius = 200f) { //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_0269: 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) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) Transform val = FindChildByNameContains(root, "Ground"); float num = float.MinValue; if ((Object)(object)val != (Object)null) { Renderer componentInChildren = ((Component)val).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren != (Object)null) { Bounds val2 = root.InverseTransformBounds(componentInChildren.bounds); num = ((Bounds)(ref val2)).max.y; } } Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return (Vector3.zero, Vector3.zero, false, Vector3.zero); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(float.MaxValue, float.MaxValue, float.MaxValue); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(float.MinValue, float.MinValue, float.MinValue); float num2 = float.MinValue; Vector3 zero = Vector3.zero; string[] array = new string[7] { "cloud", "sphere", "vfx", "smoke", "lod", "ring", "plane" }; int num3 = 0; Renderer[] array2 = componentsInChildren; foreach (Renderer val5 in array2) { if (!((Component)val5).gameObject.activeInHierarchy || !val5.enabled) { continue; } Bounds val6 = root.InverseTransformBounds(val5.bounds); string text = ((Object)((Component)val5).gameObject).name.ToLowerInvariant(); bool flag = false; string[] array3 = array; foreach (string value in array3) { if (text.Contains(value)) { flag = true; break; } } if (flag) { PEAKChoice.Logger.LogWarning((object)("GetLocalMeshBounds: skipping renderer " + ((Object)((Component)val5).gameObject).name + " (by name) for " + ((Object)root).name)); continue; } float num4 = ((Bounds)(ref val6)).size.x * ((Bounds)(ref val6)).size.y * ((Bounds)(ref val6)).size.z; if (num4 > 5000000f) { PEAKChoice.Logger.LogWarning((object)$"GetLocalMeshBounds: skipping outlier renderer {((Object)((Component)val5).gameObject).name} (vol={num4:F1}) for {((Object)root).name}"); continue; } if ((Object)(object)val != (Object)null && ((Bounds)(ref val6)).max.y < num - 5f) { PEAKChoice.Logger.LogWarning((object)("GetLocalMeshBounds: skipping renderer " + ((Object)((Component)val5).gameObject).name + " (not near ground) for " + ((Object)root).name)); continue; } val3 = Vector3.Min(val3, ((Bounds)(ref val6)).min); val4 = Vector3.Max(val4, ((Bounds)(ref val6)).max); if (((Bounds)(ref val6)).max.y > num2) { num2 = ((Bounds)(ref val6)).max.y; ((Vector3)(ref zero))..ctor((((Bounds)(ref val6)).min.x + ((Bounds)(ref val6)).max.x) * 0.5f, ((Bounds)(ref val6)).max.y, (((Bounds)(ref val6)).min.z + ((Bounds)(ref val6)).max.z) * 0.5f); } num3++; } if (num3 == 0) { PEAKChoice.Logger.LogWarning((object)("GetLocalMeshBounds: no valid renderers found for " + ((Object)root).name + ", returning fallback 0 bounds")); return (Vector3.zero, Vector3.zero, false, zero); } return (val3, val4, true, zero); } internal static Bounds InverseTransformBounds(this Transform root, Bounds b) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00fb: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(((Bounds)(ref b)).min.x, ((Bounds)(ref b)).min.y, ((Bounds)(ref b)).min.z), new Vector3(((Bounds)(ref b)).max.x, ((Bounds)(ref b)).min.y, ((Bounds)(ref b)).min.z), new Vector3(((Bounds)(ref b)).min.x, ((Bounds)(ref b)).max.y, ((Bounds)(ref b)).min.z), new Vector3(((Bounds)(ref b)).min.x, ((Bounds)(ref b)).min.y, ((Bounds)(ref b)).max.z), new Vector3(((Bounds)(ref b)).max.x, ((Bounds)(ref b)).max.y, ((Bounds)(ref b)).min.z), new Vector3(((Bounds)(ref b)).min.x, ((Bounds)(ref b)).max.y, ((Bounds)(ref b)).max.z), new Vector3(((Bounds)(ref b)).max.x, ((Bounds)(ref b)).min.y, ((Bounds)(ref b)).max.z), new Vector3(((Bounds)(ref b)).max.x, ((Bounds)(ref b)).max.y, ((Bounds)(ref b)).max.z) }; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(float.MaxValue, float.MaxValue, float.MaxValue); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(float.MinValue, float.MinValue, float.MinValue); Vector3[] array2 = array; foreach (Vector3 val3 in array2) { Vector3 val4 = root.InverseTransformPoint(val3); val = Vector3.Min(val, val4); val2 = Vector3.Max(val2, val4); } return new Bounds((val + val2) * 0.5f, val2 - val); } internal static Vector3 SampleEdgeWorldPoint(Transform root, float sampleLocalZ, float thickness = 0.05f, bool wantMax = true, bool wantYMiddle = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01d8: Unknown result type (might be due to invalid IL or missing references) Transform val = FindChildByNameContains(root, "Ground"); float num = float.MinValue; if ((Object)(object)val != (Object)null) { Renderer componentInChildren = ((Component)val).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren != (Object)null) { Bounds val2 = root.InverseTransformBounds(componentInChildren.bounds); num = ((Bounds)(ref val2)).max.y; } } Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); List<Vector3> list = new List<Vector3>(); List<float> list2 = new List<float>(); string[] array = new string[7] { "cloud", "sphere", "vfx", "smoke", "lod", "ring", "plane" }; Renderer[] array2 = componentsInChildren; Vector3 val5 = default(Vector3); foreach (Renderer val3 in array2) { if (!((Component)val3).gameObject.activeInHierarchy || !val3.enabled) { continue; } Bounds val4 = root.InverseTransformBounds(val3.bounds); string text = ((Object)((Component)val3).gameObject).name.ToLowerInvariant(); bool flag = false; string[] array3 = array; foreach (string value in array3) { if (text.Contains(value)) { flag = true; break; } } if (!flag && (!((Object)(object)val != (Object)null) || !(((Bounds)(ref val4)).max.y < num - 5f)) && !(sampleLocalZ + thickness < ((Bounds)(ref val4)).min.z) && !(sampleLocalZ - thickness > ((Bounds)(ref val4)).max.z)) { ((Vector3)(ref val5))..ctor((((Bounds)(ref val4)).min.x + ((Bounds)(ref val4)).max.x) * 0.5f, wantMax ? ((Bounds)(ref val4)).max.y : ((Bounds)(ref val4)).min.y, Mathf.Clamp(sampleLocalZ, ((Bounds)(ref val4)).min.z, ((Bounds)(ref val4)).max.z)); list.Add(val5); list2.Add(val5.y); } } if (list.Count == 0) { (Vector3 minLocal, Vector3 maxLocal, bool __found, Vector3 Highest) localMeshBounds = GetLocalMeshBounds(root); Vector3 item = localMeshBounds.minLocal; Vector3 item2 = localMeshBounds.maxLocal; bool item3 = localMeshBounds.__found; Vector3 item4 = localMeshBounds.Highest; float num2 = (wantMax ? item2.y : item.y); return root.TransformPoint(new Vector3(0f, num2, sampleLocalZ)); } list2.Sort(); float num3 = list2[list2.Count / 2]; Vector3 val6 = list[0]; float num4 = Mathf.Abs(list[0].y - num3); for (int k = 1; k < list.Count; k++) { float num5 = Mathf.Abs(list[k].y - num3); if (num5 < num4) { num4 = num5; val6 = list[k]; } } return root.TransformPoint(val6); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }