using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AllBiomes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AllBiomes")] [assembly: AssemblyTitle("AllBiomes")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AllBiomes { [BepInPlugin("peak.allbiomes", "AllBiomes", "0.20.6")] public sealed class AllBiomesPlugin : BaseUnityPlugin { private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private readonly List _segments = new List(); private int _builtMapId; private int _stableFrames; private bool _flight; private int _teleportIndex = -1; private bool _generationStarted; private Harmony _harmony; private string _markerFile; private int _markerNumber; private bool _debugFogOff; private int _localCharacterId; private int _fogHandlerId; private int _fogStateSegment = -1; private string _runId = "offline"; private bool _startNewRun = true; private readonly List _debugFogRoots = new List(); private readonly Dictionary _flightBodies = new Dictionary(); private readonly Dictionary _flightColliders = new Dictionary(); private Vector3 _flightLastSafeCenter; private List _pendingStaticSnapshot; private int _pendingDonorBuildIndex = -1; private GameObject _runtimeRoot; private readonly HashSet _abandonedDonorBuildIndices = new HashSet(); internal static int LifecycleBlockedBuildIndex = -1; internal static AllBiomesPlugin Instance; private const string NetworkPlanKey = "ALLBIOMES_PLAN_0205"; private const string NetworkLayoutKey = "ALLBIOMES_LAYOUT_0205"; private const string NetworkMobsKey = "ALLBIOMES_MOBS_0205"; private const string ModVersion = "0.20.6"; private static readonly Vector3 RescueOffsetFromSummitGem = new Vector3(-1.42f, 47.95f, -29.62f); private static Vector3 RescueZoneCenter = new Vector3(-27.25f, 2269.8f, 3750.81f); private const float RescueZoneRadius = 35f; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Instance = this; _harmony = new Harmony("peak.allbiomes.runtimegenerator"); _harmony.PatchAll(typeof(AllBiomesPlugin).Assembly); InstallDonorLifecycleProtection(); SceneManager.sceneLoaded += OnSceneLoaded; _markerFile = Path.Combine(Paths.ConfigPath, "AllBiomesMarkers.txt"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Runtime generator 0.20.6 loaded (host-authoritative donors)"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] F6 fly; F7 teleport; F8 marker; F9 fog; F10 bring players; F11 flare"); } private void Update() { TryGenerate(); MaintainRuntimeLifecycle(); DebugControls(); } private unsafe void FixedUpdate() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0240: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035b: 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) if (!_flight) { return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } if (_flightBodies.Count == 0) { BeginFlight(localCharacter); } if (_flightBodies.Count == 0) { return; } Vector3 center = localCharacter.Center; if (!IsFinite(center) || ((Vector3)(ref center)).sqrMagnitude > 100000000f || Vector3.Distance(center, _flightLastSafeCenter) > 100f) { Vector3 val = _flightLastSafeCenter - center; if (IsFinite(val)) { localCharacter.refs.ragdoll.MoveAllRigsInDirection(val); } localCharacter.refs.ragdoll.HaltBodyVelocity(false); ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Flight physics divergence recovered from=" + ((object)(*(Vector3*)(¢er))/*cast due to .constrained prefix*/).ToString() + " to=" + ((object)Unsafe.As(ref _flightLastSafeCenter)/*cast due to .constrained prefix*/).ToString())); return; } Camera main = Camera.main; Vector3 val2; Vector3 val3; if (!((Object)(object)main != (Object)null)) { val2 = ((Component)localCharacter).transform.forward; } else { val3 = ((Component)main).transform.forward; val2 = ((Vector3)(ref val3)).normalized; } Vector3 val4; if (!((Object)(object)main != (Object)null)) { val4 = ((Component)localCharacter).transform.right; } else { val3 = ((Component)main).transform.right; val4 = ((Vector3)(ref val3)).normalized; } Vector3 val5 = val4; float num = ((Input.GetKey((KeyCode)119) || Input.GetKey((KeyCode)273)) ? 1f : 0f) - ((Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274)) ? 1f : 0f); float num2 = ((Input.GetKey((KeyCode)100) || Input.GetKey((KeyCode)275)) ? 1f : 0f) - ((Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)276)) ? 1f : 0f); Vector3 val6 = val2 * num + val5 * num2; float num3 = (Input.GetKey((KeyCode)32) ? 1f : 0f) - ((Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)99)) ? 1f : 0f); float num4 = (Input.GetKey((KeyCode)304) ? 30f : 15f); Vector3 val7 = (((((Vector3)(ref val6)).sqrMagnitude > 1f) ? ((Vector3)(ref val6)).normalized : val6) + Vector3.up * num3) * num4; foreach (Rigidbody key in _flightBodies.Keys) { if (!((Object)(object)key == (Object)null)) { key.useGravity = false; if (key.isKinematic) { Transform transform = ((Component)key).transform; transform.position += val7 * Time.fixedUnscaledDeltaTime; } else { key.linearVelocity = val7; key.angularVelocity = Vector3.zero; } } } if ((Object)(object)localCharacter.data.currentItem != (Object)null && (Object)(object)localCharacter.data.currentItem.rig != (Object)null) { Rigidbody rig = localCharacter.data.currentItem.rig; if (!_flightBodies.ContainsKey(rig)) { rig.useGravity = false; if (rig.isKinematic) { Transform transform2 = ((Component)rig).transform; transform2.position += val7 * Time.fixedUnscaledDeltaTime; } else { rig.linearVelocity = val7; } } } _flightLastSafeCenter = localCharacter.Center; } private void TryGenerate() { if (_generationStarted && _segments.Count > 0) { return; } MapHandler val = Object.FindAnyObjectByType(); if ((Object)(object)val == (Object)null || ((Object)val).GetInstanceID() == _builtMapId) { return; } if (typeof(MapHandler).GetField("segments", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val) is Array { Length: >=6 } array) { if (++_stableFrames >= 30) { _builtMapId = ((Object)val).GetInstanceID(); if (!_generationStarted) { _generationStarted = true; ((MonoBehaviour)this).StartCoroutine(GenerateAllBiomes(val, array)); } } } else { _stableFrames = 0; } } private IEnumerator GenerateAllBiomes(MapHandler map, Array vanilla) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Generator start"); Scene mainScene = ((Component)map).gameObject.scene; BiomeAsset[] definitions = new BiomeAsset[10] { new BiomeAsset("Shore", (BiomeType)0, "Beach_Segment", 4, "WilIsland", "Biome_1", "Beach"), new BiomeAsset("Tropics", (BiomeType)1, "Jungle_Segment", 6, "Level_1", "Biome_2", "Tropics"), new BiomeAsset("Roots", (BiomeType)7, "Roots Segment", 5, "Level_0", "Biome_2", "Roots"), new BiomeAsset("Alpine", (BiomeType)2, "Snow_Segment", 6, "Level_1", "Biome_3", "Alpine"), new BiomeAsset("Mesa", (BiomeType)6, "Desert_Segment", 5, "Level_0", "Biome_3", "Mesa"), new BiomeAsset("Gloom", (BiomeType)8, "Swamp_Segment", 4, "WilIsland", "Biome_4", "Gloom"), new BiomeAsset("Caldera", (BiomeType)3, "Caldera_Segment", 4, "WilIsland", "Biome_4", "Caldera", "Volcano"), new BiomeAsset("The Kiln", (BiomeType)3, "Volcano_Segment", 4, "WilIsland", "Biome_4", "Caldera", "Volcano"), new BiomeAsset("The Citadel", (BiomeType)8, "Temple_Segment", 4, "WilIsland", "Biome_4", "Gloom"), new BiomeAsset("Peak", (BiomeType)5, "Peak", 4, "WilIsland", "Biome_4", "Gloom", "Temple_Segment") }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Public biome | BiomeType | Root GameObject | Donor scene"); BiomeAsset[] array = definitions; foreach (BiomeAsset biomeAsset in array) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] " + biomeAsset.Name.PadRight(11) + " type=" + ((object)biomeAsset.BiomeType/*cast due to .constrained prefix*/).ToString() + " root=" + biomeAsset.RootName + " donor=" + biomeAsset.DonorName)); } GameObject runtimeRoot = (_runtimeRoot = new GameObject("AllBiomes Runtime Mountain")); SceneManager.MoveGameObjectToScene(runtimeRoot, mainScene); runtimeRoot.SetActive(false); Dictionary clonesByName = new Dictionary(); BiomeAsset[] wanted = Array.FindAll(definitions, (BiomeAsset d) => d.Name != "Peak"); Dictionary selections = new Dictionary(); Dictionary hostLayout = null; bool isNetworkClient = PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient; if (isNetworkClient) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Client waiting for host donor plan"); string encodedPlan = null; float deadline = Time.realtimeSinceStartup + 120f; while (Time.realtimeSinceStartup < deadline) { if (PhotonNetwork.CurrentRoom != null && ((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"ALLBIOMES_PLAN_0205", out object value)) { encodedPlan = value as string; } if (!string.IsNullOrEmpty(encodedPlan)) { break; } yield return null; } if (!TryParseNetworkPlan(encodedPlan, wanted, selections, out _runId)) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Client cannot build: missing/invalid host plan. All players must use AllBiomes 0.20.6"); Object.Destroy((Object)(object)runtimeRoot); ResetGenerationForRetry("client host plan unavailable"); yield break; } foreach (int donorIndex in UniqueDonors(selections)) { BiomeAsset[] selectedDefinitions = Array.FindAll(wanted, (BiomeAsset d) => selections[d.Name].BuildIndex == donorIndex); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Client loading host-selected buildIndex=" + donorIndex)); Dictionary actual = new Dictionary(); yield return ((MonoBehaviour)this).StartCoroutine(LoadDonor(mainScene, runtimeRoot, donorIndex, selectedDefinitions, clonesByName, actual)); array = selectedDefinitions; foreach (BiomeAsset biomeAsset2 in array) { if (!actual.TryGetValue(biomeAsset2.Name, out var value2) || value2.Renderers != selections[biomeAsset2.Name].Renderers || value2.Colliders != selections[biomeAsset2.Name].Colliders) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] ASSET COUNT DIFFERENCE " + biomeAsset2.Name + " host=" + selections[biomeAsset2.Name]?.ToString() + " client=" + ((value2 == null) ? "missing" : value2.ToString()) + ". Continuing with local geometry; transforms remain deterministic.")); } } } BiomeAsset[] array2 = Array.FindAll(wanted, (BiomeAsset d) => !clonesByName.ContainsKey(d.Name) || (Object)(object)clonesByName[d.Name] == (Object)null); if (array2.Length != 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Client exact-donor retry for missing roots: " + string.Join(", ", Array.ConvertAll(array2, (BiomeAsset d) => d.Name)))); foreach (int donorIndex2 in UniqueDonors(selections)) { array2 = Array.FindAll(wanted, (BiomeAsset d) => (!clonesByName.ContainsKey(d.Name) || (Object)(object)clonesByName[d.Name] == (Object)null) && selections[d.Name].BuildIndex == donorIndex2); if (array2.Length != 0) { Dictionary selections2 = new Dictionary(); yield return ((MonoBehaviour)this).StartCoroutine(LoadDonor(mainScene, runtimeRoot, donorIndex2, array2, clonesByName, selections2)); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Client waiting for host final segment layout run=" + _runId)); string encodedLayout = null; deadline = Time.realtimeSinceStartup + 120f; while (Time.realtimeSinceStartup < deadline) { if (PhotonNetwork.CurrentRoom != null && ((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"ALLBIOMES_LAYOUT_0205", out object value3)) { encodedLayout = value3 as string; } if (TryParseNetworkLayout(encodedLayout, definitions, _runId, out hostLayout)) { break; } yield return null; } if (hostLayout == null) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Client cannot build: host final segment layout unavailable run=" + _runId)); Object.Destroy((Object)(object)runtimeRoot); ResetGenerationForRetry("host final layout unavailable"); yield break; } } else { if (_startNewRun || string.IsNullOrEmpty(_runId) || _runId == "offline") { _runId = Guid.NewGuid().ToString("N").Substring(0, 12); } _startNewRun = false; if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = new Hashtable(); ((Dictionary)val).Add((object)"ALLBIOMES_PLAN_0205", (object)string.Empty); ((Dictionary)val).Add((object)"ALLBIOMES_LAYOUT_0205", (object)string.Empty); currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } int[] array3 = new int[10] { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; for (int num = 0; num < array3.Length; num++) { int donorIndex3 = array3[num]; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Host discovery buildIndex=" + donorIndex3 + " comparing populated variants")); yield return ((MonoBehaviour)this).StartCoroutine(LoadDonor(mainScene, runtimeRoot, donorIndex3, wanted, clonesByName, selections)); if (HasFullyPopulatedSet(clonesByName)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] All biome population thresholds reached; stopping Level_X scan at buildIndex=" + donorIndex3)); break; } } if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { string text = EncodeNetworkPlan(wanted, selections); Room currentRoom2 = PhotonNetwork.CurrentRoom; Hashtable val2 = new Hashtable(); ((Dictionary)val2).Add((object)"ALLBIOMES_PLAN_0205", (object)text); currentRoom2.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Host published donor plan: " + text)); } } array = wanted; foreach (BiomeAsset biomeAsset3 in array) { if (!clonesByName.ContainsKey(biomeAsset3.Name)) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Dynamic discovery exhausted: missing " + biomeAsset3.Name)); Object.Destroy((Object)(object)runtimeRoot); ResetGenerationForRetry("missing biome " + biomeAsset3.Name); yield break; } } GameObject root = ResolvePeak(map).Root; if ((Object)(object)root == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Main-scene Peak root was not found"); Object.Destroy((Object)(object)runtimeRoot); ResetGenerationForRetry("main-scene Peak missing"); yield break; } root.transform.SetParent(runtimeRoot.transform, true); ((Object)root).name = "Peak [AllBiomes Peak]"; root.SetActive(false); List list = new List(); for (int num2 = 0; num2 < definitions.Length - 1; num2++) { list.Add(clonesByName[definitions[num2].Name]); } list.Add(root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Main-scene Peak detached without cloning; renderers=" + root.GetComponentsInChildren(true).Length + " colliders=" + root.GetComponentsInChildren(true).Length)); runtimeRoot.SetActive(true); try { BuildRuntimeMountain(map, vanilla, definitions, list, hostLayout); if (!isNetworkClient && PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { string text2 = EncodeNetworkLayout(_segments, _runId); Room currentRoom3 = PhotonNetwork.CurrentRoom; Hashtable val3 = new Hashtable(); ((Dictionary)val3).Add((object)"ALLBIOMES_LAYOUT_0205", (object)text2); currentRoom3.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Host published final segment layout: " + text2)); } PublishBuildReady(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Generator failed: " + ex)); ResetGenerationForRetry("generator exception"); } } private void ResetGenerationForRetry(string reason) { _builtMapId = 0; _stableFrames = 0; _generationStarted = false; ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Generation reset for retry: " + reason)); } private void MaintainRuntimeLifecycle() { Character localCharacter = Character.localCharacter; int num = ((!((Object)(object)localCharacter == (Object)null)) ? ((Object)localCharacter).GetInstanceID() : 0); if (num == _localCharacterId) { return; } int localCharacterId = _localCharacterId; _localCharacterId = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Local character lifecycle changed old=" + localCharacterId + " new=" + num)); EndFlight(); if (_flight && (Object)(object)localCharacter != (Object)null) { BeginFlight(localCharacter); } RuntimeCampfireAdapter[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (RuntimeCampfireAdapter runtimeCampfireAdapter in array) { if ((Object)(object)runtimeCampfireAdapter != (Object)null) { runtimeCampfireAdapter.RefreshAfterCharacterChange(); } } RuntimeLuggageAdapter[] array2 = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (RuntimeLuggageAdapter runtimeLuggageAdapter in array2) { if ((Object)(object)runtimeLuggageAdapter != (Object)null) { runtimeLuggageAdapter.RefreshAfterCharacterChange(); } } if (_segments.Count > 0) { DisableVanillaFogWalls(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Runtime state rebound after character respawn/reconnect"); } private bool HasFullyPopulatedSet(Dictionary clones) { foreach (KeyValuePair item in new Dictionary { { "Shore", 5000 }, { "Tropics", 5000 }, { "Roots", 3000 }, { "Alpine", 3000 }, { "Mesa", 5000 }, { "Gloom", 3000 }, { "Caldera", 1000 }, { "The Kiln", 1000 }, { "The Citadel", 100 } }) { if (!clones.TryGetValue(item.Key, out var value) || (Object)(object)value == (Object)null) { return false; } int num = value.GetComponentsInChildren(true).Length; if (num < item.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Population threshold pending " + item.Key + " renderers=" + num + " required=" + item.Value)); return false; } } return true; } private IEnumerator LoadDonor(Scene mainScene, GameObject runtimeRoot, int buildIndex, BiomeAsset[] definitions, Dictionary clones, Dictionary selections) { //IL_000e: 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) ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Loading donor " + definitions[0].DonorName + " buildIndex=" + buildIndex)); HashSet scenesBeforeLoad = new HashSet(); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); scenesBeforeLoad.Add(SceneHandle.op_Implicit(((Scene)(ref sceneAt)).handle)); } _pendingStaticSnapshot = CaptureStaticReferences(); _pendingDonorBuildIndex = buildIndex; LifecycleBlockedBuildIndex = buildIndex; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Protected main runtime references=" + _pendingStaticSnapshot.Count)); AsyncOperation load; try { load = SceneManager.LoadSceneAsync(buildIndex, (LoadSceneMode)1); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Donor load call failed: " + ex)); yield break; } if (load == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Donor LoadSceneAsync returned null"); yield break; } while (!load.isDone) { yield return null; } Scene val = default(Scene); for (int j = 0; j < SceneManager.sceneCount; j++) { Scene sceneAt2 = SceneManager.GetSceneAt(j); if (((Scene)(ref sceneAt2)).buildIndex == buildIndex && !scenesBeforeLoad.Contains(SceneHandle.op_Implicit(((Scene)(ref sceneAt2)).handle))) { val = sceneAt2; break; } } if (!((Scene)(ref val)).IsValid() || !((Scene)(ref val)).isLoaded) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Newly loaded additive donor unavailable buildIndex=" + buildIndex + "; main scene will not be touched")); yield break; } if (((Scene)(ref val)).handle == ((Scene)(ref mainScene)).handle) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Refusing to use/unload main scene as donor"); yield break; } RestoreStaticReferences(_pendingStaticSnapshot, "after donor load"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor loaded name=" + ((Scene)(ref val)).name + " path=" + ((Scene)(ref val)).path + " roots=" + ((Scene)(ref val)).rootCount)); BiomeAsset[] array = definitions; foreach (BiomeAsset biomeAsset in array) { GameObject val2 = FindSceneObject(val, biomeAsset); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] " + biomeAsset.Name + ": not present in donor=" + ((Scene)(ref val)).name)); continue; } Bounds val3; try { val3 = BoundsOf(val2); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] " + biomeAsset.Name + " bounds failed: " + ex2)); continue; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Found " + biomeAsset.Name + " path=" + PathOf(val2.transform) + " renderers=" + val2.GetComponentsInChildren(true).Length + " colliders=" + val2.GetComponentsInChildren(true).Length + " bounds=" + ((object)((Bounds)(ref val3)).size/*cast due to .constrained prefix*/).ToString())); if (biomeAsset.Name == "Caldera") { LogCalderaBranches(val2); } if (biomeAsset.Name == "The Kiln") { LogKilnGeometryAndPeakCandidates(val, val2); } GameObject val4 = ResolveBiomeContainer(val2, biomeAsset.Name); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Container " + biomeAsset.Name + " path=" + PathOf(val4.transform))); if (biomeAsset.Name == "The Kiln") { ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[14] { "[AllBiomes] KILN ORIGINAL TRANSFORM container position=", ((object)val4.transform.position/*cast due to .constrained prefix*/).ToString(), " rotation=", null, null, null, null, null, null, null, null, null, null, null }; Quaternion rotation = val4.transform.rotation; obj[3] = ((object)((Quaternion)(ref rotation)).eulerAngles/*cast due to .constrained prefix*/).ToString(); obj[4] = " scale="; obj[5] = ((object)val4.transform.lossyScale/*cast due to .constrained prefix*/).ToString(); obj[6] = " interior position="; obj[7] = ((object)val2.transform.position/*cast due to .constrained prefix*/).ToString(); obj[8] = " rotation="; rotation = val2.transform.rotation; obj[9] = ((object)((Quaternion)(ref rotation)).eulerAngles/*cast due to .constrained prefix*/).ToString(); obj[10] = " scale="; obj[11] = ((object)val2.transform.lossyScale/*cast due to .constrained prefix*/).ToString(); obj[12] = " upDot="; obj[13] = Vector3.Dot(val2.transform.up, Vector3.up).ToString(); logger.LogWarning((object)string.Concat(obj)); } GameObject val5 = Object.Instantiate(val4, runtimeRoot.transform, true); ((Object)val5).name = biomeAsset.RootName + " [AllBiomes " + biomeAsset.Name + "]"; val5.SetActive(false); if (biomeAsset.Name == "The Citadel") { AttachCitadelExterior(val2, val5); } PruneAlternativeGeometry(val5, biomeAsset.Name); if (biomeAsset.Name == "The Kiln") { PrepareVolcanoExterior(val5); CreateVolcanoVisualShell(val5); } AttachSerializedAnchors(val, val2, val5, biomeAsset.Name); SanitizeDonorClone(val5, biomeAsset.Name); int num = val5.GetComponentsInChildren(true).Length; int num2 = val5.GetComponentsInChildren(true).Length; long num3 = (long)num * 4L + num2; if (clones.TryGetValue(biomeAsset.Name, out var value) && (Object)(object)value != (Object)null) { int num4 = value.GetComponentsInChildren(true).Length; int num5 = value.GetComponentsInChildren(true).Length; long num6 = (long)num4 * 4L + num5; if (num6 >= num3) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Candidate rejected " + biomeAsset.Name + " score=" + num3 + " best=" + num6 + " donor=" + ((Scene)(ref val)).name)); Object.DestroyImmediate((Object)(object)val5); continue; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Better populated variant " + biomeAsset.Name + " old=" + num6 + " new=" + num3 + " donor=" + ((Scene)(ref val)).name)); Object.DestroyImmediate((Object)(object)value); } clones[biomeAsset.Name] = val5; selections[biomeAsset.Name] = new DonorSelection(buildIndex, num, num2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Best clone updated " + biomeAsset.Name + " renderers=" + num + " colliders=" + num2 + " score=" + num3)); } CleanDonorPhotonViews(val); AsyncOperation unload = SceneManager.UnloadSceneAsync(val); if (unload != null) { while (!unload.isDone) { yield return null; } } RestoreStaticReferences(_pendingStaticSnapshot, "after donor unload"); _pendingStaticSnapshot = null; _pendingDonorBuildIndex = -1; LifecycleBlockedBuildIndex = -1; yield return null; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor unloaded " + definitions[0].DonorName)); array = definitions; foreach (BiomeAsset biomeAsset2 in array) { if (!clones.TryGetValue(biomeAsset2.Name, out var value2) || (Object)(object)value2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] No clone from this donor: " + biomeAsset2.Name)); continue; } int num7 = value2.GetComponentsInChildren(true).Length; int num8 = value2.GetComponentsInChildren(true).Length; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Clone survived " + biomeAsset2.Name + " renderers=" + num7 + " colliders=" + num8)); if (num7 == 0 || num8 == 0) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Clone has incomplete geometry: " + biomeAsset2.Name)); } } } private void CleanDonorPhotonViews(Scene donor) { if (!((Scene)(ref donor)).IsValid() || !((Scene)(ref donor)).isLoaded) { return; } int num = 0; int num2 = 0; GameObject[] rootGameObjects = ((Scene)(ref donor)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { PhotonView[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); foreach (PhotonView val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } num++; try { if (val.ViewID != 0 && (Object)(object)PhotonNetwork.GetPhotonView(val.ViewID) == (Object)(object)val) { PhotonNetwork.LocalCleanPhotonView(val); num2++; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Donor PhotonView cleanup failed scene=" + ((Scene)(ref donor)).name + " viewID=" + val.ViewID + " path=" + PathOf(((Component)val).transform) + ": " + ex)); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor PhotonViews cleaned scene=" + ((Scene)(ref donor)).name + " found=" + num + " unregistered=" + num2)); } private string EncodeNetworkPlan(BiomeAsset[] definitions, Dictionary selections) { List list = new List { "0.20.6", Application.version, _runId }; foreach (BiomeAsset biomeAsset in definitions) { if (selections.TryGetValue(biomeAsset.Name, out var value)) { list.Add(biomeAsset.Name + "=" + value.BuildIndex + "," + value.Renderers + "," + value.Colliders); } } return string.Join(";", list); } private bool TryParseNetworkPlan(string plan, BiomeAsset[] definitions, Dictionary result, out string runId) { runId = null; if (string.IsNullOrEmpty(plan)) { return false; } string[] array = plan.Split(';'); if (array.Length < 3 || array[0] != "0.20.6" || array[1] != Application.version || string.IsNullOrEmpty(array[2])) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Plan version mismatch host=" + plan + " localMod=0.20.6 localGame=" + Application.version)); return false; } runId = array[2]; for (int i = 3; i < array.Length; i++) { int num = array[i].IndexOf('='); if (num > 0) { string[] array2 = array[i].Substring(num + 1).Split(','); if (array2.Length == 3 && int.TryParse(array2[0], out var result2) && int.TryParse(array2[1], out var result3) && int.TryParse(array2[2], out var result4)) { result[array[i].Substring(0, num)] = new DonorSelection(result2, result3, result4); } } } foreach (BiomeAsset biomeAsset in definitions) { if (!result.ContainsKey(biomeAsset.Name)) { return false; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Accepted host donor plan: " + plan)); return true; } private static string EncodeNetworkLayout(List segments, string runId) { //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_0053: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00b7: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) List list = new List { "0.20.6", Application.version, runId }; foreach (RuntimeSegment segment in segments) { Vector3 position = segment.Root.transform.position; Quaternion rotation = segment.Root.transform.rotation; list.Add(segment.Name + "=" + F(position.x) + "," + F(position.y) + "," + F(position.z) + "," + F(rotation.x) + "," + F(rotation.y) + "," + F(rotation.z) + "," + F(rotation.w)); } return string.Join(";", list); } private static bool TryParseNetworkLayout(string encoded, BiomeAsset[] definitions, string runId, out Dictionary result) { //IL_00e3: 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) result = null; if (string.IsNullOrEmpty(encoded)) { return false; } string[] array = encoded.Split(';'); if (array.Length < 3 || array[0] != "0.20.6" || array[1] != Application.version || array[2] != runId) { return false; } Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int i = 3; i < array.Length; i++) { int num = array[i].IndexOf('='); if (num <= 0) { continue; } string[] array2 = array[i].Substring(num + 1).Split(','); if (array2.Length == 7) { float[] array3 = new float[7]; bool flag = true; for (int j = 0; j < array3.Length; j++) { flag &= float.TryParse(array2[j], NumberStyles.Float, CultureInfo.InvariantCulture, out array3[j]); } if (flag) { dictionary[array[i].Substring(0, num)] = new SegmentPose(new Vector3(array3[0], array3[1], array3[2]), new Quaternion(array3[3], array3[4], array3[5], array3[6])); } } } foreach (BiomeAsset biomeAsset in definitions) { if (!dictionary.ContainsKey(biomeAsset.Name)) { return false; } } result = dictionary; return true; } private static string F(float value) { return value.ToString("R", CultureInfo.InvariantCulture); } private void PublishBuildReady() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Expected O, but got Unknown string text = EncodeNetworkLayout(_segments, _runId); uint num = 2166136261u; for (int i = 0; i < text.Length; i++) { num = (num ^ text[i]) * 16777619; } string text2 = num.ToString("X8", CultureInfo.InvariantCulture) + ":" + _segments.Count; if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && PhotonNetwork.LocalPlayer != null) { string key = "ABREADY_" + _runId + "_" + PhotonNetwork.LocalPlayer.ActorNumber; Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = new Hashtable(); ((Dictionary)val).Add((object)key, (object)text2); currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] BUILD_READY run=" + _runId + " fingerprint=" + text2 + " actor=" + ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0))); } private static IEnumerable UniqueDonors(Dictionary selections) { HashSet seen = new HashSet(); foreach (DonorSelection value in selections.Values) { if (seen.Add(value.BuildIndex)) { yield return value.BuildIndex; } } } private void AttachSerializedAnchors(Scene donor, GameObject source, GameObject clone, string biomeName) { //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) MapHandler val = null; GameObject[] rootGameObjects = ((Scene)(ref donor)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { val = rootGameObjects[i].GetComponentInChildren(true); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Serialized anchors " + biomeName + ": donor MapHandler missing")); } else { if (!(typeof(MapHandler).GetField("segments", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val) is Array array)) { return; } for (int j = 0; j < array.Length; j++) { object value = array.GetValue(j); if (value == null) { continue; } Type type = value.GetType(); object? obj = type.GetProperty("segmentParent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null); GameObject val2 = (GameObject)(((obj is GameObject) ? obj : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 != (Object)(object)source)) { object? obj2 = type.GetField("reconnectSpawnPos", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); Transform val3 = (Transform)((obj2 is Transform) ? obj2 : null); object? obj3 = type.GetField("wallNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); GameObject val4 = (GameObject)((obj3 is GameObject) ? obj3 : null); if ((Object)(object)val3 != (Object)null) { CreateAnchorMarker(clone, "AllBiomes_Entrance", val3.position); } if ((Object)(object)val4 != (Object)null) { CreateAnchorMarker(clone, "AllBiomes_Exit", val4.transform.position); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Serialized anchors " + biomeName + " segment=" + j + " entrance=" + (((Object)(object)val3 == (Object)null) ? "" : ((object)val3.position/*cast due to .constrained prefix*/).ToString()) + " exit=" + (((Object)(object)val4 == (Object)null) ? "" : ((object)val4.transform.position/*cast due to .constrained prefix*/).ToString()))); return; } } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Serialized anchors " + biomeName + ": matching MapSegment missing")); } } private static void CreateAnchorMarker(GameObject clone, string markerName, Vector3 worldPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(markerName); val.transform.SetParent(clone.transform, false); val.transform.position = worldPosition; } private static GameObject ResolveBiomeContainer(GameObject source, string biomeName) { if ((Object)(object)source == (Object)null || (Object)(object)source.transform.parent == (Object)null) { return source; } switch (biomeName) { case "The Kiln": return ((Component)source.transform.parent).gameObject; case "Caldera": case "The Citadel": return source; default: return ((Component)source.transform.parent).gameObject; } } private void AttachCitadelExterior(GameObject templeInterior, GameObject citadelClone) { if ((Object)(object)templeInterior == (Object)null || (Object)(object)templeInterior.transform.parent == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Citadel exterior attach failed: Temple_Segment parent missing"); return; } Transform val = templeInterior.transform.parent.Find("Gloom Temple"); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Citadel exterior attach failed: sibling Gloom Temple missing at " + PathOf(templeInterior.transform.parent))); return; } GameObject val2 = Object.Instantiate(((Component)val).gameObject, citadelClone.transform, true); ((Object)val2).name = "Gloom Temple [AllBiomes Citadel Exterior]"; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Citadel exterior attached path=" + PathOf(val) + " renderers=" + val2.GetComponentsInChildren(true).Length + " colliders=" + val2.GetComponentsInChildren(true).Length)); } private void AttachVolcanoExterior(GameObject volcanoInterior, GameObject volcanoClone) { if ((Object)(object)volcanoInterior == (Object)null || (Object)(object)volcanoInterior.transform.parent == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Volcano exterior attach failed: Volcano_Segment parent missing"); return; } Transform parent = volcanoInterior.transform.parent; GameObject val = Object.Instantiate(((Component)parent).gameObject, volcanoClone.transform, true); ((Object)val).name = "Volcano Exterior Shell [AllBiomes]"; int num = 0; Transform[] componentsInChildren = val.GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val.transform) && (((Object)val2).name.IndexOf("Caldera_Segment", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)val2).name.IndexOf("Volcano_Segment", StringComparison.OrdinalIgnoreCase) >= 0)) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); num++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Volcano exterior shell attached parent=" + PathOf(parent) + " removedSegments=" + num + " renderers=" + val.GetComponentsInChildren(true).Length + " colliders=" + val.GetComponentsInChildren(true).Length)); } private void LogCalderaBranches(GameObject caldera) { //IL_0070: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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) ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Caldera direct branches=" + caldera.transform.childCount)); for (int i = 0; i < caldera.transform.childCount; i++) { Transform child = caldera.transform.GetChild(i); if ((Object)(object)child == (Object)null) { continue; } try { int num = ((Component)child).GetComponentsInChildren(true).Length; int num2 = ((Component)child).GetComponentsInChildren(true).Length; if (num != 0 || num2 != 0) { Bounds val = BoundsOf(((Component)child).gameObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Caldera branch name=" + ((Object)child).name + " active=" + ((Component)child).gameObject.activeSelf + " renderers=" + num + " colliders=" + num2 + " center=" + ((object)((Bounds)(ref val)).center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)((Bounds)(ref val)).size/*cast due to .constrained prefix*/).ToString())); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Caldera branch has no physical bounds " + ((Object)child).name + ": " + ex.Message)); } } } private void LogKilnGeometryAndPeakCandidates(Scene donor, GameObject kiln) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Kiln direct branches=" + kiln.transform.childCount)); for (int i = 0; i < kiln.transform.childCount; i++) { Transform child = kiln.transform.GetChild(i); if (!((Object)(object)child == (Object)null)) { int num = ((Component)child).GetComponentsInChildren(true).Length; int num2 = ((Component)child).GetComponentsInChildren(true).Length; try { Bounds val = BoundsOf(((Component)child).gameObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Kiln branch name=" + ((Object)child).name + " active=" + ((Component)child).gameObject.activeSelf + " renderers=" + num + " colliders=" + num2 + " center=" + ((object)((Bounds)(ref val)).center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)((Bounds)(ref val)).size/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Kiln branch bounds unavailable name=" + ((Object)child).name + " renderers=" + num + " colliders=" + num2 + " reason=" + ex.Message)); } } } List list = new List(kiln.GetComponentsInChildren(true)); list.RemoveAll((Renderer renderer) => (Object)(object)renderer == (Object)null || renderer is ParticleSystemRenderer); list.Sort(delegate(Renderer a, Renderer b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_001a: 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_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) Bounds bounds2 = b.bounds; Vector3 size = ((Bounds)(ref bounds2)).size; float sqrMagnitude = ((Vector3)(ref size)).sqrMagnitude; bounds2 = a.bounds; size = ((Bounds)(ref bounds2)).size; return sqrMagnitude.CompareTo(((Vector3)(ref size)).sqrMagnitude); }); for (int num3 = 0; num3 < Mathf.Min(24, list.Count); num3++) { Renderer val2 = list[num3]; string text = ((val2.sharedMaterials == null) ? "" : string.Join(",", Array.ConvertAll(val2.sharedMaterials, (Material material) => (!((Object)(object)material == (Object)null)) ? ((Object)material).name : ""))); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[14] { "[AllBiomes] Kiln large renderer ", num3.ToString(), " path=", PathOf(((Component)val2).transform), " active=", ((Component)val2).gameObject.activeInHierarchy.ToString(), " enabled=", val2.enabled.ToString(), " center=", null, null, null, null, null }; Bounds bounds = val2.bounds; obj[9] = ((object)((Bounds)(ref bounds)).center/*cast due to .constrained prefix*/).ToString(); obj[10] = " size="; bounds = val2.bounds; obj[11] = ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString(); obj[12] = " materials="; obj[13] = text; logger.LogInfo((object)string.Concat(obj)); } GameObject[] rootGameObjects = ((Scene)(ref donor)).GetRootGameObjects(); for (int num4 = 0; num4 < rootGameObjects.Length; num4++) { Transform[] componentsInChildren = rootGameObjects[num4].GetComponentsInChildren(true); foreach (Transform val3 in componentsInChildren) { if ((Object)(object)val3 == (Object)null || !string.Equals(((Object)val3).name, "Peak", StringComparison.OrdinalIgnoreCase)) { continue; } int num6 = ((Component)val3).GetComponentsInChildren(true).Length; if (num6 != 0) { try { Bounds val4 = BoundsOf(((Component)val3).gameObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor Peak candidate path=" + PathOf(val3) + " active=" + ((Component)val3).gameObject.activeSelf + " renderers=" + num6 + " colliders=" + ((Component)val3).GetComponentsInChildren(true).Length + " center=" + ((object)((Bounds)(ref val4)).center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)((Bounds)(ref val4)).size/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Donor Peak candidate bounds unavailable path=" + PathOf(val3) + " reason=" + ex2.Message)); } } } } } private void PrepareVolcanoExterior(GameObject volcanoClone) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) Transform val = FindDescendant(volcanoClone.transform, "Volcano_Segment"); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Volcano exterior activation failed: Volcano_Segment missing"); return; } int num = 0; int num2 = 0; Renderer[] componentsInChildren = volcanoClone.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null || val2 is ParticleSystemRenderer || ((Component)val2).transform.IsChildOf(val)) { continue; } Transform val3 = ((Component)val2).transform; while ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)volcanoClone.transform) { if (!((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(true); } val3 = val3.parent; } val2.enabled = true; num++; string text = ((val2.sharedMaterials == null) ? "" : string.Join(",", Array.ConvertAll(val2.sharedMaterials, (Material material) => (!((Object)(object)material == (Object)null)) ? ((Object)material).name : ""))); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[6] { "[AllBiomes] Volcano exterior renderer path=", PathOf(((Component)val2).transform), " bounds=", null, null, null }; Bounds bounds = val2.bounds; obj[3] = ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString(); obj[4] = " materials="; obj[5] = text; logger.LogInfo((object)string.Concat(obj)); } Collider[] componentsInChildren2 = volcanoClone.GetComponentsInChildren(true); foreach (Collider val4 in componentsInChildren2) { if ((Object)(object)val4 == (Object)null || ((Component)val4).transform.IsChildOf(val)) { continue; } Transform val5 = ((Component)val4).transform; while ((Object)(object)val5 != (Object)null && (Object)(object)val5 != (Object)(object)volcanoClone.transform) { if (!((Component)val5).gameObject.activeSelf) { ((Component)val5).gameObject.SetActive(true); } val5 = val5.parent; } val4.enabled = true; num2++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Volcano exterior forced active renderers=" + num + " colliders=" + num2)); } private unsafe void CreateVolcanoVisualShell(GameObject volcanoClone) { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c4: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) Transform val = FindDescendant(volcanoClone.transform, "Volcano_Segment"); Transform val2 = (((Object)(object)val == (Object)null) ? null : val.Find("Middle")); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Volcano visual shell failed: Volcano_Segment/Middle missing"); return; } MeshRenderer val3 = null; float num = float.PositiveInfinity; MeshRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); Bounds val5; foreach (MeshRenderer val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)null || (Object)(object)((Component)val4).GetComponent() == (Object)null || (((Object)(object)((Renderer)val4).sharedMaterial == (Object)null) ? string.Empty : ((Object)((Renderer)val4).sharedMaterial).name).IndexOf("Rock_Volcano", StringComparison.OrdinalIgnoreCase) < 0) { continue; } val5 = ((Renderer)val4).bounds; Vector3 size = ((Bounds)(ref val5)).size; float num2 = Mathf.Max(size.x, Mathf.Max(size.y, size.z)); if (!(num2 < 8f) && !(num2 > 45f)) { float num3 = Mathf.Abs(num2 - 20f); if (num3 < num) { num = num3; val3 = val4; } } } if ((Object)(object)val3 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Volcano visual shell failed: suitable vanilla volcanic rock mesh missing"); return; } GameObject val6 = new GameObject("AllBiomes Volcano Exterior Cone"); val6.transform.SetParent(val, false); Bounds val7 = BoundsOf(((Component)val2).gameObject); Vector3 val8 = val.InverseTransformPoint(((Bounds)(ref val7)).center); Transform val9 = val.Find("Bridge"); Bounds val10 = (((Object)(object)val9 == (Object)null) ? val7 : BoundsOf(((Component)val9).gameObject)); float y = val.InverseTransformPoint(new Vector3(((Bounds)(ref val7)).center.x, Mathf.Min(((Bounds)(ref val7)).min.y - 8f, ((Bounds)(ref val10)).min.y - 6f), ((Bounds)(ref val7)).center.z)).y; float y2 = val.InverseTransformPoint(new Vector3(((Bounds)(ref val7)).center.x, ((Bounds)(ref val7)).max.y + 8f, ((Bounds)(ref val7)).center.z)).y; Vector3 val11 = Vector3.back; if ((Object)(object)val9 != (Object)null) { val5 = BoundsOf(((Component)val9).gameObject); Vector3 center = ((Bounds)(ref val5)).center; val11 = val.InverseTransformDirection(center - ((Bounds)(ref val7)).center); val11.y = 0f; if (((Vector3)(ref val11)).sqrMagnitude > 0.001f) { ((Vector3)(ref val11)).Normalize(); } else { val11 = Vector3.back; } } int num4 = 0; Vector3 val12 = default(Vector3); for (int j = 0; j < 10; j++) { float num5 = (float)j / 9f; float num6 = Mathf.Lerp(y, y2, num5); float num7 = Mathf.Lerp(168f, 82f, Mathf.Pow(num5, 0.82f)); int num8 = Mathf.RoundToInt(Mathf.Lerp(14f, 8f, num5)); for (int k = 0; k < 2; k++) { for (int l = 0; l < num8; l++) { float num9 = (float)l * MathF.PI * 2f / (float)num8 + (float)j * 0.19f + (float)k * MathF.PI / (float)num8; ((Vector3)(ref val12))..ctor(Mathf.Sin(num9), 0f, Mathf.Cos(num9)); float num10 = Vector3.Angle(val12, val11); if (num5 < 0.32f && num10 < Mathf.Lerp(22f, 12f, num5 / 0.32f)) { continue; } GameObject val13 = Object.Instantiate(((Component)val3).gameObject, val6.transform, false); ((Object)val13).name = "ExteriorRock_" + k + "_" + j + "_" + l; float num11 = Mathf.Sin((float)(j + 1) * 17.17f + (float)l * 9.31f + (float)k * 4.73f); float num12 = Mathf.Min(y2, num6 + (float)k * (y2 - y) / 9f * 0.38f); float num13 = num7 - (float)k * 14f; val13.transform.localPosition = new Vector3(val8.x, num12, val8.z) + val12 * (num13 + num11 * 5f); val13.transform.localRotation = Quaternion.Euler(num11 * 16f, num9 * 57.29578f + 90f, Mathf.Lerp(-28f, -8f, num5) * Mathf.Sign((num11 == 0f) ? 1f : num11)); float num14 = Mathf.Lerp((k == 0) ? 4.2f : 3.8f, (k == 0) ? 2.8f : 2.55f, num5) * (1f + num11 * 0.08f); val13.transform.localScale = ((Component)val3).transform.localScale * num14; Collider[] componentsInChildren2 = val13.GetComponentsInChildren(true); foreach (Collider val14 in componentsInChildren2) { if ((Object)(object)val14 != (Object)null) { Object.DestroyImmediate((Object)(object)val14); } } MonoBehaviour[] componentsInChildren3 = val13.GetComponentsInChildren(true); foreach (MonoBehaviour val15 in componentsInChildren3) { if ((Object)(object)val15 != (Object)null) { Object.DestroyImmediate((Object)(object)val15); } } val13.SetActive(true); num4++; } } } try { StaticBatchingUtility.Combine(val6); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Volcano exterior static batching complete rocks=" + num4)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Volcano static batching skipped: " + ex.Message)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Volcano exterior cone built from vanilla rocks rings=" + 10 + " rocks=" + num4 + " entranceDirection=" + ((object)(*(Vector3*)(&val11))/*cast due to .constrained prefix*/).ToString() + " renderers=" + val6.GetComponentsInChildren(true).Length + " colliders=" + val6.GetComponentsInChildren(true).Length)); } private void PruneAlternativeGeometry(GameObject clone, string biomeName) { string[] array = biomeName switch { "The Citadel" => new string[1] { "Peak" }, "The Kiln" => new string[2] { "Caldera_Segment", "Peak" }, "Gloom" => new string[4] { "Temple_Segment", "Gloom Temple", "Peak", "BG Rocks" }, _ => Array.Empty(), }; int num = 0; Transform[] componentsInChildren = clone.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)clone.transform) && Array.IndexOf(array, ((Object)val).name) >= 0) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); num++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Pruned " + biomeName + " alternative roots=" + num)); } private void InstallDonorLifecycleProtection() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown HarmonyMethod val = new HarmonyMethod(typeof(DonorLifecycleGuard).GetMethod("Prefix", BindingFlags.Static | BindingFlags.Public)); int num = 0; HashSet hashSet = new HashSet(StringComparer.Ordinal) { "Awake", "OnEnable", "Start", "OnDisable", "OnDestroy" }; foreach (Assembly item in new HashSet { typeof(MapHandler).Assembly, typeof(PhotonView).Assembly, typeof(Singleton<>).Assembly }) { Type[] types; try { types = item.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } Type[] array = types; foreach (Type type in array) { if (type == null || !typeof(MonoBehaviour).IsAssignableFrom(type)) { continue; } MethodInfo[] methods; try { methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } catch { continue; } MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { if (hashSet.Contains(methodInfo.Name) && !methodInfo.IsAbstract && !methodInfo.ContainsGenericParameters && !(methodInfo.ReturnType != typeof(void)) && methodInfo.GetParameters().Length == 0) { try { _harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Lifecycle patch skipped " + type.FullName + "." + methodInfo.Name + ": " + ex2.Message)); } } } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor lifecycle methods protected=" + num)); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if ((int)mode == 0) { ((MonoBehaviour)this).StopAllCoroutines(); CleanupRuntimeForSceneChange(scene); _startNewRun = true; _abandonedDonorBuildIndices.Clear(); if (_pendingDonorBuildIndex >= 0) { _abandonedDonorBuildIndices.Add(_pendingDonorBuildIndex); } _builtMapId = 0; _stableFrames = 0; _generationStarted = false; _teleportIndex = -1; _localCharacterId = 0; _fogHandlerId = 0; _fogStateSegment = -1; _segments.Clear(); _pendingStaticSnapshot = null; _pendingDonorBuildIndex = -1; LifecycleBlockedBuildIndex = -1; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Main scene changed to " + ((Scene)(ref scene)).name + "; runtime generator state reset for respawn/new run")); ((MonoBehaviour)this).StartCoroutine(UnloadStrayDonorScenes(scene)); } else if ((int)mode == 1 && _abandonedDonorBuildIndices.Contains(((Scene)(ref scene)).buildIndex)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Abandoned donor completed after scene change; unloading scene=" + ((Scene)(ref scene)).name + " buildIndex=" + ((Scene)(ref scene)).buildIndex)); QuarantineScene(scene); CleanDonorPhotonViews(scene); ((MonoBehaviour)this).StartCoroutine(UnloadAbandonedDonor(scene)); } else if ((int)mode == 1 && ((Scene)(ref scene)).buildIndex == _pendingDonorBuildIndex) { try { int num = QuarantineScene(scene); RestoreStaticReferences(_pendingStaticSnapshot, "sceneLoaded quarantine"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Donor quarantined before Start: scene=" + ((Scene)(ref scene)).name + " scripts=" + num)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Donor quarantine failed: " + ex)); } } } private int QuarantineScene(Scene scene) { int num = 0; if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { return num; } GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { MonoBehaviour[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; num++; } } } return num; } private void CleanupRuntimeForSceneChange(Scene destination) { //IL_00e9: 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) try { EndFlight(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Flight cleanup during scene change: " + ex.Message)); } if ((Object)(object)_runtimeRoot != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Destroying previous runtime mountain before entering " + ((Scene)(ref destination)).name)); Object.Destroy((Object)(object)_runtimeRoot); _runtimeRoot = null; } int num = 0; Transform[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (Transform val in array) { if ((Object)(object)val == (Object)null || !IsAllBiomesObjectName(((Object)val).name)) { continue; } Transform parent = val.parent; bool flag = false; while ((Object)(object)parent != (Object)null) { if (IsAllBiomesObjectName(((Object)parent).name)) { flag = true; break; } parent = parent.parent; } if (!flag) { ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string name = ((Object)val).name; Scene scene = ((Component)val).gameObject.scene; logger.LogWarning((object)("[AllBiomes] Destroying leftover runtime object '" + name + "' scene=" + ((Scene)(ref scene)).name)); Object.Destroy((Object)(object)((Component)val).gameObject); num++; } } if (num > 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Leftover runtime objects destroyed=" + num)); } RuntimeTornadoRegistry.Clear(); Shader.SetGlobalFloat("GlobalWind", 0f); Shader.SetGlobalFloat("HeightFogSpirit", 0f); Shader.SetGlobalFloat("HeightFogAmount", 0f); _debugFogRoots.Clear(); } private static bool IsAllBiomesObjectName(string name) { if (string.IsNullOrEmpty(name)) { return false; } if (!name.StartsWith("AllBiomes ", StringComparison.Ordinal)) { return name.IndexOf("[AllBiomes ", StringComparison.Ordinal) >= 0; } return true; } private IEnumerator UnloadStrayDonorScenes(Scene destination) { //IL_000e: 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) for (int frame = 0; frame < 10; frame++) { yield return null; } for (int frame = SceneManager.sceneCount - 1; frame >= 0; frame--) { Scene candidate = SceneManager.GetSceneAt(frame); if (((Scene)(ref candidate)).IsValid() && ((Scene)(ref candidate)).isLoaded && !(((Scene)(ref candidate)).handle == ((Scene)(ref destination)).handle) && ((Scene)(ref candidate)).buildIndex >= 4 && ((Scene)(ref candidate)).buildIndex <= 13) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Removing stray additive donor from " + ((Scene)(ref destination)).name + ": " + ((Scene)(ref candidate)).name + " buildIndex=" + ((Scene)(ref candidate)).buildIndex)); QuarantineScene(candidate); CleanDonorPhotonViews(candidate); AsyncOperation unload = SceneManager.UnloadSceneAsync(candidate); if (unload != null) { while (!unload.isDone) { yield return null; } } _abandonedDonorBuildIndices.Remove(((Scene)(ref candidate)).buildIndex); candidate = default(Scene); } } } private IEnumerator UnloadAbandonedDonor(Scene scene) { //IL_000e: 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) if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { yield break; } int buildIndex = ((Scene)(ref scene)).buildIndex; string sceneName = ((Scene)(ref scene)).name; AsyncOperation unload = SceneManager.UnloadSceneAsync(scene); if (unload != null) { while (!unload.isDone) { yield return null; } } _abandonedDonorBuildIndices.Remove(buildIndex); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Abandoned donor unloaded scene=" + sceneName)); } private List CaptureStaticReferences() { List list = new List(); HashSet hashSet = new HashSet(); Type[] types; try { types = typeof(MapHandler).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } Type[] array = types; for (int i = 0; i < array.Length; i++) { for (Type type = array[i]; type != null; type = type.BaseType) { FieldInfo[] fields; try { fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } catch { continue; } FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { if (!hashSet.Add(fieldInfo) || fieldInfo.IsLiteral || fieldInfo.IsInitOnly || !typeof(Object).IsAssignableFrom(fieldInfo.FieldType)) { continue; } try { object? value = fieldInfo.GetValue(null); Object val = (Object)((value is Object) ? value : null); if (val != (Object)null) { list.Add(new StaticReference(fieldInfo, val)); } } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Static capture failed " + type.FullName + "." + fieldInfo.Name + ": " + ex2.Message)); } } } } return list; } private void RestoreStaticReferences(List snapshot, string stage) { if (snapshot == null) { return; } int num = 0; foreach (StaticReference item in snapshot) { if (item.Value == (Object)null) { continue; } try { object? value = item.Field.GetValue(null); if (!((Object)((value is Object) ? value : null) == item.Value)) { item.Field.SetValue(null, item.Value); num++; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Static restore failed " + item.Field.DeclaringType.FullName + "." + item.Field.Name + ": " + ex.Message)); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Main runtime references restored " + stage + ": changed=" + num)); } private void SanitizeDonorClone(GameObject clone, string biomeName) { int num = 0; Transform[] componentsInChildren = clone.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)clone.transform) && ((Object)val).name.IndexOf("Anti Spawn Zone", StringComparison.OrdinalIgnoreCase) >= 0) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); num++; } } int num2 = 0; PhotonView[] componentsInChildren2 = clone.GetComponentsInChildren(true); foreach (PhotonView val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)null) { continue; } try { if (val2.ViewID != 0 && (Object)(object)PhotonNetwork.GetPhotonView(val2.ViewID) == (Object)(object)val2) { PhotonNetwork.LocalCleanPhotonView(val2); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] PhotonView unregister failed biome=" + biomeName + " viewID=" + val2.ViewID + ": " + ex.Message)); } Object.DestroyImmediate((Object)(object)val2); num2++; } int num3 = 0; MonoBehaviour[] componentsInChildren3 = clone.GetComponentsInChildren(true); foreach (MonoBehaviour val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null)) { ((Behaviour)val3).enabled = false; num3++; } } int num4 = 0; Animator[] componentsInChildren4 = clone.GetComponentsInChildren(true); foreach (Animator val4 in componentsInChildren4) { if (!((Object)(object)val4 == (Object)null)) { ((Behaviour)val4).enabled = false; num4++; } } int num5 = 0; AudioSource[] componentsInChildren5 = clone.GetComponentsInChildren(true); foreach (AudioSource val5 in componentsInChildren5) { if (!((Object)(object)val5 == (Object)null)) { val5.Stop(); ((Behaviour)val5).enabled = false; num5++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Sanitized " + biomeName + ": blockersRemoved=" + num + " photonViewsRemoved=" + num2 + " scripts=" + num3 + " animators=" + num4 + " audio=" + num5)); } private unsafe void BuildRuntimeMountain(MapHandler map, Array vanilla, BiomeAsset[] definitions, List roots, Dictionary hostLayout) { //IL_0060: 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_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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: 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_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0308: 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_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Overriding biome sequence..."); for (int i = 0; i < vanilla.Length; i++) { Source source = Read(vanilla.GetValue(i), i); if ((Object)(object)source.Root != (Object)null && !roots.Contains(source.Root)) { source.Root.SetActive(false); } } DisableOriginalBiomeHierarchy(((Component)map).gameObject.scene); _segments.Clear(); _teleportIndex = -1; for (int j = 0; j < definitions.Length; j++) { GameObject val = roots[j]; if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Runtime root was destroyed before build: " + definitions[j].Name); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Activating runtime root " + j + " " + definitions[j].Name + " object=" + ((Object)val).name)); val.SetActive(true); Physics.SyncTransforms(); Bounds bounds = BoundsOf(val); Vector3 entrance = FindAnchor(val, entrance: true, bounds); Vector3 exit = FindAnchor(val, entrance: false, bounds); ApplyCalibratedAnchors(definitions[j].Name, val, ref entrance, ref exit); _segments.Add(new RuntimeSegment(j, definitions[j].Name, val, bounds, entrance, exit)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Creating segment " + j + ": " + definitions[j].Name)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Anchors " + definitions[j].Name + " entrance=" + ((object)(*(Vector3*)(&entrance))/*cast due to .constrained prefix*/).ToString() + " exit=" + ((object)(*(Vector3*)(&exit))/*cast due to .constrained prefix*/).ToString())); int num = 0; Renderer[] componentsInChildren = val.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && IsLocallyActive(val.transform, ((Component)val2).transform) && val2.isPartOfStaticBatch) { num++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Static-batched renderers " + definitions[j].Name + " = " + num)); } Vector3 forward = Vector3.forward; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Progression direction = " + ((object)(*(Vector3*)(&forward))/*cast due to .constrained prefix*/).ToString())); if (hostLayout != null) { foreach (RuntimeSegment segment in _segments) { Vector3 val3 = segment.Root.transform.InverseTransformPoint(segment.Entrance); Vector3 val4 = segment.Root.transform.InverseTransformPoint(segment.Exit); SegmentPose segmentPose = hostLayout[segment.Name]; segment.Root.transform.SetPositionAndRotation(segmentPose.Position, segmentPose.Rotation); segment.Entrance = segment.Root.transform.TransformPoint(val3); segment.Exit = segment.Root.transform.TransformPoint(val4); segment.Bounds = BoundsOf(segment.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Client applied host pose " + segment.Name + " position=" + ((object)segmentPose.Position/*cast due to .constrained prefix*/).ToString() + " rotation=" + ((object)((Quaternion)(ref segmentPose.Rotation)).eulerAngles/*cast due to .constrained prefix*/).ToString())); } Physics.SyncTransforms(); } else { for (int l = 1; l < _segments.Count; l++) { RuntimeSegment runtimeSegment = _segments[l - 1]; RuntimeSegment runtimeSegment2 = _segments[l]; float num2 = ProjectMax(BoundsOf(runtimeSegment.Root), forward); float num3 = ProjectMin(BoundsOf(runtimeSegment2.Root), forward); if (runtimeSegment.Name == "Caldera" && runtimeSegment2.Name == "The Kiln") { Vector3 val5 = runtimeSegment2.Root.transform.InverseTransformPoint(runtimeSegment2.Entrance); Vector3 val6 = runtimeSegment2.Root.transform.InverseTransformPoint(runtimeSegment2.Exit); runtimeSegment2.Root.transform.SetPositionAndRotation(runtimeSegment.Root.transform.position, runtimeSegment.Root.transform.rotation); runtimeSegment2.Entrance = runtimeSegment2.Root.transform.TransformPoint(val5); runtimeSegment2.Exit = runtimeSegment2.Root.transform.TransformPoint(val6); runtimeSegment2.Bounds = BoundsOf(runtimeSegment2.Root); Physics.SyncTransforms(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Preserved vanilla Caldera/Kiln sibling transform; shared position=" + ((object)runtimeSegment2.Root.transform.position/*cast due to .constrained prefix*/).ToString())); NudgeSegment(runtimeSegment2, new Vector3(4.89f, -35.05f, -196.69f), "restore verified bridge/tunnel approach while exterior is isolated separately"); } else { PlaceAfter(runtimeSegment, runtimeSegment2, forward); } if (!(runtimeSegment2.Name == "The Kiln")) { if (runtimeSegment2.Name == "Gloom") { NudgeSegment(runtimeSegment2, new Vector3(10.66f, -69.73f, 137.18f), "Mesa visible edge -> Gloom floor"); } else if (runtimeSegment2.Name == "The Citadel") { NudgeSegment(runtimeSegment2, new Vector3(42.73f, -104.18f, 0f), "Kiln edge -> composite Citadel stairs"); } else { NudgeSegment(runtimeSegment2, forward * -20f + Vector3.down * 25f, "global terrain overlap and descent"); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] " + runtimeSegment.Name + " -> " + runtimeSegment2.Name)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Previous exit = " + num2 + " Next entrance = " + num3 + " Overlap = 2")); } ApplyFinalEdgeAlignment(); ApplyRootsBlockLateralCalibration(); } InstallRuntimeHazards(); InstallRuntimeMobs(); InstallRuntimeShoreBridges(); DisableVanillaFogWalls(); InstallRuntimeCampfires(); InstallRuntimeLuggage(); InstallNadirAccess(); foreach (RuntimeSegment segment2 in _segments) { segment2.Bounds = BoundsOf(segment2.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Segment " + segment2.Index + " " + segment2.Name + " bounds center=" + ((object)((Bounds)(ref segment2.Bounds)).center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)((Bounds)(ref segment2.Bounds)).size/*cast due to .constrained prefix*/).ToString())); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Peak placed at " + ((object)_segments[_segments.Count - 1].Root.transform.position/*cast due to .constrained prefix*/).ToString())); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime segment count = " + _segments.Count)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Rescue zone center=" + ((object)Unsafe.As(ref RescueZoneCenter)/*cast due to .constrained prefix*/).ToString() + " radius=" + 35f)); } internal static bool TryGetRescueZoneResult(Vector3 position, out bool inside) { //IL_0024: 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) inside = false; if ((Object)(object)Instance == (Object)null || Instance._segments.Count == 0) { return false; } inside = Vector3.Distance(position, RescueZoneCenter) <= 35f; return true; } private void InstallNadirAccess() { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) VoidBiome val = null; VoidBiome[] array = Resources.FindObjectsOfTypeAll(); foreach (VoidBiome val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)null)) { val = val2; break; } } RuntimeSegment runtimeSegment = _segments.Find((RuntimeSegment segment) => segment.Name == "Peak"); ScoutStatue val3 = (((Object)(object)runtimeSegment?.Root == (Object)null) ? null : runtimeSegment.Root.GetComponentInChildren(true)); if ((Object)(object)val == (Object)null || val.segment == null || (Object)(object)val.segment.segmentParent == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Nadir unavailable: vanilla VoidBiome/MapSegment was not found"); return; } if ((Object)(object)val3 == (Object)null || (Object)(object)val3.scoutsHonorPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Nadir unavailable: Peak ScoutStatue/Scout's Honor prefab was not found"); return; } RelocatePeakSummit(runtimeSegment.Root, val3); if ((Object)(object)val3.gemSpot != (Object)null) { RescueZoneCenter = val3.gemSpot.position + RescueOffsetFromSummitGem; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Dynamic Peak summit resolved from ScoutStatue.gemSpot=" + ((object)Unsafe.As(ref RescueZoneCenter)/*cast due to .constrained prefix*/).ToString())); } RuntimeNadirAccess runtimeNadirAccess = ((Component)this).gameObject.GetComponent(); if ((Object)(object)runtimeNadirAccess == (Object)null) { runtimeNadirAccess = ((Component)this).gameObject.AddComponent(); } runtimeNadirAccess.Initialize(val3, RescueZoneCenter); InstallRescuePlatform(runtimeSegment.Root); InstallPeakMissingColliders(runtimeSegment.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Nadir: FOUND root=" + PathOf(val.segment.segmentParent.transform) + " colliders=" + val.segment.segmentParent.GetComponentsInChildren(true).Length + " access=vanilla Scout's Honor at Peak")); } private unsafe void RelocatePeakSummit(GameObject peakRoot, ScoutStatue statue) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)peakRoot == (Object)null || (Object)(object)statue == (Object)null || (Object)(object)statue.gemSpot == (Object)null) { return; } RuntimeSegment runtimeSegment = _segments.Find((RuntimeSegment segment) => segment.Name == "The Citadel"); if (runtimeSegment == null || (Object)(object)runtimeSegment.Root == (Object)null) { return; } Bounds val = BoundsOf(runtimeSegment.Root); Vector3 position = statue.gemSpot.position; Vector3 val2 = new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).max.y + 15f, ((Bounds)(ref val)).max.z + 30f) - position; if (((Vector3)(ref val2)).magnitude < 100f) { return; } HashSet hashSet = new HashSet(); Transform val3 = DirectChildOfPeak(((Component)statue).transform); if ((Object)(object)val3 != (Object)null) { hashSet.Add(val3); } Transform val4 = DirectChildOfPeak(statue.gemSpot); if ((Object)(object)val4 != (Object)null) { hashSet.Add(val4); } foreach (Transform item in peakRoot.transform) { Transform val5 = item; if ((Object)(object)val5 == (Object)null) { continue; } bool flag = Vector3.Distance(val5.position, position) < 450f; if (!flag) { Renderer[] componentsInChildren = ((Component)val5).GetComponentsInChildren(true); foreach (Renderer val6 in componentsInChildren) { if ((Object)(object)val6 != (Object)null) { Bounds bounds = val6.bounds; if (((Bounds)(ref bounds)).SqrDistance(position) < 90000f) { flag = true; break; } } } } if (flag) { hashSet.Add(val5); } } foreach (Transform item2 in hashSet) { if ((Object)(object)item2 != (Object)null) { item2.position += val2; } } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Peak summit relocated blocks=" + hashSet.Count + " from=" + ((object)(*(Vector3*)(&position))/*cast due to .constrained prefix*/).ToString() + " to=" + ((object)statue.gemSpot.position/*cast due to .constrained prefix*/).ToString() + " offset=" + ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString() + " citadelBounds=" + ((object)(*(Bounds*)(&val))/*cast due to .constrained prefix*/).ToString())); Transform DirectChildOfPeak(Transform value) { if ((Object)(object)value == (Object)null) { return null; } while ((Object)(object)value.parent != (Object)null && (Object)(object)value.parent != (Object)(object)peakRoot.transform) { value = value.parent; } if (!((Object)(object)value.parent == (Object)(object)peakRoot.transform)) { return null; } return value; } } private void InstallRescuePlatform(GameObject peakRoot) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)peakRoot == (Object)null) && !((Object)(object)peakRoot.transform.Find("AllBiomes Rescue Collision") != (Object)null)) { GameObject val = new GameObject("AllBiomes Rescue Collision"); val.transform.SetParent(peakRoot.transform, true); val.transform.position = RescueZoneCenter - Vector3.up * 1.8f; BoxCollider val2 = val.AddComponent(); val2.size = new Vector3(40f, 1f, 40f); ((Collider)val2).isTrigger = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Peak rescue collision installed center=" + ((object)val.transform.position/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)val2.size/*cast due to .constrained prefix*/).ToString())); } } private void InstallPeakMissingColliders(GameObject peakRoot) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)peakRoot == (Object)null) { return; } int num = 0; int num2 = 0; MeshFilter[] componentsInChildren = peakRoot.GetComponentsInChildren(true); foreach (MeshFilter val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMesh == (Object)null || (Object)(object)((Component)val).GetComponent() != (Object)null) { continue; } MeshRenderer component = ((Component)val).GetComponent(); if ((Object)(object)component == (Object)null || !((Renderer)component).enabled || !((Component)component).gameObject.activeInHierarchy) { continue; } Bounds bounds = ((Renderer)component).bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (size.x < 1.5f && size.y < 1.5f && size.z < 1.5f) { num2++; continue; } try { MeshCollider obj = ((Component)val).gameObject.AddComponent(); obj.sharedMesh = val.sharedMesh; obj.convex = false; num++; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Peak collider failed object=" + ((Object)val).name + ": " + ex.Message)); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Peak missing mesh colliders installed=" + num + " skippedSmall=" + num2 + " total=" + peakRoot.GetComponentsInChildren(true).Length)); } private unsafe void ApplyRootsBlockLateralCalibration() { //IL_0000: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.right * 89.67f; for (int i = 2; i < _segments.Count; i++) { RuntimeSegment runtimeSegment = _segments[i]; if (!((Object)(object)runtimeSegment?.Root == (Object)null)) { Transform transform = runtimeSegment.Root.transform; transform.position += val; runtimeSegment.Entrance += val; runtimeSegment.Exit += val; runtimeSegment.Bounds = BoundsOf(runtimeSegment.Root); } } Physics.SyncTransforms(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] F8 lateral calibration applied Roots->Peak offset=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } private unsafe void ApplyCalderaBlockGapCalibration() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(14.91f, 0f, -90.71f); for (int i = 6; i < _segments.Count; i++) { RuntimeSegment runtimeSegment = _segments[i]; if (!((Object)(object)runtimeSegment?.Root == (Object)null)) { Transform transform = runtimeSegment.Root.transform; transform.position += val; runtimeSegment.Entrance += val; runtimeSegment.Exit += val; runtimeSegment.Bounds = BoundsOf(runtimeSegment.Root); } } Physics.SyncTransforms(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] F8 Caldera->Peak gap calibration offset=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } private void InstallRuntimeLuggage() { int num = 0; foreach (RuntimeSegment segment in _segments) { Luggage[] componentsInChildren = segment.Root.GetComponentsInChildren(true); foreach (Luggage val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null)) { ((Component)val).gameObject.AddComponent().Initialize(val, BuildStateKey("LG", segment, ((Component)val).transform)); num++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime luggage segment=" + segment.Index + " " + segment.Name + " found=" + componentsInChildren.Length)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime luggage adapters installed=" + num)); } private void InstallRuntimeHazards() { //IL_0042: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) foreach (RuntimeSegment segment in _segments) { if (segment.Name == "Tropics") { segment.Root.AddComponent().Initialize(segment.Root, BoundsOf(segment.Root), RuntimeWeatherKind.Rain, 117.99f, 410.69f); } else if (segment.Name == "Roots") { segment.Root.AddComponent().Initialize(segment.Root, BoundsOf(segment.Root), RuntimeWeatherKind.Wind, 573.94f, 813.47f); } else if (segment.Name == "Mesa") { HotSun[] componentsInChildren = segment.Root.GetComponentsInChildren(true); HotSun[] array = componentsInChildren; foreach (HotSun val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = true; } } segment.Root.AddComponent().Initialize(BoundsOf(segment.Root), 1601.46f, 2117.57f); segment.Root.AddComponent().Initialize(segment.Root, 1601.46f, 1930.53f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Mesa HotSun controllers enabled=" + componentsInChildren.Length)); } else if (segment.Name == "Alpine") { segment.Root.AddComponent().Initialize(segment.Root, BoundsOf(segment.Root), RuntimeWeatherKind.Snow, 953.52f, 1463.92f); } else if (segment.Name == "Caldera" || segment.Name == "The Kiln") { Lava[] componentsInChildren2 = segment.Root.GetComponentsInChildren(true); Lava[] array2 = componentsInChildren2; foreach (Lava val2 in array2) { if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; } } segment.Root.AddComponent().Initialize(segment.Root, 3008.67f, 3372.97f, segment.Name == "The Kiln"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] " + segment.Name + " Lava damage controllers enabled=" + componentsInChildren2.Length)); } else if (segment.Name == "Gloom") { segment.Root.AddComponent().Initialize(segment.Root, 2355.32f, 2952.26f); } else if (segment.Name == "The Citadel") { InstallRuntimeCitadelTraps(segment.Root); } } } private void InstallRuntimeCitadelTraps(GameObject root) { int num = 0; SpikeRoller[] componentsInChildren = root.GetComponentsInChildren(true); foreach (SpikeRoller val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.rb == (Object)null) && val.roller != null) { ((Behaviour)val).enabled = true; num++; } } int num2 = 0; MovingSawBlade[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (MovingSawBlade val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.path == (Object)null) && !((Object)(object)val2.Animate == (Object)null) && !((Object)(object)val2.sawBladeVisual == (Object)null)) { ((Behaviour)val2).enabled = true; num2++; } } int num3 = 0; SwingingAxe[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (SwingingAxe val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3.rb == (Object)null) && !((Object)(object)val3.spikeHeadTF == (Object)null)) { ((Behaviour)val3).enabled = true; num3++; } } int num4 = 0; SpikeTrap[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (SpikeTrap val4 in componentsInChildren4) { if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4.spikes == (Object)null) && !((Object)(object)val4.hitbox == (Object)null)) { ((Behaviour)val4).enabled = false; (((Component)val4).gameObject.GetComponent() ?? ((Component)val4).gameObject.AddComponent()).Initialize(val4); num4++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Citadel traps restored rollers=" + num + " saws=" + num2 + " axes=" + num3 + " spikes=" + num4)); } private void InstallRuntimeMobs() { //IL_011f: 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_0138: 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_00a8: 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_01ac: 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_01d1: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); foreach (RuntimeSegment segment in _segments) { Mob[] componentsInChildren = segment.Root.GetComponentsInChildren(true); foreach (Mob val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string text = null; if (val is Beetle) { text = "Beetle"; } else if (val is Scorpion) { text = "Scorpion"; } else if (val is FrogTongue) { text = "Frog"; } if (text != null && IsMobPointInsideSegment(segment, ((Component)val).transform.position)) { list.Add(new RuntimeMobPoint(text, ((Component)val).transform.position, ((Component)val).transform.rotation, ((Component)val).gameObject, "ItemRoom", segment.Name)); } ((Component)val).gameObject.SetActive(false); } } Spider[] componentsInChildren2 = segment.Root.GetComponentsInChildren(true); foreach (Spider val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { if (IsMobPointInsideSegment(segment, ((Component)val2).transform.position)) { list.Add(new RuntimeMobPoint("Spider", ((Component)val2).transform.position, ((Component)val2).transform.rotation, ((Component)val2).gameObject, "RoomObject", segment.Name)); } ((Component)val2).gameObject.SetActive(false); } } Antlion[] componentsInChildren3 = segment.Root.GetComponentsInChildren(true); foreach (Antlion val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null)) { if (IsMobPointInsideSegment(segment, ((Component)val3).transform.position)) { list.Add(new RuntimeMobPoint("Antlion", ((Component)val3).transform.position, ((Component)val3).transform.rotation, ((Component)val3).gameObject, "RoomObject", segment.Name)); } ((Component)val3).gameObject.SetActive(false); } } MushroomZombieSpawner[] componentsInChildren4 = segment.Root.GetComponentsInChildren(true); foreach (MushroomZombieSpawner val4 in componentsInChildren4) { if (!((Object)(object)val4 == (Object)null)) { if ((Object)(object)val4.mushroomZombiePrefab != (Object)null && IsMobPointInsideSegment(segment, ((Component)val4).transform.position)) { list.Add(new RuntimeMobPoint(((Object)((Component)val4.mushroomZombiePrefab).gameObject).name, ((Component)val4).transform.position, ((Component)val4).transform.rotation, ((Component)val4).gameObject, "Network", segment.Name)); } ((Component)val4).gameObject.SetActive(false); } } Beehive[] componentsInChildren5 = segment.Root.GetComponentsInChildren(true); foreach (Beehive val5 in componentsInChildren5) { if (!((Object)(object)val5 == (Object)null) && val5.spawnBees && IsMobPointInsideSegment(segment, ((Component)val5).transform.position)) { list.Add(new RuntimeMobPoint(CleanPrefabName(((Object)((Component)val5).gameObject).name), ((Component)val5).transform.position, ((Component)val5).transform.rotation, ((Component)val5).gameObject, "ItemRoom", segment.Name)); ((Component)val5).gameObject.SetActive(false); } } GhostBallSpawner[] componentsInChildren6 = segment.Root.GetComponentsInChildren(true); foreach (GhostBallSpawner val6 in componentsInChildren6) { if (!((Object)(object)val6 == (Object)null)) { ((Behaviour)val6).enabled = false; list2.Add(val6); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Vanilla mob markers collected=" + list.Count + " ghostSpawners=" + list2.Count)); ((MonoBehaviour)this).StartCoroutine(SpawnRuntimeMobs(list, list2)); } private void InstallRuntimeShoreBridges() { RuntimeSegment runtimeSegment = _segments.Find((RuntimeSegment segment) => string.Equals(segment.Name, "Shore", StringComparison.Ordinal)); if (runtimeSegment == null || (Object)(object)runtimeSegment.Root == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[AllBiomes] Shore bridge stabilization skipped: Shore root missing"); return; } int num = 0; BreakableBridge[] componentsInChildren = runtimeSegment.Root.GetComponentsInChildren(true); foreach (BreakableBridge val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent() != (Object)null) { continue; } Renderer[] componentsInChildren2 = (((Object)(object)val.fullMesh != (Object)null) ? ((Component)val.fullMesh).gameObject : ((Component)val).gameObject).GetComponentsInChildren(true); if (componentsInChildren2.Length == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Shore bridge has no renderer path=" + PathOf(((Component)val).transform))); continue; } RuntimeStableBridge runtimeStableBridge = ((Component)val).gameObject.AddComponent(); if (runtimeStableBridge.Initialize(((Component)val).transform, componentsInChildren2)) { num++; } else { Object.DestroyImmediate((Object)(object)runtimeStableBridge); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Shore bridges stabilized=" + num)); } private IEnumerator SpawnRuntimeMobs(List points, List ghostSources) { float deadline = Time.realtimeSinceStartup + 15f; while (!PhotonNetwork.InRoom && Time.realtimeSinceStartup < deadline) { yield return null; } yield return null; if (!PhotonNetwork.InRoom) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Mob spawn aborted: Photon room not ready"); yield break; } if (!PhotonNetwork.IsMasterClient) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Client waits for host mob objects"); yield break; } if (((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"ALLBIOMES_MOBS_0205", out object value) && string.Equals(value as string, _runId, StringComparison.Ordinal)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Mob layout already spawned for run=" + _runId)); yield break; } int num = 0; int num2 = 0; Dictionary dictionary = new Dictionary(StringComparer.Ordinal); HashSet hashSet = new HashSet(StringComparer.Ordinal); foreach (RuntimeMobPoint point in points) { if (hashSet.Contains(point.PrefabName)) { continue; } dictionary.TryGetValue(point.PrefabName, out var value2); if (value2 >= MobCap(point.PrefabName)) { continue; } try { GameObject val = ((point.SpawnMethod == "ItemRoom") ? PhotonNetwork.InstantiateItemRoom(point.PrefabName, point.Position, point.Rotation) : ((!(point.SpawnMethod == "RoomObject")) ? PhotonNetwork.InstantiateRoomObject(point.PrefabName, point.Position, point.Rotation, (byte)0, (object[])null) : PhotonNetwork.InstantiateRoomObject(point.PrefabName, point.Position, point.Rotation, (byte)0, (object[])null))); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Photon returned null GameObject"); } InitializeSpawnedMob(val, point); dictionary[point.PrefabName] = value2 + 1; num++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Mob spawned biome=" + point.Biome + " prefab=" + point.PrefabName + " method=" + point.SpawnMethod + " position=" + ((object)point.Position/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex) { num2++; hashSet.Add(point.PrefabName); ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Mob spawn FAILED biome=" + point.Biome + " prefab=" + point.PrefabName + " method=" + point.SpawnMethod + " position=" + ((object)point.Position/*cast due to .constrained prefix*/).ToString() + " error=" + ex)); ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Further spawn attempts disabled for unavailable prefab=" + point.PrefabName + " this run")); } } int num3 = 0; foreach (GhostBallSpawner ghostSource in ghostSources) { if (!((Object)(object)ghostSource == (Object)null) && !((Object)(object)ghostSource.ghostBallPrefab == (Object)null)) { (((Component)ghostSource).gameObject.GetComponent() ?? ((Component)ghostSource).gameObject.AddComponent()).Initialize(ghostSource); ((Component)ghostSource).gameObject.SetActive(true); num3++; break; } } Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val2 = new Hashtable(); ((Dictionary)val2).Add((object)"ALLBIOMES_MOBS_0205", (object)_runId); currentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime mobs complete spawned=" + num + " failed=" + num2 + " unavailablePrefabs=" + hashSet.Count + " ghostAdapters=" + num3 + " run=" + _runId)); } private static int MobCap(string prefab) { if (prefab.IndexOf("Zombie", StringComparison.OrdinalIgnoreCase) >= 0) { return 5; } switch (prefab) { case "Spider": case "Beetle": return 8; case "Scorpion": case "Frog": return 6; case "Antlion": return 4; default: if (prefab.IndexOf("Beehive", StringComparison.OrdinalIgnoreCase) >= 0) { return 5; } return 4; } } private static bool IsMobPointInsideSegment(RuntimeSegment segment, Vector3 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) if (segment == null || (Object)(object)segment.Root == (Object)null || !IsFinite(position)) { return false; } Bounds bounds = segment.Bounds; ((Bounds)(ref bounds)).Expand(new Vector3(8f, 20f, 8f)); return ((Bounds)(ref bounds)).Contains(position); } private static void InitializeSpawnedMob(GameObject created, RuntimeMobPoint point) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) Mob component = created.GetComponent(); if ((Object)(object)component != (Object)null) { AccessTools.Field(typeof(Mob), "startPos")?.SetValue(component, point.Position); AccessTools.Field(typeof(Mob), "patrolPos")?.SetValue(component, point.Position); AccessTools.Field(typeof(Mob), "targetPos")?.SetValue(component, point.Position); AccessTools.Field(typeof(Mob), "sleeping")?.SetValue(component, false); } Spider component2 = created.GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)point.Dummy != (Object)null) { GameObject val = new GameObject("AllBiomes Spider Anchor"); val.transform.SetParent(point.Dummy.transform.parent, true); val.transform.SetPositionAndRotation(point.Position, point.Rotation); component2.startPoint = val.transform; component2.dragToPoint = val.transform; } } private static string CleanPrefabName(string value) { if (string.IsNullOrEmpty(value)) { return value; } if (!value.EndsWith("(Clone)", StringComparison.Ordinal)) { return value; } return value.Substring(0, value.Length - "(Clone)".Length).TrimEnd(); } private void DisableVanillaFogWalls() { int num = 0; Transform[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (Transform val in array) { if (!((Object)(object)val == (Object)null) && ((Object)val).name.IndexOf("Fogwall_Next", StringComparison.OrdinalIgnoreCase) >= 0) { ((Component)val).gameObject.SetActive(false); num++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Disabled obsolete vanilla fog wall " + PathOf(val))); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Obsolete vanilla fog walls disabled=" + num)); } private void InstallRuntimeCampfires() { EnsureMissingRuntimeCampfires(); int num = 0; foreach (RuntimeSegment segment in _segments) { Campfire[] componentsInChildren = segment.Root.GetComponentsInChildren(true); foreach (Campfire val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null)) { ((Component)val).gameObject.AddComponent().Initialize(val, BuildStateKey("CF", segment, ((Component)val).transform), segment.Index); Object.DestroyImmediate((Object)(object)val); num++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime campfires segment=" + segment.Index + " " + segment.Name + " found=" + componentsInChildren.Length)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime campfire adapters installed=" + num)); } private string BuildStateKey(string kind, RuntimeSegment segment, Transform target) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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) string text = (((Object)(object)target == (Object)null) ? "missing" : PathOf(target)); Vector3 val = (((Object)(object)target == (Object)null || segment == null || (Object)(object)segment.Root == (Object)null) ? Vector3.zero : segment.Root.transform.InverseTransformPoint(target.position)); string text2 = segment.Name + "|" + text + "|" + val.x.ToString("F2", CultureInfo.InvariantCulture) + "," + val.y.ToString("F2", CultureInfo.InvariantCulture) + "," + val.z.ToString("F2", CultureInfo.InvariantCulture); uint num = 2166136261u; for (int i = 0; i < text2.Length; i++) { num = (num ^ text2[i]) * 16777619; } return "AB" + kind + "_" + _runId + "_" + num.ToString("X8", CultureInfo.InvariantCulture); } private unsafe void EnsureMissingRuntimeCampfires() { //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Campfire val = null; foreach (RuntimeSegment segment in _segments) { if (!(segment.Name != "Mesa")) { val = segment.Root.GetComponentInChildren(true); if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val == (Object)null) { foreach (RuntimeSegment segment2 in _segments) { val = segment2.Root.GetComponentInChildren(true); if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Cannot create missing runtime campfires: visual template missing"); return; } foreach (RuntimeSegment segment3 in _segments) { if ((!(segment3.Name != "Gloom") || !(segment3.Name != "Caldera") || !(segment3.Name != "The Kiln")) && !((Object)(object)segment3.Root.GetComponentInChildren(true) != (Object)null)) { GameObject obj = Object.Instantiate(((Component)val).gameObject, segment3.Root.transform, true); ((Object)obj).name = "Runtime Campfire " + segment3.Name; Vector3 position = (Vector3)((segment3.Name == "The Kiln") ? new Vector3(-21.75f, 1722.44f, 3511.99f) : (segment3.Exit + Vector3.up * 1.5f)); obj.transform.position = position; obj.transform.rotation = Quaternion.identity; obj.SetActive(true); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Created missing runtime campfire segment=" + segment3.Index + " " + segment3.Name + " position=" + ((object)(*(Vector3*)(&position))/*cast due to .constrained prefix*/).ToString())); } } } internal unsafe void AdvanceRuntimeFog(int litSegmentIndex) { //IL_00ba: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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) OrbFogHandler val = Object.FindAnyObjectByType(); int num = ((!((Object)(object)val == (Object)null)) ? ((Object)val).GetInstanceID() : 0); if (num != _fogHandlerId) { _fogHandlerId = num; _fogStateSegment = -1; } if (litSegmentIndex <= _fogStateSegment) { return; } _fogStateSegment = litSegmentIndex; int num2 = litSegmentIndex + 1; if (num2 < 0 || num2 >= _segments.Count) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Runtime fog: final campfire reached, disabling fog sphere"); OrbFogHandler val2 = Object.FindAnyObjectByType(); if ((Object)(object)val2 != (Object)null) { ((MonoBehaviour)this).StartCoroutine(val2.DisableFog()); } return; } OrbFogHandler val3 = val; if ((Object)(object)val3 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Runtime fog advance failed: OrbFogHandler missing"); return; } RuntimeSegment runtimeSegment = _segments[num2]; runtimeSegment.Bounds = BoundsOf(runtimeSegment.Root); GameObject val4 = new GameObject("AllBiomes Fog Origin " + num2 + " " + runtimeSegment.Name); val4.transform.SetParent(((Component)val3).transform, false); val4.transform.position = ((Bounds)(ref runtimeSegment.Bounds)).center; FogSphereOrigin val5 = val4.AddComponent(); Vector3 val6 = ((Bounds)(ref runtimeSegment.Bounds)).extents; val5.size = Mathf.Max(800f, ((Vector3)(ref val6)).magnitude + 120f); val5.moveOnHeight = runtimeSegment.Exit.y; val5.moveOnForward = runtimeSegment.Exit.z; val5.disableFog = num2 == _segments.Count - 1; val3.InitNewSphere(val5); val3.currentSize = val5.size; val3.hasArrived = false; val3.isMoving = false; ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[10] { "[AllBiomes] Runtime fog advanced ", litSegmentIndex.ToString(), " -> ", num2.ToString(), " ", runtimeSegment.Name, " origin=", null, null, null }; val6 = val4.transform.position; obj[7] = ((object)(*(Vector3*)(&val6))/*cast due to .constrained prefix*/).ToString(); obj[8] = " size="; obj[9] = val5.size.ToString(); logger.LogInfo((object)string.Concat(obj)); } private void ApplyFinalEdgeAlignment() { //IL_003c: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_0101: Unknown result type (might be due to invalid IL or missing references) Vector3 offset = default(Vector3); foreach (RuntimeSegment segment in _segments) { if (segment.Name == "Gloom") { NudgeSegment(segment, new Vector3(-16.49f, -3.82f, -36.33f), "F8 Gloom edge aligned back to Desert edge"); } else if (segment.Name == "Caldera") { ((Vector3)(ref offset))..ctor(-5.53f, 55.82f, -26.83f); NudgeSegment(segment, offset, "F8 pre-lava start alignment"); RuntimeSegment runtimeSegment = _segments.Find((RuntimeSegment candidate) => candidate.Name == "The Kiln"); if (runtimeSegment != null) { NudgeSegment(runtimeSegment, offset, "follow Caldera as one vanilla volcano block"); } for (int num = _segments.FindIndex((RuntimeSegment candidate) => candidate.Name == "The Kiln") + 1; num < _segments.Count; num++) { NudgeSegment(_segments[num], offset, "follow aligned Caldera/Kiln block"); } } else if (segment.Name == "The Citadel") { NudgeSegment(segment, new Vector3(-99.33f, -2.25f, 197.88f), "F8 Citadel stairs aligned to final marker 7"); } else if (segment.Name == "Peak") { NudgeSegment(segment, new Vector3(-99.33f, -2.25f, 197.88f), "follow final Citadel marker alignment"); } } } private unsafe void NudgeSegment(RuntimeSegment segment, Vector3 offset, string reason) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) Transform transform = segment.Root.transform; transform.position += offset; segment.Entrance += offset; segment.Exit += offset; Physics.SyncTransforms(); segment.Bounds = BoundsOf(segment.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Visible transition nudge " + segment.Name + " offset=" + ((object)(*(Vector3*)(&offset))/*cast due to .constrained prefix*/).ToString() + " reason=" + reason)); } private void DisableOriginalBiomeHierarchy(Scene mainScene) { int num = 0; GameObject[] rootGameObjects = ((Scene)(ref mainScene)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { Transform[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.parent == (Object)null) && ((Object)val).name.StartsWith("Biome_", StringComparison.OrdinalIgnoreCase) && ((Object)val.parent).name.IndexOf("Map", StringComparison.OrdinalIgnoreCase) >= 0) { ((Component)val).gameObject.SetActive(false); num++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Disabled original vanilla hierarchy " + PathOf(val))); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Original vanilla biome containers disabled=" + num)); } private GameObject FindSceneObject(Scene scene, BiomeAsset definition) { //IL_00a0: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); Transform[] componentsInChildren; for (int i = 0; i < rootGameObjects.Length; i++) { componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!(((Object)val).name != definition.RootName) && PathMatches(PathOf(val), definition.RequiredPathParts)) { return ((Component)val).gameObject; } } } componentsInChildren = Resources.FindObjectsOfTypeAll(); foreach (Transform val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && !(((Object)val2).name != definition.RootName) && !(((Component)val2).gameObject.scene != scene)) { string text = PathOf(val2); if (PathMatches(text, definition.RequiredPathParts)) { ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[6] { "[AllBiomes] Using global scene-object fallback for ", definition.RootName, " path=", text, " scene=", null }; Scene scene2 = ((Component)val2).gameObject.scene; obj[5] = ((Scene)(ref scene2)).name; logger.LogWarning((object)string.Concat(obj)); return ((Component)val2).gameObject; } } } return null; } private static bool PathMatches(string path, string[] required) { foreach (string value in required) { if (path.IndexOf(value, StringComparison.OrdinalIgnoreCase) < 0) { return false; } } return true; } private static Vector3 FindAnchor(GameObject root, bool entrance, Bounds bounds) { //IL_0036: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) string text = (entrance ? "AllBiomes_Entrance" : "AllBiomes_Exit"); Transform[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == text) { return val.position; } } string[] array = ((!entrance) ? new string[4] { "WallNext", "Exit", "End", "Campfire" } : new string[4] { "Respawn", "Reconnect", "Entrance", "Start" }); Transform val2 = null; float num = (entrance ? float.PositiveInfinity : float.NegativeInfinity); componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val3 in componentsInChildren) { if (!IsLocallyActive(root.transform, val3)) { continue; } string[] array2 = array; foreach (string value in array2) { if (((Object)val3).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { float z = val3.position.z; if ((entrance && z < num) || (!entrance && z > num)) { val2 = val3; num = z; } break; } } } if ((Object)(object)val2 != (Object)null) { return val2.position; } if (!entrance) { return new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).max.z); } return new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).min.z); } private unsafe void Generate(MapHandler map, Array vanilla) { //IL_01fa: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0338: 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_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Generator start"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Vanilla segment count = " + vanilla.Length)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Vanilla selected biomes = " + ((map.biomes == null) ? "" : string.Join(", ", map.biomes)))); Source source = Read(vanilla.GetValue(0), 0); Source source2 = Read(vanilla.GetValue(1), 1); Source source3 = ResolvePeak(map); if ((Object)(object)source.Root == (Object)null || (Object)(object)source2.Root == (Object)null || (Object)(object)source3.Root == (Object)null) { throw new InvalidOperationException("Required Shore/middle/Peak root is null"); } _segments.Clear(); _segments.Add(Create(0, source)); _segments.Add(Create(1, source2)); _segments.Add(Create(2, source3)); for (int i = 2; i <= 4; i++) { Source source4 = Read(vanilla.GetValue(i), i); if ((Object)(object)source4.Root != (Object)null && (Object)(object)source4.Root != (Object)(object)source3.Root && !source3.Root.transform.IsChildOf(source4.Root.transform) && !source4.Root.transform.IsChildOf(source3.Root.transform)) { source4.Root.SetActive(false); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Disabled unused segment " + i + " " + ((Object)source4.Root).name)); } } source.Root.SetActive(true); source2.Root.SetActive(true); source3.Root.SetActive(true); Vector3 direction = source2.Root.transform.position - source.Root.transform.position; direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 1f) { direction = Vector3.forward; } else { ((Vector3)(ref direction)).Normalize(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Progression direction = " + ((object)(*(Vector3*)(&direction))/*cast due to .constrained prefix*/).ToString())); PlaceAfter(_segments[0], _segments[1], direction); PlaceAfter(_segments[1], _segments[2], direction); foreach (RuntimeSegment segment in _segments) { segment.Bounds = BoundsOf(segment.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Segment " + segment.Index + " " + segment.Name + " bounds center=" + ((object)((Bounds)(ref segment.Bounds)).center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)((Bounds)(ref segment.Bounds)).size/*cast due to .constrained prefix*/).ToString())); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Entrance anchor " + ((object)Unsafe.As(ref segment.Entrance)/*cast due to .constrained prefix*/).ToString())); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Exit anchor " + ((object)Unsafe.As(ref segment.Exit)/*cast due to .constrained prefix*/).ToString())); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Peak placed at " + ((object)source3.Root.transform.position/*cast due to .constrained prefix*/).ToString())); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Runtime segment count = " + _segments.Count)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Prototype ready: Shore -> " + ((object)source2.Biome/*cast due to .constrained prefix*/).ToString() + " -> Peak")); } private unsafe Source Read(object value, int index) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) if (value == null) { throw new InvalidOperationException("MapSegment " + index + " is null"); } Type type = value.GetType(); object? obj = type.GetProperty("segmentParent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null); GameObject val = (GameObject)(((obj is GameObject) ? obj : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); BiomeType biome = (BiomeType)((!((type.GetProperty("biome", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null) ?? type.GetField("_biome", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value)) is BiomeType val2)) ? (index switch { 5 => 5, 0 => 0, _ => 0, }) : ((int)val2)); object? obj2 = type.GetField("reconnectSpawnPos", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); Transform reconnect = (Transform)((obj2 is Transform) ? obj2 : null); object? obj3 = type.GetField("wallNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); GameObject wallNext = (GameObject)((obj3 is GameObject) ? obj3 : null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Source " + index + " biome=" + ((object)(*(BiomeType*)(&biome))/*cast due to .constrained prefix*/).ToString() + " root=" + (((Object)(object)val == (Object)null) ? "" : ((Object)val).name))); return new Source(index, biome, val, reconnect, wallNext); } private Source ResolvePeak(MapHandler map) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) PeakHandler val = null; PeakHandler[] array = Resources.FindObjectsOfTypeAll(); foreach (PeakHandler val2 in array) { if ((Object)(object)val2 != (Object)null) { Scene scene = ((Component)val2).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Component)val2).gameObject.scene == ((Component)map).gameObject.scene) { val = val2; break; } } } if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("PeakHandler was not found in the island scene"); } Transform respawnThePeak = map.respawnThePeak; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] PeakHandler path=" + PathOf(((Component)val).transform))); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] respawnThePeak path=" + (((Object)(object)respawnThePeak == (Object)null) ? "" : PathOf(respawnThePeak)))); Transform val3 = FindReasonablePeakRoot(((Component)val).transform, ((Component)map).transform); if ((Object)(object)val3 == (Object)null) { throw new InvalidOperationException("No physical Peak root with reasonable bounds was found"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Physical Peak root=" + PathOf(val3))); return new Source(5, (BiomeType)5, ((Component)val3).gameObject, respawnThePeak, null); } private unsafe Transform FindReasonablePeakRoot(Transform start, Transform stop) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Transform val = start; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)stop) { try { Bounds val2 = BoundsOf(((Component)val).gameObject); Vector3 size = ((Bounds)(ref val2)).size; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Peak root candidate " + PathOf(val) + " size=" + ((object)(*(Vector3*)(&size))/*cast due to .constrained prefix*/).ToString())); if (size.x < 4000f && size.y < 10000f && size.z < 4000f && ((Vector3)(ref size)).sqrMagnitude > 100f) { return val; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Peak candidate rejected " + ((Object)val).name + ": " + ex.Message)); } val = val.parent; } return null; } private static Transform CommonAncestor(Transform a, Transform b) { HashSet hashSet = new HashSet(); Transform val = a; while ((Object)(object)val != (Object)null) { hashSet.Add(val); val = val.parent; } Transform val2 = b; while ((Object)(object)val2 != (Object)null) { if (hashSet.Contains(val2)) { return val2; } val2 = val2.parent; } return null; } private static string PathOf(Transform transform) { Stack stack = new Stack(); Transform val = transform; while ((Object)(object)val != (Object)null) { stack.Push(((Object)val).name); val = val.parent; } return string.Join("/", stack.ToArray()); } private static Transform FindDescendant(Transform root, string exactName) { if ((Object)(object)root == (Object)null) { return null; } Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val != (Object)null && ((Object)val).name == exactName) { return val; } } return null; } private RuntimeSegment Create(int index, Source source) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00a9: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = BoundsOf(source.Root); Vector3 entrance = (((Object)(object)source.Reconnect != (Object)null) ? source.Reconnect.position : ((Bounds)(ref bounds)).min); Vector3 exit = (((Object)(object)source.WallNext != (Object)null) ? source.WallNext.transform.position : ((Bounds)(ref bounds)).max); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Creating segment " + index + ": " + ((object)source.Biome/*cast due to .constrained prefix*/).ToString())); return new RuntimeSegment(index, ((object)source.Biome/*cast due to .constrained prefix*/).ToString(), source.Root, bounds, entrance, exit); } private unsafe void PlaceAfter(RuntimeSegment previous, RuntimeSegment next, Vector3 direction) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0067: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) previous.Bounds = BoundsOf(previous.Root); next.Bounds = BoundsOf(next.Root); Vector3 val = previous.Exit - next.Entrance - direction * 2f; Transform transform = next.Root.transform; transform.position += val; next.Entrance += val; next.Exit += val; Physics.SyncTransforms(); next.Bounds = BoundsOf(next.Root); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Placing " + next.Name + " at " + ((object)next.Root.transform.position/*cast due to .constrained prefix*/).ToString() + " displacement=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } internal static Bounds BoundsOf(GameObject root) { //IL_000a: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01b3: 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_01c9: 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) bool flag = false; Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.transform.position, Vector3.zero); Renderer[] componentsInChildren = root.GetComponentsInChildren(true); Bounds bounds2; Vector3 size; foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null || !IsLocallyActive(root.transform, ((Component)val).transform) || ((object)val).GetType().Name == "ParticleSystemRenderer") { continue; } bounds2 = val.bounds; size = ((Bounds)(ref bounds2)).size; if (((Vector3)(ref size)).sqrMagnitude < 0.001f) { continue; } bounds2 = val.bounds; if (((Bounds)(ref bounds2)).size.x > 4000f) { continue; } bounds2 = val.bounds; if (((Bounds)(ref bounds2)).size.y > 4000f) { continue; } bounds2 = val.bounds; if (!(((Bounds)(ref bounds2)).size.z > 4000f)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } Collider[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (Collider val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)null || !IsLocallyActive(root.transform, ((Component)val2).transform) || val2.isTrigger) { continue; } bounds2 = val2.bounds; size = ((Bounds)(ref bounds2)).size; if (((Vector3)(ref size)).sqrMagnitude < 0.001f) { continue; } bounds2 = val2.bounds; if (((Bounds)(ref bounds2)).size.x > 4000f) { continue; } bounds2 = val2.bounds; if (((Bounds)(ref bounds2)).size.y > 4000f) { continue; } bounds2 = val2.bounds; if (!(((Bounds)(ref bounds2)).size.z > 4000f)) { if (!flag) { bounds = val2.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val2.bounds); } } } if (!flag) { throw new InvalidOperationException("No bounds for " + ((Object)root).name); } return bounds; } private static bool IsLocallyActive(Transform root, Transform child) { Transform val = child; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) { if (!((Component)val).gameObject.activeSelf) { return false; } val = val.parent; } return (Object)(object)val == (Object)(object)root; } private static float ProjectMin(Bounds b, Vector3 d) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) return Vector3.Dot(((Bounds)(ref b)).center, d) - (Mathf.Abs(d.x) * ((Bounds)(ref b)).extents.x + Mathf.Abs(d.y) * ((Bounds)(ref b)).extents.y + Mathf.Abs(d.z) * ((Bounds)(ref b)).extents.z); } private static float ProjectMax(Bounds b, Vector3 d) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) return Vector3.Dot(((Bounds)(ref b)).center, d) + (Mathf.Abs(d.x) * ((Bounds)(ref b)).extents.x + Mathf.Abs(d.y) * ((Bounds)(ref b)).extents.y + Mathf.Abs(d.z) * ((Bounds)(ref b)).extents.z); } private void DebugControls() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && Input.GetMouseButtonDown(0) && (Object)(object)localCharacter.data.currentItem != (Object)null) { Flare component = ((Component)localCharacter.data.currentItem).GetComponent(); if ((Object)(object)component != (Object)null) { component.LightFlare(); ((BaseUnityPlugin)this).Logger.LogWarning((object)"[AllBiomes] Forced held flare activation from primary input"); } } if (Input.GetKeyDown((KeyCode)287)) { _flight = !_flight; if (_flight && (Object)(object)localCharacter != (Object)null) { BeginFlight(localCharacter); } else if (!_flight) { ((MonoBehaviour)this).StartCoroutine(EndFlightSafely(localCharacter)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Debug flight " + (_flight ? "enabled" : "disabled"))); } if (Input.GetKeyDown((KeyCode)288) && (Object)(object)localCharacter != (Object)null && _segments.Count > 0) { _teleportIndex = _segments.FindIndex((RuntimeSegment segment) => segment.Name == "Peak"); ((MonoBehaviour)this).StartCoroutine(DebugTeleport(localCharacter, RescueZoneCenter)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] F7 direct teleport -> Peak rescue point=" + ((object)Unsafe.As(ref RescueZoneCenter)/*cast due to .constrained prefix*/).ToString())); } if (Input.GetKeyDown((KeyCode)289)) { WriteBiomeMarker(localCharacter); } if (Input.GetKeyDown((KeyCode)290)) { _debugFogOff = !_debugFogOff; RenderSettings.fog = !_debugFogOff; OrbFogHandler val = Object.FindAnyObjectByType(); if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = !_debugFogOff; } if (_debugFogOff) { _debugFogRoots.Clear(); Transform[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.parent != (Object)null) && ((Object)val2).name.IndexOf("FogSphereSystem", StringComparison.OrdinalIgnoreCase) >= 0) { _debugFogRoots.Add(((Component)val2).gameObject); ((Component)val2).gameObject.SetActive(false); } } } else { foreach (GameObject debugFogRoot in _debugFogRoots) { if ((Object)(object)debugFogRoot != (Object)null) { debugFogRoot.SetActive(true); } } _debugFogRoots.Clear(); } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Debug fog " + (_debugFogOff ? "disabled" : "enabled"))); } if (Input.GetKeyDown((KeyCode)291) && (Object)(object)localCharacter != (Object)null) { if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[AllBiomes] F10 ignored: only the host can bring players"); } else { int num2 = 0; foreach (Character allCharacter in Character.AllCharacters) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)localCharacter) && !((Object)(object)((MonoBehaviourPun)allCharacter).photonView == (Object)null)) { float num3 = (float)num2 * 137.5f * (MathF.PI / 180f); Vector3 val3 = new Vector3(Mathf.Sin(num3), 0.75f, Mathf.Cos(num3)) * 1.5f; ((MonoBehaviourPun)allCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { localCharacter.Center + val3, true }); num2++; } } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] F10 brought players to host count=" + num2 + " center=" + ((object)localCharacter.Center/*cast due to .constrained prefix*/).ToString())); } } if (Input.GetKeyDown((KeyCode)292) && (Object)(object)localCharacter != (Object)null && localCharacter.refs != null && (Object)(object)localCharacter.refs.items != (Object)null) { MethodInfo method = typeof(CharacterItems).GetMethod("SpawnItemInHand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] F11 failed: CharacterItems.SpawnItemInHand missing"); } else { try { method.Invoke(localCharacter.refs.items, new object[1] { "Flare" }); ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] F11 requested vanilla Flare in hand for " + localCharacter.characterName)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] F11 flare spawn failed: " + ex)); } } } if (_debugFogOff && RenderSettings.fog) { RenderSettings.fog = false; } } private void ApplyCalibratedAnchors(string biomeName, GameObject root, ref Vector3 entrance, ref Vector3 exit) { //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_002d: 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) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: 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_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: 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_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) switch (biomeName) { case "Tropics": entrance = root.transform.TransformPoint(new Vector3(7.27f, 223.74f, 134.25f)); exit = root.transform.TransformPoint(new Vector3(-30.62f, 552.47f, 574.82f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied F8 calibrated anchors Tropics"); break; case "Roots": entrance = root.transform.TransformPoint(new Vector3(62.92f, 292.81f, 87.7f)); exit = root.transform.TransformPoint(new Vector3(-3.47f, 564.77f, 430.08f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied F8 calibrated anchors Roots"); break; case "Mesa": entrance = root.transform.TransformPoint(new Vector3(-18.15f, 486.09f, 555.04f)); exit = root.transform.TransformPoint(new Vector3(-9.06f, 867.56f, 1220.84f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied F8 calibrated anchors Mesa"); break; case "Gloom": entrance = root.transform.TransformPoint(new Vector3(-17.48f, 779.39f, 1302.49f)); exit = root.transform.TransformPoint(new Vector3(8.49f, 775.49f, 2024.58f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied F8 calibrated anchors Gloom"); break; case "Caldera": entrance = root.transform.TransformPoint(new Vector3(0.62f, 829.98f, 1035.6f)); exit = root.transform.TransformPoint(new Vector3(0.29f, 825.03f, 1572.63f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied F8 calibrated anchors Caldera"); break; case "The Kiln": { Transform val3 = FindDescendant(root.transform, "Volcano_Segment"); Transform val4 = (((Object)(object)val3 == (Object)null) ? root.transform : val3); entrance = val4.TransformPoint(new Vector3(-8.87f, 857.71f, 1783.01f)); exit = val4.TransformPoint(new Vector3(11.25f, 1150.05f, 1828.38f)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Applied full-container The Kiln anchors root=" + ((Object)val4).name)); break; } case "The Citadel": { Bounds val2 = BoundsOf(root); entrance = new Vector3(((Bounds)(ref val2)).center.x, ((Bounds)(ref val2)).min.y, ((Bounds)(ref val2)).center.z); exit = new Vector3(((Bounds)(ref val2)).center.x, ((Bounds)(ref val2)).max.y, ((Bounds)(ref val2)).center.z); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[AllBiomes] Applied vertical visible anchors The Citadel"); break; } case "Peak": { Bounds val = BoundsOf(root); entrance = new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).min.y, ((Bounds)(ref val)).min.z); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Applied visible-geometry entrance Peak " + ((object)Unsafe.As(ref entrance)/*cast due to .constrained prefix*/).ToString())); break; } } } private unsafe void WriteBiomeMarker(Character character) { //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_0025: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0190: Unknown result type (might be due to invalid IL or missing references) try { Camera main = Camera.main; Vector3 val = (((Object)(object)character != (Object)null) ? character.Center : (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : Vector3.zero)); List list = new List(); RuntimeSegment runtimeSegment = null; float num = float.PositiveInfinity; foreach (RuntimeSegment segment in _segments) { segment.Bounds = BoundsOf(segment.Root); Vector3 val2 = ((Bounds)(ref segment.Bounds)).ClosestPoint(val); float num2 = Vector3.Distance(val, val2); if (num2 < num) { num = num2; runtimeSegment = segment; } if (num2 < 150f || ((Bounds)(ref segment.Bounds)).Contains(val)) { list.Add(segment.Index + ":" + segment.Name + " distance=" + num2.ToString("F1", CultureInfo.InvariantCulture) + " contains=" + ((Bounds)(ref segment.Bounds)).Contains(val)); } } string text = ""; RaycastHit val3 = default(RaycastHit); if ((Object)(object)main != (Object)null && Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val3, 1000f, -1, (QueryTriggerInteraction)1)) { text = PathOf(((RaycastHit)(ref val3)).transform) + " point=" + FormatVector(((RaycastHit)(ref val3)).point) + " distance=" + ((RaycastHit)(ref val3)).distance.ToString("F1", CultureInfo.InvariantCulture); } _markerNumber++; string contents = Environment.NewLine + "=== MARKER " + _markerNumber + " " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " ===" + Environment.NewLine + "Player=" + FormatVector(val) + Environment.NewLine + "Camera=" + (((Object)(object)main == (Object)null) ? "" : FormatVector(((Component)main).transform.position)) + Environment.NewLine + "Nearest=" + ((runtimeSegment == null) ? "" : (runtimeSegment.Index + ":" + runtimeSegment.Name)) + " distance=" + num.ToString("F1", CultureInfo.InvariantCulture) + Environment.NewLine + "Nearby=" + ((list.Count == 0) ? "" : string.Join(" | ", list)) + Environment.NewLine + "LookingAt=" + text + Environment.NewLine; File.AppendAllText(_markerFile, contents); ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] F8 MARKER " + _markerNumber + " saved: " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + " nearest=" + ((runtimeSegment == null) ? "" : runtimeSegment.Name) + " file=" + _markerFile)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] F8 marker failed: " + ex)); } } private static string FormatVector(Vector3 value) { return value.x.ToString("F2", CultureInfo.InvariantCulture) + "," + value.y.ToString("F2", CultureInfo.InvariantCulture) + "," + value.z.ToString("F2", CultureInfo.InvariantCulture); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } SceneManager.sceneLoaded -= OnSceneLoaded; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void BeginFlight(Character character) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) _flightBodies.Clear(); foreach (Rigidbody item in (typeof(CharacterRagdoll).GetField("rigidbodies", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(character.refs.ragdoll) is List { Count: >0 } list) ? list : new List(((Component)character.refs.ragdoll).GetComponentsInChildren(true))) { if (!((Object)(object)item == (Object)null)) { _flightBodies[item] = new Vector2(item.isKinematic ? 1f : 0f, item.useGravity ? 1f : 0f); item.useGravity = false; } } if (_flightBodies.Count == 0) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] Flight failed: Character ragdoll rigidbodies not found"); return; } _flightLastSafeCenter = character.Center; _flightColliders.Clear(); Collider[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { _flightColliders[val] = val.enabled; val.enabled = false; } foreach (Rigidbody key in _flightBodies.Keys) { if ((Object)(object)key == (Object)null) { continue; } componentsInChildren = ((Component)key).GetComponentsInChildren(true); foreach (Collider val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && !_flightColliders.ContainsKey(val2)) { _flightColliders[val2] = val2.enabled; val2.enabled = false; } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Flight real ragdoll acquired; bodies=" + _flightBodies.Count + " colliders=" + _flightColliders.Count + " center=" + ((object)character.Center/*cast due to .constrained prefix*/).ToString())); } private void EndFlight() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair flightCollider in _flightColliders) { if ((Object)(object)flightCollider.Key != (Object)null) { flightCollider.Key.enabled = flightCollider.Value; } } _flightColliders.Clear(); foreach (KeyValuePair flightBody in _flightBodies) { if (!((Object)(object)flightBody.Key == (Object)null)) { flightBody.Key.isKinematic = flightBody.Value.x > 0.5f; flightBody.Key.useGravity = flightBody.Value.y > 0.5f; flightBody.Key.linearVelocity = Vector3.zero; } } _flightBodies.Clear(); } private unsafe IEnumerator EndFlightSafely(Character character) { if ((Object)(object)character != (Object)null && _flightBodies.Count > 0) { Vector3 center = character.Center; Vector3 val = center + Vector3.up * 80f; RaycastHit? val2 = null; RaycastHit[] array = Physics.RaycastAll(val, Vector3.down, 2080f, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit value = array[i]; if ((Object)(object)((RaycastHit)(ref value)).collider == (Object)null || IsOwnCharacterCollider(((RaycastHit)(ref value)).collider, character) || !IsFinite(((RaycastHit)(ref value)).point) || Mathf.Abs(((RaycastHit)(ref value)).point.x - val.x) > 2f || Mathf.Abs(((RaycastHit)(ref value)).point.z - val.z) > 2f) { continue; } if (val2.HasValue) { float distance = ((RaycastHit)(ref value)).distance; RaycastHit value2 = val2.Value; if (!(distance < ((RaycastHit)(ref value2)).distance)) { continue; } } val2 = value; } if (val2.HasValue) { RaycastHit value3 = val2.Value; Vector3 val3 = ((RaycastHit)(ref value3)).point + Vector3.up * 1.75f; Vector3 val4 = val3 - center; if (!(((Vector3)(ref val4)).magnitude <= 2085f) || !IsFinite(val4)) { ((BaseUnityPlugin)this).Logger.LogError((object)("[AllBiomes] Flight rejected invalid landing correction=" + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString() + " hit=" + ((Object)((RaycastHit)(ref value3)).collider).name)); yield return (object)new WaitForFixedUpdate(); EndFlight(); yield break; } character.refs.ragdoll.MoveAllRigsInDirection(val4); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] Flight safe landing surface=" + ((Object)((RaycastHit)(ref value3)).collider).name + " point=" + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString() + " correction=" + ((Vector3)(ref val4)).magnitude.ToString("F2", CultureInfo.InvariantCulture))); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[AllBiomes] Flight safe landing found no surface below " + ((object)(*(Vector3*)(¢er))/*cast due to .constrained prefix*/).ToString())); } } yield return (object)new WaitForFixedUpdate(); EndFlight(); } private static bool IsOwnCharacterCollider(Collider collider, Character character) { if ((Object)(object)collider == (Object)null || (Object)(object)character == (Object)null) { return false; } if (((Component)collider).transform.IsChildOf(((Component)character).transform)) { return true; } if (character.refs != null && (Object)(object)character.refs.ragdoll != (Object)null && ((Component)collider).transform.IsChildOf(((Component)character.refs.ragdoll).transform)) { return true; } Character val = default(Character); if (CharacterRagdoll.TryGetCharacterFromCollider(collider, ref val)) { return (Object)(object)val == (Object)(object)character; } return false; } private static bool IsFinite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(value.x) && !float.IsInfinity(value.x) && !float.IsNaN(value.y) && !float.IsInfinity(value.y) && !float.IsNaN(value.z)) { return !float.IsInfinity(value.z); } return false; } private IEnumerator DebugTeleport(Character character, Vector3 point) { //IL_0015: 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) bool resumeFlight = _flight; if (_flight) { _flight = false; EndFlight(); } MethodInfo method = typeof(Character).GetMethod("WarpPlayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[AllBiomes] F7 failed: Character.WarpPlayer was not found"); yield break; } method.Invoke(character, new object[2] { point, true }); float timeout = Time.realtimeSinceStartup + 5f; while ((Object)(object)character != (Object)null && character.warping && Time.realtimeSinceStartup < timeout) { yield return (object)new WaitForFixedUpdate(); } if (!((Object)(object)character == (Object)null)) { if (resumeFlight) { _flight = true; BeginFlight(character); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[AllBiomes] F7 warp completed center=" + ((object)character.Center/*cast due to .constrained prefix*/).ToString() + " distance=" + Vector3.Distance(character.Center, point).ToString("F2", CultureInfo.InvariantCulture) + " flightRestored=" + resumeFlight)); } } } [HarmonyPatch(typeof(MountainProgressHandler), "IsAtPeak", new Type[] { typeof(Vector3) })] internal static class RescueZonePatch { private static bool Prefix(Vector3 position, ref bool __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (!AllBiomesPlugin.TryGetRescueZoneResult(position, out var inside)) { return true; } __result = inside; return false; } } [HarmonyPatch(typeof(Flare), "LightFlare")] internal static class RescueFlarePatch { private unsafe static void Postfix(Flare __instance) { //IL_0037: 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_003c: 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) try { Character val = (((Object)(object)__instance == (Object)null || (Object)(object)((ItemComponent)__instance).item == (Object)null) ? null : ((ItemComponent)__instance).item.holderCharacter); Vector3 position = (((Object)(object)val == (Object)null) ? Vector3.zero : val.Center); bool inside = false; bool flag = (Object)(object)val != (Object)null && AllBiomesPlugin.TryGetRescueZoneResult(position, out inside); Debug.Log((object)("[AllBiomes] Flare activated holder=" + (((Object)(object)val == (Object)null) ? "" : val.characterName) + " position=" + ((object)(*(Vector3*)(&position))/*cast due to .constrained prefix*/).ToString() + " zoneHandled=" + flag + " inside=" + (flag && inside) + " requireNadir=" + Ascents.shouldRequireNadir)); if (!flag || !inside || Ascents.shouldRequireNadir) { return; } PeakHandler instance = Singleton.Instance; if (!((Object)(object)instance == (Object)null) && !instance.summonedHelicopter) { PhotonView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { component.RPC("TriggerHelicopter", (RpcTarget)3, Array.Empty()); } else { instance.SummonHelicopter(); } Debug.Log((object)"[AllBiomes] Rescue helicopter requested by activated flare"); } } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Rescue flare handling failed: " + ex)); } } } internal sealed class RuntimeNadirAccess : MonoBehaviour { private const string SpawnKey = "ALLBIOMES_NADIR_ITEM_0189"; private ScoutStatue _statue; private Vector3 _spawnPoint; private bool _attempted; internal void Initialize(ScoutStatue statue, Vector3 spawnPoint) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) _statue = statue; _spawnPoint = spawnPoint + Vector3.up; _attempted = false; } private void Update() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00ff: Expected O, but got Unknown //IL_0106: Expected O, but got Unknown if (_attempted || (Object)(object)_statue == (Object)null || (Object)(object)_statue.scoutsHonorPrefab == (Object)null || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient || PhotonNetwork.CurrentRoom == null) { return; } bool flag = default(bool); int num; if (((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"ALLBIOMES_NADIR_ITEM_0189", out object value)) { if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { _attempted = true; Debug.Log((object)"[AllBiomes] Nadir access already spawned for this room"); return; } _attempted = true; try { GameObject val = PhotonNetwork.Instantiate("0_Items/" + ((Object)_statue.scoutsHonorPrefab).name, _spawnPoint, Quaternion.identity, (byte)0, (object[])null); Item obj = (((Object)(object)val == (Object)null) ? null : val.GetComponent()); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("spawned Scout's Honor has no Item component"); } obj.SetKinematicNetworked(true); Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val2 = new Hashtable(); ((Dictionary)val2).Add((object)"ALLBIOMES_NADIR_ITEM_0189", (object)true); currentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); Debug.Log((object)("[AllBiomes] Nadir access spawned: Scout's Honor at " + ((object)Unsafe.As(ref _spawnPoint)/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex) { _attempted = false; Debug.LogError((object)("[AllBiomes] Nadir access spawn failed: " + ex)); } } } [HarmonyPatch(typeof(MapHandler), "Awake")] internal static class AdditiveSourceMapHandlerPatch { private static bool Prefix(MapHandler __instance) { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return true; } Scene scene = ((Component)__instance).gameObject.scene; if (((Scene)(ref scene)).buildIndex < 4 || ((Scene)(ref scene)).buildIndex > 13 || SceneManager.sceneCount <= 1) { return true; } if (SceneManager.GetActiveScene() == scene) { return true; } return false; } } internal static class DonorLifecycleGuard { public static bool Prefix(object __instance) { //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_003f: 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) if (AllBiomesPlugin.LifecycleBlockedBuildIndex < 0) { return true; } Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null || (Object)(object)val.gameObject == (Object)null) { return true; } Scene scene = val.gameObject.scene; if (!((Scene)(ref scene)).IsValid() || scene != SceneManager.GetActiveScene()) { return false; } Transform val2 = val.transform; while ((Object)(object)val2 != (Object)null) { if (((Object)val2).name == "AllBiomes Runtime Mountain") { return false; } val2 = val2.parent; } return true; } } [HarmonyPatch(typeof(GameHandler), "OnSceneLoaded")] internal static class DonorGameHandlerSceneLoadedGuard { private static bool Prefix(Scene scene, LoadSceneMode mode) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (AllBiomesPlugin.LifecycleBlockedBuildIndex < 0) { return true; } if ((int)mode != 1) { return true; } Debug.Log((object)("[AllBiomes] Suppressed GameHandler.ClearSceneData for donor scene=" + (((Scene)(ref scene)).IsValid() ? ((Scene)(ref scene)).name : "") + " buildIndex=" + (((Scene)(ref scene)).IsValid() ? ((Scene)(ref scene)).buildIndex.ToString() : ""))); return false; } } [HarmonyPatch(typeof(Luggage), "Interact_CastFinished")] internal static class RuntimeLuggageInteractionPatch { private static bool Prefix(Luggage __instance) { if ((Object)(object)__instance == (Object)null) { return true; } RuntimeLuggageAdapter component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } component.RequestOpen(); return false; } } internal sealed class RuntimeLuggageAdapter : MonoBehaviour { private static readonly MethodInfo OpenMethod = typeof(Luggage).GetMethod("OpenLuggageRPC", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo GetSpawnSpotsMethod = typeof(Spawner).GetMethod("GetSpawnSpots", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo AnimatorField = typeof(Luggage).GetField("anim", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo PropertyBlockField = typeof(Luggage).GetField("mpb", BindingFlags.Instance | BindingFlags.NonPublic); private Luggage _luggage; private string _propertyKey; private bool _opened; private bool _hostSpawnStarted; private bool _spawnConfirmed; private float _nextNetworkPoll; internal void Initialize(Luggage luggage, string propertyKey) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown _luggage = luggage; _propertyKey = propertyKey; try { Animator component = ((Component)luggage).GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = true; } AnimatorField?.SetValue(luggage, component); PropertyBlockField?.SetValue(luggage, (object?)new MaterialPropertyBlock()); ((Behaviour)luggage).enabled = true; if (!Luggage.ALL_LUGGAGE.Contains(luggage)) { Luggage.ALL_LUGGAGE.Add(luggage); } } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Runtime luggage initialization failed key=" + _propertyKey + ": " + ex)); } PullNetworkState(); Debug.Log((object)("[AllBiomes] Runtime luggage ready key=" + _propertyKey + " object=" + ((Object)((Component)this).gameObject).name)); } internal void RequestOpen() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0039: Expected O, but got Unknown if (!_opened) { if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = new Hashtable(); ((Dictionary)val).Add((object)_propertyKey, (object)"REQUEST"); currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } OpenVisual(); if (PhotonNetwork.IsMasterClient) { StartHostSpawn(); } } } private void Update() { if (!_spawnConfirmed && !(Time.unscaledTime < _nextNetworkPoll)) { _nextNetworkPoll = Time.unscaledTime + 0.5f; PullNetworkState(); } } internal void RefreshAfterCharacterChange() { if (!_spawnConfirmed) { PullNetworkState(); } } private void OnDestroy() { if ((Object)(object)_luggage != (Object)null) { Luggage.ALL_LUGGAGE.Remove(_luggage); } } private void PullNetworkState() { if (string.IsNullOrEmpty(_propertyKey) || !PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { return; } Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; if (customProperties == null || !((Dictionary)(object)customProperties).ContainsKey((object)_propertyKey)) { return; } string text = customProperties[(object)_propertyKey] as string; if (text != "REQUEST" && text != "SPAWNED") { object obj = customProperties[(object)_propertyKey]; bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { return; } } OpenVisual(); if (text == "SPAWNED") { _spawnConfirmed = true; } else if (PhotonNetwork.IsMasterClient) { StartHostSpawn(); } } private void OpenVisual() { if (_opened || (Object)(object)_luggage == (Object)null) { return; } _opened = true; if (OpenMethod == null) { Debug.LogError((object)"[AllBiomes] Runtime luggage failed: OpenLuggageRPC reflection missing"); return; } try { OpenMethod.Invoke(_luggage, new object[1] { false }); Debug.Log((object)("[AllBiomes] Runtime luggage visual opened key=" + _propertyKey)); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Runtime luggage open failed key=" + _propertyKey + ": " + ex)); } } private void StartHostSpawn() { if (!_hostSpawnStarted && !_spawnConfirmed && PhotonNetwork.IsMasterClient && !((Object)(object)_luggage == (Object)null)) { _hostSpawnStarted = true; ((MonoBehaviour)this).StartCoroutine(SpawnItemsAsHost()); } } private IEnumerator SpawnItemsAsHost() { yield return (object)new WaitForSeconds(0.15f); int num = 0; try { if (!PhotonNetwork.IsMasterClient) { _hostSpawnStarted = false; yield break; } if (GetSpawnSpotsMethod == null) { throw new MissingMethodException(typeof(Spawner).FullName, "GetSpawnSpots"); } List list = GetSpawnSpotsMethod.Invoke(_luggage, null) as List; if (list == null) { list = new List(); } list.RemoveAll((Transform spot) => (Object)(object)spot == (Object)null); if (list.Count == 0) { Transform transform = new GameObject("AllBiomes Luggage Spawn Point").transform; transform.SetParent(((Component)_luggage).transform, false); transform.localPosition = Vector3.up * 0.75f + Vector3.forward * 0.35f; list.Add(transform); Debug.LogWarning((object)("[AllBiomes] Runtime luggage had no spawn spots; synthetic spot added key=" + _propertyKey)); } num = ((Spawner)_luggage).SpawnItems(list)?.Count ?? 0; if (num == 0) { GameObject val = (((Object)(object)((Spawner)_luggage).fallbackSpawn != (Object)null) ? ((Spawner)_luggage).fallbackSpawn : ((Spawner)_luggage).spawnedObjectPrefab); if ((Object)(object)val != (Object)null) { GameObject val2 = PhotonNetwork.InstantiateItemRoom(((Object)val).name, list[0].position, list[0].rotation); if (!((Object)(object)val2 != (Object)null) || !((Object)(object)val2.GetComponent() != (Object)null)) { throw new InvalidOperationException("fallback prefab spawned without Item: " + ((Object)val).name); } num = 1; Debug.LogWarning((object)("[AllBiomes] Vanilla loot pool returned empty; fallback item=" + ((Object)val).name + " key=" + _propertyKey)); } } if (num <= 0) { throw new InvalidOperationException("vanilla SpawnItems and serialized fallback both returned no items"); } _spawnConfirmed = true; if (PhotonNetwork.CurrentRoom != null) { Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val3 = new Hashtable(); ((Dictionary)val3).Add((object)_propertyKey, (object)"SPAWNED"); currentRoom.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null); } Debug.Log((object)("[AllBiomes] Runtime luggage HOST SPAWN confirmed key=" + _propertyKey + " items=" + num + " spots=" + list.Count)); } catch (Exception ex) { _hostSpawnStarted = false; Debug.LogError((object)("[AllBiomes] Runtime luggage HOST SPAWN failed key=" + _propertyKey + " items=" + num + ": " + ex)); } } } internal sealed class RuntimeCampfireAdapter : MonoBehaviour, IInteractibleConstant, IInteractible { private string _propertyKey; private bool _lit; private Renderer _renderer; private GameObject _enableWhenLit; private GameObject _disableWhenLit; private ParticleSystem _fireParticles; private ParticleSystem _smokeParticlesOff; private ParticleSystem _smokeParticlesLit; private AudioSource _loop; private float _cookTime = 2f; private int _segmentIndex; private double _litNetworkTime = -1.0; private float _nextNetworkPoll; private Item _cookingItem; internal bool IsLit => _lit; internal double LitNetworkTime => _litNetworkTime; public bool holdOnFinish => false; internal void Initialize(Campfire visual, string propertyKey, int segmentIndex) { _propertyKey = propertyKey; _segmentIndex = segmentIndex; _renderer = (((Object)(object)visual == (Object)null) ? ((Component)this).GetComponentInChildren(true) : ((Component)visual).GetComponentInChildren(true)); if ((Object)(object)visual != (Object)null) { _enableWhenLit = visual.enableWhenLit; _disableWhenLit = visual.disableWhenLit; _fireParticles = visual.fireParticles; _smokeParticlesOff = visual.smokeParticlesOff; _smokeParticlesLit = visual.smokeParticlesLit; _loop = visual.loop; _cookTime = visual.cookTime; } PullNetworkState(); ApplyVisuals(); Debug.Log((object)("[AllBiomes] Runtime campfire ready key=" + _propertyKey + " path=" + ((Object)((Component)this).gameObject).name)); } private void Update() { if (!_lit && !(Time.unscaledTime < _nextNetworkPoll)) { _nextNetworkPoll = Time.unscaledTime + 0.5f; PullNetworkState(); } } internal void RefreshAfterCharacterChange() { if (!_lit) { PullNetworkState(); } ApplyVisuals(); if (_lit) { AllBiomesPlugin.Instance?.AdvanceRuntimeFog(_segmentIndex); } } private void PullNetworkState() { if (string.IsNullOrEmpty(_propertyKey) || !PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { return; } Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; if (customProperties == null || !((Dictionary)(object)customProperties).ContainsKey((object)_propertyKey)) { return; } object obj = customProperties[(object)_propertyKey]; bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0 || customProperties[(object)_propertyKey] is double) { if (customProperties[(object)_propertyKey] is double litNetworkTime) { _litNetworkTime = litNetworkTime; } _lit = true; ApplyVisuals(); AllBiomesPlugin.Instance?.AdvanceRuntimeFog(_segmentIndex); } } private void Light() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Expected O, but got Unknown //IL_006f: Expected O, but got Unknown if (!_lit) { _lit = true; _litNetworkTime = PhotonNetwork.Time; ApplyVisuals(); AllBiomesPlugin.Instance?.AdvanceRuntimeFog(_segmentIndex); if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && !string.IsNullOrEmpty(_propertyKey)) { Hashtable val = new Hashtable(); ((Dictionary)val).Add((object)_propertyKey, (object)_litNetworkTime); Hashtable val2 = val; PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); } Debug.Log((object)("[AllBiomes] Runtime campfire lit key=" + _propertyKey + " position=" + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString())); } } private void ApplyVisuals() { if ((Object)(object)_enableWhenLit != (Object)null) { _enableWhenLit.SetActive(_lit); } if ((Object)(object)_disableWhenLit != (Object)null) { _disableWhenLit.SetActive(!_lit); } if ((Object)(object)_smokeParticlesOff != (Object)null) { if (_lit) { _smokeParticlesOff.Stop(true, (ParticleSystemStopBehavior)1); } else { _smokeParticlesOff.Play(); } } if ((Object)(object)_smokeParticlesLit != (Object)null) { if (_lit) { _smokeParticlesLit.Play(); } else { _smokeParticlesLit.Stop(true, (ParticleSystemStopBehavior)0); } } if ((Object)(object)_fireParticles != (Object)null) { if (_lit) { _fireParticles.Play(); } else { _fireParticles.Stop(true, (ParticleSystemStopBehavior)0); } } if ((Object)(object)_loop != (Object)null) { ((Behaviour)_loop).enabled = _lit; if (_lit && !_loop.isPlaying) { _loop.Play(); } } } public Vector3 Center() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_renderer == (Object)null)) { Bounds bounds = _renderer.bounds; return ((Bounds)(ref bounds)).center; } return ((Component)this).transform.position; } public string GetInteractionText() { if (!_lit) { return LocalizedText.GetText("LIGHT", true); } return LocalizedText.GetText("COOK", true); } public string GetName() { return LocalizedText.GetText("CAMPFIRE", true); } public Transform GetTransform() { return ((Component)this).transform; } public void HoverEnter() { } public void HoverExit() { } public void Interact(Character interactor) { if (!_lit) { return; } Item val = (((Object)(object)interactor == (Object)null || (Object)(object)interactor.data == (Object)null) ? null : interactor.data.currentItem); if ((Object)(object)val == (Object)null || (Object)(object)val.cooking == (Object)null || !val.cooking.canBeCooked) { return; } _cookingItem = val; try { val.cooking.StartCookingVisuals(); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Runtime campfire StartCookingVisuals failed: " + ex)); } } public void Interact_CastFinished(Character interactor) { if (!_lit) { Light(); return; } ItemCooking val = (((Object)(object)_cookingItem == (Object)null) ? null : _cookingItem.cooking); _cookingItem = null; if ((Object)(object)val == (Object)null) { return; } try { val.FinishCooking(); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Runtime campfire FinishCooking failed: " + ex)); } } public void CancelCast(Character interactor) { ItemCooking val = (((Object)(object)_cookingItem == (Object)null) ? null : _cookingItem.cooking); _cookingItem = null; if ((Object)(object)val == (Object)null) { return; } try { val.CancelCookingVisuals(); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Runtime campfire CancelCookingVisuals failed: " + ex)); } } public void ReleaseInteract(Character interactor) { } public bool IsInteractible(Character interactor) { return CanInteract(interactor); } public bool IsConstantlyInteractable(Character interactor) { return CanInteract(interactor); } private bool CanInteract(Character interactor) { if (!_lit) { return true; } Item val = (((Object)(object)interactor == (Object)null || (Object)(object)interactor.data == (Object)null) ? null : interactor.data.currentItem); if ((Object)(object)val != (Object)null && (Object)(object)val.cooking != (Object)null) { return val.cooking.canBeCooked; } return false; } public float GetInteractTime(Character interactor) { return _cookTime; } } internal enum RuntimeWeatherKind { Rain, Wind, Snow } internal sealed class RuntimeVanillaWeather : MonoBehaviour { private Bounds _bounds; private RuntimeWeatherKind _kind; private ParticleSystem[] _particles = Array.Empty(); private Transform[] _visualRoots = Array.Empty(); private Renderer[] _effectRenderers = Array.Empty(); private AudioSource[] _effectAudio = Array.Empty(); private float _onSeconds = 35f; private float _offSeconds = 50f; private float _windForce = 15f; private float _statusPerSecond = 0.01f; private bool _active; private Vector3 _direction; private float _minimumProgressZ = float.NegativeInfinity; private float _maximumProgressZ = float.PositiveInfinity; private float _coldExposureSeconds; internal void Initialize(GameObject root, Bounds bounds, RuntimeWeatherKind kind, float minimumProgressZ, float maximumProgressZ) { //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_0118: 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_0121: Unknown result type (might be due to invalid IL or missing references) _bounds = bounds; _kind = kind; _minimumProgressZ = minimumProgressZ; _maximumProgressZ = maximumProgressZ; WindChillZone[] componentsInChildren = root.GetComponentsInChildren(true); if (componentsInChildren.Length != 0) { WindChillZone val = componentsInChildren[0]; _onSeconds = Mathf.Max(10f, (val.windTimeRangeOn.x + val.windTimeRangeOn.y) * 0.5f); _offSeconds = Mathf.Max(10f, (val.windTimeRangeOff.x + val.windTimeRangeOff.y) * 0.5f); _windForce = ((val.windForce > 0f) ? val.windForce : _windForce); _statusPerSecond = ((val.statusApplicationPerSecond > 0f) ? val.statusApplicationPerSecond : _statusPerSecond); } HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); StormVisual[] componentsInChildren2 = root.GetComponentsInChildren(true); ParticleSystem[] part; foreach (StormVisual val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)null || val2.part == null) { continue; } StormType val3 = (StormType)(kind switch { RuntimeWeatherKind.Snow => 1, RuntimeWeatherKind.Rain => 0, _ => 2, }); if (val2.stormType != val3) { continue; } hashSet2.Add(((Component)val2).transform); part = val2.part; foreach (ParticleSystem val4 in part) { if ((Object)(object)val4 != (Object)null) { hashSet.Add(val4); } } } part = root.GetComponentsInChildren(true); foreach (ParticleSystem val5 in part) { string text = ((Object)val5).name.ToLowerInvariant(); if ((kind == RuntimeWeatherKind.Rain && text.Contains("rain")) || (kind == RuntimeWeatherKind.Snow && (text.Contains("snow") || text.Contains("blizzard"))) || (kind == RuntimeWeatherKind.Wind && text.Contains("wind"))) { hashSet.Add(val5); } } _particles = new List(hashSet).ToArray(); _visualRoots = new List(hashSet2).ToArray(); HashSet hashSet3 = new HashSet(); HashSet hashSet4 = new HashSet(); Transform[] visualRoots = _visualRoots; foreach (Transform val6 in visualRoots) { Renderer[] componentsInChildren3 = ((Component)val6).GetComponentsInChildren(true); foreach (Renderer item in componentsInChildren3) { hashSet3.Add(item); } AudioSource[] componentsInChildren4 = ((Component)val6).GetComponentsInChildren(true); foreach (AudioSource item2 in componentsInChildren4) { hashSet4.Add(item2); } } _effectRenderers = new List(hashSet3).ToArray(); _effectAudio = new List(hashSet4).ToArray(); _onSeconds = Mathf.Max(25f, _onSeconds); _offSeconds = Mathf.Min(25f, _offSeconds); SetVisualState(visible: false, Character.localCharacter); Debug.Log((object)("[AllBiomes] " + kind.ToString() + " vanilla-derived weather zones=" + componentsInChildren.Length + " particles=" + _particles.Length + " on=" + _onSeconds + " off=" + _offSeconds + " force=" + _windForce + " status=" + _statusPerSecond)); } private void Update() { //IL_004d: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } float num = _onSeconds + _offSeconds; int num2 = (int)(PhotonNetwork.Time / (double)num); float num3 = (float)(PhotonNetwork.Time % (double)num); bool flag = num3 >= _offSeconds; Vector3 val = Vector3.Lerp(((num2 & 1) == 0) ? Vector3.right : Vector3.left, Vector3.forward, 0.2f); _direction = ((Vector3)(ref val)).normalized; bool flag2 = localCharacter.Center.z >= _minimumProgressZ && localCharacter.Center.z <= _maximumProgressZ; if (flag != _active) { _active = flag; Debug.Log((object)("[AllBiomes] " + _kind.ToString() + " " + (_active ? "START" : "STOP") + " cycle=" + num2)); } SetVisualState(_active && flag2, localCharacter); if (!flag2) { _coldExposureSeconds = Mathf.Max(0f, _coldExposureSeconds - Time.deltaTime * 2f); return; } if (!_active) { _coldExposureSeconds = Mathf.Max(0f, _coldExposureSeconds - Time.deltaTime * 2f); if (_kind == RuntimeWeatherKind.Snow && localCharacter.refs != null && (Object)(object)localCharacter.refs.afflictions != (Object)null) { localCharacter.refs.afflictions.SubtractStatus((STATUSTYPE)2, Mathf.Max(Ascents.nightColdRate, _statusPerSecond) * Time.deltaTime, false, true); } return; } float num4 = Exposure(localCharacter.Center); if (num4 <= 0f) { _coldExposureSeconds = Mathf.Max(0f, _coldExposureSeconds - Time.deltaTime * 2f); return; } float num5 = Mathf.Clamp01((num3 - _offSeconds) / 5f); if (_kind == RuntimeWeatherKind.Rain) { localCharacter.data.slippy = Mathf.Clamp01(Mathf.Max(localCharacter.data.slippy, num4 * num5)); } else { localCharacter.RPCA_AddForceToBodyPart((BodypartType)2, Vector3.zero, _direction * _windForce * num4 * num5); if (_kind == RuntimeWeatherKind.Snow) { _coldExposureSeconds += Time.deltaTime * num4; float num6 = Mathf.InverseLerp(0f, 22f, _coldExposureSeconds); localCharacter.refs.afflictions.AddStatus((STATUSTYPE)2, _statusPerSecond * num4 * num5 * num6 * Time.deltaTime, false, true, true, false); } } Shader.SetGlobalFloat("GlobalWind", num5 * num4); } private void SetVisualState(bool visible, Character character) { //IL_0026: 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_0037: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Transform[] visualRoots = _visualRoots; foreach (Transform val in visualRoots) { if (!((Object)(object)val == (Object)null) && visible && (Object)(object)character != (Object)null) { val.position = character.Center; val.rotation = Quaternion.LookRotation((_direction == Vector3.zero) ? Vector3.forward : _direction); } } ParticleSystem[] particles = _particles; foreach (ParticleSystem val2 in particles) { if ((Object)(object)val2 == (Object)null) { continue; } if (visible) { if (!val2.isPlaying) { val2.Play(true); } } else if (val2.isPlaying) { val2.Stop(true, (ParticleSystemStopBehavior)0); } } Renderer[] effectRenderers = _effectRenderers; foreach (Renderer val3 in effectRenderers) { if ((Object)(object)val3 != (Object)null) { val3.enabled = visible; } } AudioSource[] effectAudio = _effectAudio; foreach (AudioSource val4 in effectAudio) { if (!((Object)(object)val4 == (Object)null)) { ((Behaviour)val4).enabled = visible; if (visible && !val4.isPlaying && (Object)(object)val4.clip != (Object)null) { val4.Play(); } else if (!visible && val4.isPlaying) { val4.Stop(); } } } } private float Exposure(Vector3 point) { //IL_0017: 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) if (_kind == RuntimeWeatherKind.Rain || _kind == RuntimeWeatherKind.Wind) { return 1f; } RaycastHit val = default(RaycastHit); if (Physics.Raycast(point, -_direction, ref val, 12f, -1, (QueryTriggerInteraction)1)) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)((RaycastHit)(ref val)).transform.root != (Object)(object)((Component)localCharacter).transform.root) { return Mathf.Clamp01(((RaycastHit)(ref val)).distance / 12f); } } return 1f; } private void OnDisable() { SetVisualState(visible: false, null); Shader.SetGlobalFloat("GlobalWind", 0f); } } internal sealed class RuntimeMesaSun : MonoBehaviour { private Bounds _bounds; private float _minZ; private float _maxZ; private float _counter; private float _exposureSeconds; internal void Initialize(Bounds bounds, float minZ, float maxZ) { //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) _bounds = bounds; _minZ = minZ; _maxZ = maxZ; } private void Update() { //IL_0010: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || localCharacter.Center.z < _minZ || localCharacter.Center.z > _maxZ || (Object)(object)DayNightManager.instance == (Object)null || (Object)(object)DayNightManager.instance.sun == (Object)null || !((Component)DayNightManager.instance.sun).gameObject.activeInHierarchy) { _exposureSeconds = Mathf.Max(0f, _exposureSeconds - Time.deltaTime * 3f); return; } Transform transform = ((Component)DayNightManager.instance.sun).transform; RaycastHit val = HelperFunctions.LineCheck(localCharacter.Center + transform.forward * -1000f, localCharacter.Center, (LayerType)0, 0f, (QueryTriggerInteraction)1); if ((Object)(object)((RaycastHit)(ref val)).transform != (Object)null && (Object)(object)((RaycastHit)(ref val)).transform.root != (Object)(object)((Component)localCharacter).transform.root) { _exposureSeconds = Mathf.Max(0f, _exposureSeconds - Time.deltaTime * 3f); return; } _exposureSeconds += Time.deltaTime; _counter += Time.deltaTime; if (!(_counter < 0.5f)) { _counter = 0f; float num = Mathf.InverseLerp(0f, 25f, _exposureSeconds); if (num > 0f) { localCharacter.refs.afflictions.AddSunHeat(Mathf.Lerp(0.004f, 0.025f, num)); } } } } internal static class RuntimeTornadoRegistry { private static readonly List PointSets = new List(); private static readonly FieldInfo TargetParentField = typeof(Tornado).GetField("targetParent", BindingFlags.Instance | BindingFlags.NonPublic); internal static void Register(Transform points) { if ((Object)(object)points != (Object)null) { PointSets.Add(points); } } internal static void Clear() { PointSets.Clear(); } internal static void Attach(Tornado tornado) { //IL_0052: 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) if ((Object)(object)tornado == (Object)null) { return; } PointSets.RemoveAll((Transform p) => (Object)(object)p == (Object)null); Transform val = null; float num = float.PositiveInfinity; foreach (Transform pointSet in PointSets) { float num2 = Vector3.SqrMagnitude(pointSet.position - ((Component)tornado).transform.position); if (num2 < num) { num = num2; val = pointSet; } } if ((Object)(object)val != (Object)null) { TargetParentField?.SetValue(tornado, val); } else { Debug.LogError((object)"[AllBiomes] Tornado target points missing"); } } } [HarmonyPatch(typeof(Tornado), "Start")] internal static class RuntimeTornadoStartPatch { private static void Postfix(Tornado __instance) { RuntimeTornadoRegistry.Attach(__instance); } } internal sealed class RuntimeMesaTornadoSpawner : MonoBehaviour { private float _minZ; private float _maxZ; private float _timer = 10f; private Transform _points; internal void Initialize(GameObject root, float minZ, float maxZ) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) _minZ = minZ; _maxZ = maxZ; Bounds val = AllBiomesPlugin.BoundsOf(root); GameObject val2 = new GameObject("AllBiomes TornadoPoints"); val2.transform.SetParent(root.transform, true); val2.transform.position = new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).max.y, (minZ + maxZ) * 0.5f); _points = val2.transform; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < 8; i++) { Transform transform = new GameObject("TornadoPoint " + i).transform; transform.SetParent(_points, false); float num = (float)i / 7f; transform.position = new Vector3(Mathf.Lerp(((Bounds)(ref val)).min.x + 30f, ((Bounds)(ref val)).max.x - 30f, ((i & 1) == 0) ? 0.25f : 0.75f), ((Bounds)(ref val)).center.y, Mathf.Lerp(minZ, maxZ, num)); if (Physics.Raycast(transform.position + Vector3.up * 500f, Vector3.down, ref val3, 1200f, -1, (QueryTriggerInteraction)1)) { transform.position = ((RaycastHit)(ref val3)).point; } } RuntimeTornadoRegistry.Register(_points); Debug.Log((object)("[AllBiomes] Mesa tornado runtime ready range=" + minZ + ".." + maxZ + " points=" + _points.childCount)); } private void Update() { //IL_0044: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || (Object)(object)_points == (Object)null) { return; } bool flag = false; foreach (Character allCharacter in Character.AllCharacters) { if ((Object)(object)allCharacter != (Object)null && allCharacter.data.fullyConscious && allCharacter.Center.z >= _minZ && allCharacter.Center.z <= _maxZ) { flag = true; break; } } if (!flag) { return; } _timer -= Time.deltaTime; if (_timer > 0f) { return; } _timer = 60f; if ((Object)(object)Object.FindAnyObjectByType() != (Object)null) { return; } Transform child = _points.GetChild(Random.Range(0, _points.childCount)); try { RuntimeTornadoRegistry.Attach(PhotonNetwork.Instantiate("Tornado", child.position, Quaternion.identity, (byte)0, (object[])null).GetComponent()); Debug.Log((object)("[AllBiomes] Mesa tornado spawned at " + ((object)child.position/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Mesa tornado spawn failed: " + ex)); } } } internal sealed class RuntimeGloomFloorFog : MonoBehaviour { private float _minZ; private float _maxZ; private bool _inside; private float _fogHeight; private GameObject[] _fogPlanes = Array.Empty(); internal void Initialize(GameObject root, float minZ, float maxZ) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) _minZ = minZ; _maxZ = maxZ; Bounds val = AllBiomesPlugin.BoundsOf(root); _fogHeight = ((Bounds)(ref val)).center.y; ForceFogShaderHeight[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ForceFogShaderHeight val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && (int)val2.fogType == 0) { _fogHeight = ((Component)val2).transform.position.y; break; } } HashSet hashSet = new HashSet(); LavaRising[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (LavaRising val3 in componentsInChildren2) { if ((Object)(object)val3 != (Object)null && val3.isGloom && (Object)(object)val3.fogPlane != (Object)null) { hashSet.Add(val3.fogPlane); } } _fogPlanes = new List(hashSet).ToArray(); Debug.Log((object)("[AllBiomes] Gloom floor fog range=" + minZ + ".." + maxZ + " height=" + _fogHeight + " planes=" + _fogPlanes.Length)); } private void Update() { //IL_0010: 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) Character localCharacter = Character.localCharacter; bool flag = (Object)(object)localCharacter != (Object)null && localCharacter.Center.z >= _minZ && localCharacter.Center.z <= _maxZ; if (flag) { Shader.SetGlobalFloat("HeightFogSpirit", 1f); Shader.SetGlobalFloat("HeightFogAmount", 1f); Shader.SetGlobalFloat("HeightFogHeight", _fogHeight); } else if (_inside) { Shader.SetGlobalFloat("HeightFogSpirit", 0f); Shader.SetGlobalFloat("HeightFogAmount", 0f); } if (flag == _inside) { return; } _inside = flag; GameObject[] fogPlanes = _fogPlanes; foreach (GameObject val in fogPlanes) { if ((Object)(object)val != (Object)null) { val.SetActive(flag); } } Debug.Log((object)("[AllBiomes] Gloom floor fog " + (flag ? "ENTER" : "EXIT") + " height=" + _fogHeight)); } private void OnDisable() { if (_inside) { Shader.SetGlobalFloat("HeightFogSpirit", 0f); Shader.SetGlobalFloat("HeightFogAmount", 0f); } } } internal sealed class RuntimeAlpineWeather : MonoBehaviour { private Bounds _bounds; private ParticleSystem[] _snow; private float _statusTimer; private bool _lastStorm; private int _characterId; private Rigidbody[] _characterBodies = Array.Empty(); internal void Initialize(Bounds bounds) { //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) _bounds = bounds; List list = new List(); ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("snow") || text.Contains("storm") || text.Contains("blizzard") || text.Contains("wind")) { list.Add(val); } } } _snow = list.ToArray(); Debug.Log((object)("[AllBiomes] Alpine runtime weather particles=" + _snow.Length + " bounds=" + ((object)Unsafe.As(ref _bounds)/*cast due to .constrained prefix*/).ToString())); } private void Update() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } int instanceID = ((Object)localCharacter).GetInstanceID(); if (instanceID != _characterId) { _characterId = instanceID; _characterBodies = ((Component)localCharacter).GetComponentsInChildren(true); } bool flag = ((Bounds)(ref _bounds)).Contains(localCharacter.Center) && (int)(PhotonNetwork.Time / 30.0) % 2 == 0; if (flag != _lastStorm) { ParticleSystem[] snow = _snow; foreach (ParticleSystem val in snow) { if (!((Object)(object)val == (Object)null)) { if (flag) { val.Play(); } else { val.Stop(true, (ParticleSystemStopBehavior)1); } } } _lastStorm = flag; Debug.Log((object)("[AllBiomes] Alpine runtime blizzard " + (flag ? "started" : "stopped"))); } if (!flag) { return; } _statusTimer += Time.deltaTime; if (_statusTimer >= 0.5f) { _statusTimer = 0f; localCharacter.refs.afflictions.AddStatus((STATUSTYPE)2, 0.0025f, false, true, true, false); } Vector3 val2 = Vector3.right * (2f + Mathf.Sin((float)PhotonNetwork.Time) * 1.5f); Rigidbody[] characterBodies = _characterBodies; foreach (Rigidbody val3 in characterBodies) { if ((Object)(object)val3 != (Object)null && !val3.isKinematic) { val3.AddForce(val2, (ForceMode)5); } } } } internal sealed class RuntimeCitadelSpikeAdapter : MonoBehaviour { private SpikeTrap _trap; private MethodInfo _attackMethod; private FieldInfo _attackingField; internal void Initialize(SpikeTrap trap) { _trap = trap; _attackMethod = typeof(SpikeTrap).GetMethod("SpikeTrapRPC", BindingFlags.Instance | BindingFlags.NonPublic); _attackingField = typeof(SpikeTrap).GetField("_isAttacking", BindingFlags.Instance | BindingFlags.NonPublic); if ((Object)(object)_trap.spikes != (Object)null) { ((Component)_trap.spikes).gameObject.SetActive(false); } if ((Object)(object)_trap.hitbox != (Object)null) { _trap.hitbox.SetActive(false); } if (_attackMethod == null || _attackingField == null) { Debug.LogError((object)("[AllBiomes] Citadel spike adapter could not resolve vanilla SpikeTrap members at " + ((Object)this).name)); } } private void OnTriggerEnter(Collider other) { Character val = default(Character); if ((Object)(object)_trap == (Object)null || _attackMethod == null || _attackingField == null || !CharacterRagdoll.TryGetCharacterFromCollider(other, ref val) || (Object)(object)val == (Object)null || !val.IsLocal) { return; } try { if (!(bool)_attackingField.GetValue(_trap)) { _attackMethod.Invoke(_trap, null); } } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Citadel spike activation failed at " + ((Object)this).name + ": " + ex)); } } } internal sealed class RuntimeLavaCycle : MonoBehaviour { private sealed class LavaTarget { internal readonly Rigidbody Body; internal readonly Transform Transform; internal readonly float Low; internal readonly float High; internal LavaTarget(Rigidbody body, float low, float high) { Body = body; Transform = null; Low = low; High = high; } internal LavaTarget(Transform transform, float low, float high) { Body = null; Transform = transform; Low = low; High = high; } } private readonly List _targets = new List(); private float _minZ; private float _maxZ; private bool _waitForCampfire; internal void Initialize(GameObject root, float minZ, float maxZ, bool waitForCampfire) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01ca: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) _minZ = minZ; _maxZ = maxZ; _waitForCampfire = waitForCampfire; LavaRising[] componentsInChildren = root.GetComponentsInChildren(true); foreach (LavaRising val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.lava == (Object)null)) { float num = (((Object)(object)val.heightMinimumTransform != (Object)null) ? val.heightMinimumTransform.position.y : val.lava.position.y); float num2 = (((Object)(object)val.topTransform != (Object)null) ? val.topTransform.position.y : (num + 40f)); if (!waitForCampfire) { num2 = num + (num2 - num) * 0.5f; } _targets.Add(new LavaTarget(val.lava, num, num2)); } } MovingLava[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (MovingLava val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).transform == (Object)null)) { float num3 = (waitForCampfire ? 40f : 20f); _targets.Add(new LavaTarget(((Component)val2).transform, ((Component)val2).transform.position.y, ((Component)val2).transform.position.y + num3)); } } if (_targets.Count == 0) { Lava[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (Lava val3 in componentsInChildren3) { if ((Object)(object)val3 == (Object)null) { continue; } Renderer componentInChildren = ((Component)val3).GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null) { continue; } Bounds bounds = componentInChildren.bounds; if (!(((Bounds)(ref bounds)).size.x < 10f)) { bounds = componentInChildren.bounds; if (!(((Bounds)(ref bounds)).size.z < 10f)) { float num4 = (waitForCampfire ? 25f : 12.5f); _targets.Add(new LavaTarget(((Component)val3).transform, ((Component)val3).transform.position.y, ((Component)val3).transform.position.y + num4)); } } } } if (_waitForCampfire) { ApplyPhase(0f); } Debug.Log((object)("[AllBiomes] " + (_waitForCampfire ? "Kiln" : "Caldera") + " runtime lava cycle targets=" + _targets.Count + " startsLow=" + _waitForCampfire + " heightScale=" + (_waitForCampfire ? "1.0" : "0.5"))); } private void FixedUpdate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; float phase; if (_waitForCampfire) { RuntimeCampfireAdapter componentInChildren = ((Component)this).GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null || !componentInChildren.IsLit || componentInChildren.LitNetworkTime < 0.0) { ApplyPhase(0f); return; } phase = Mathf.Clamp01((float)((PhotonNetwork.Time - componentInChildren.LitNetworkTime - 180.0) / 1200.0)); } else { if ((Object)(object)localCharacter == (Object)null || localCharacter.Center.z < _minZ || localCharacter.Center.z > _maxZ) { return; } RunManager instance = RunManager.Instance; if ((Object)(object)instance == (Object)null) { return; } phase = Mathf.PingPong(instance.TimeSinceRunStarted / 90f, 1f); } ApplyPhase(phase); } private void ApplyPhase(float phase) { //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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) foreach (LavaTarget target in _targets) { if ((Object)(object)target.Body != (Object)null) { Vector3 position = target.Body.position; position.y = Mathf.Lerp(target.Low, target.High, phase); target.Body.MovePosition(position); } else if ((Object)(object)target.Transform != (Object)null) { Vector3 position2 = target.Transform.position; position2.y = Mathf.Lerp(target.Low, target.High, phase); target.Transform.position = position2; } } } } internal sealed class RuntimeStableBridge : MonoBehaviour { private BoxCollider _walkway; internal unsafe bool Initialize(Transform bridgeRoot, Renderer[] renderers) { //IL_0016: 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_00f4: 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) //IL_004e: 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_013d: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01e4: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bridgeRoot == (Object)null || renderers == null || renderers.Length == 0) { return false; } bool flag = false; Bounds val = default(Bounds); foreach (Renderer val2 in renderers) { if ((Object)(object)val2 == (Object)null || !val2.enabled) { continue; } Bounds bounds = val2.bounds; for (int j = -1; j <= 1; j += 2) { for (int k = -1; k <= 1; k += 2) { for (int l = -1; l <= 1; l += 2) { Vector3 val3 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)j, (float)k, (float)l)); Vector3 val4 = bridgeRoot.InverseTransformPoint(val3); if (!flag) { ((Bounds)(ref val))..ctor(val4, Vector3.zero); flag = true; } else { ((Bounds)(ref val)).Encapsulate(val4); } } } } } if (!flag) { return false; } float num = Mathf.Max(((Bounds)(ref val)).size.x, ((Bounds)(ref val)).size.z); if (num < 2f || num > 150f) { Debug.LogWarning((object)("[AllBiomes] Rejected implausible Shore bridge bounds=" + ((object)(*(Bounds*)(&val))/*cast due to .constrained prefix*/).ToString())); return false; } GameObject val5 = new GameObject("AllBiomes Stable Bridge Walkway"); val5.layer = ((Component)bridgeRoot).gameObject.layer; val5.transform.SetParent(bridgeRoot, false); _walkway = val5.AddComponent(); Vector3 size = ((Bounds)(ref val)).size; size.y = 0.35f; if (size.x < size.z) { size.x = Mathf.Max(size.x, 1.4f); } else { size.z = Mathf.Max(size.z, 1.4f); } _walkway.center = new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).center.y + 0.18f, ((Bounds)(ref val)).center.z); _walkway.size = size; ((Collider)_walkway).isTrigger = false; Debug.Log((object)("[AllBiomes] Stable Shore bridge path=" + ((Object)bridgeRoot).name + " center=" + ((object)_walkway.center/*cast due to .constrained prefix*/).ToString() + " size=" + ((object)_walkway.size/*cast due to .constrained prefix*/).ToString())); return true; } } internal sealed class RuntimeAllBiomesGhostSpawner : MonoBehaviour { private GhostBall _current; private GhostBall _prefab; private Transform _spawnHeight; private Transform _maxHeight; private Transform _chaseHeight; private Transform _maxDepth; private float _offset; private float _randomization; private float _timer; private float _elapsed; internal void Initialize(GhostBallSpawner source) { _prefab = source.ghostBallPrefab; _spawnHeight = source.spawnHeightTransform; _maxHeight = source.maxHeightTransform; _chaseHeight = source.chaseHeightTransform; _maxDepth = source.spawnMaxDepthTransform; _offset = source.spawnOffset; _randomization = source.spawnOffsetRandomization; _timer = Random.Range(source.timeBetweenSpawns.x, source.timeBetweenSpawns.y); ((Behaviour)this).enabled = (Object)(object)_prefab != (Object)null && (Object)(object)_spawnHeight != (Object)null && (Object)(object)_maxHeight != (Object)null && (Object)(object)_chaseHeight != (Object)null && (Object)(object)_maxDepth != (Object)null; if (!((Behaviour)this).enabled) { Debug.LogError((object)"[AllBiomes] Gloom ghost adapter missing one or more vanilla references"); } } private unsafe void Update() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0113: 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) if (!PhotonNetwork.IsMasterClient || (Object)(object)_current != (Object)null || (Object)(object)_prefab == (Object)null) { return; } Character val = SelectTarget(); if ((Object)(object)val == (Object)null) { _elapsed = 0f; return; } _elapsed += Time.deltaTime; if (_elapsed < _timer) { return; } try { Vector3 val2 = Vector3.ProjectOnPlane(Random.insideUnitSphere, Vector3.up) * _randomization; Vector3 val3 = val.Center + Vector3.forward * _offset + val2; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(val3.x, _spawnHeight.position.y, val3.z); GameObject val5 = PhotonNetwork.InstantiateRoomObject(((Object)((Component)_prefab).gameObject).name, val4, Quaternion.identity, (byte)0, (object[])null); _current = val5.GetComponent(); if ((Object)(object)_current == (Object)null) { throw new InvalidOperationException("Ghost prefab has no GhostBall component"); } _current.maxHeight = _maxHeight.position.y; _current.chaseHeight = _chaseHeight.position.y; Debug.Log((object)("[AllBiomes] Gloom ghost spawned at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString())); } catch (Exception ex) { Debug.LogError((object)("[AllBiomes] Gloom ghost spawn failed: " + ex)); } _elapsed = 0f; _timer += Random.Range(5f, 20f); } private Character SelectTarget() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Character val = null; foreach (Character allCharacter in Character.AllCharacters) { if (!((Object)(object)allCharacter == (Object)null) && allCharacter.data.fullyConscious && !(allCharacter.Center.y > _maxHeight.position.y) && !(allCharacter.Center.z > _maxDepth.position.z) && ((Object)(object)val == (Object)null || allCharacter.Center.z > val.Center.z)) { val = allCharacter; } } return val; } } internal sealed class RuntimeSegment { internal readonly int Index; internal readonly string Name; internal readonly GameObject Root; internal Bounds Bounds; internal Vector3 Entrance; internal Vector3 Exit; internal RuntimeSegment(int index, string name, GameObject root, Bounds bounds, Vector3 entrance, Vector3 exit) { //IL_001c: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Index = index; Name = name; Root = root; Bounds = bounds; Entrance = entrance; Exit = exit; } } internal sealed class SegmentPose { internal readonly Vector3 Position; internal readonly Quaternion Rotation; internal SegmentPose(Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Position = position; Rotation = rotation; } } internal sealed class RuntimeMobPoint { internal readonly string PrefabName; internal readonly Vector3 Position; internal readonly Quaternion Rotation; internal readonly GameObject Dummy; internal readonly string SpawnMethod; internal readonly string Biome; internal RuntimeMobPoint(string prefabName, Vector3 position, Quaternion rotation, GameObject dummy, string spawnMethod, string biome) { //IL_000e: 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_0015: 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) PrefabName = prefabName; Position = position; Rotation = rotation; Dummy = dummy; SpawnMethod = spawnMethod; Biome = biome; } } internal sealed class StaticReference { internal readonly FieldInfo Field; internal readonly Object Value; internal StaticReference(FieldInfo field, Object value) { Field = field; Value = value; } } internal sealed class Source { internal readonly int Index; internal readonly BiomeType Biome; internal readonly GameObject Root; internal readonly Transform Reconnect; internal readonly GameObject WallNext; internal Source(int index, BiomeType biome, GameObject root, Transform reconnect, GameObject wallNext) { //IL_000e: 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) Index = index; Biome = biome; Root = root; Reconnect = reconnect; WallNext = wallNext; } } internal sealed class BiomeAsset { internal readonly string Name; internal readonly BiomeType BiomeType; internal readonly string RootName; internal readonly int DonorBuildIndex; internal readonly string DonorName; internal readonly string[] RequiredPathParts; internal BiomeAsset(string name, BiomeType biomeType, string rootName, int donorBuildIndex, string donorName, params string[] requiredPathParts) { //IL_000e: 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) Name = name; BiomeType = biomeType; RootName = rootName; DonorBuildIndex = donorBuildIndex; DonorName = donorName; RequiredPathParts = requiredPathParts; } } internal sealed class DonorSelection { internal readonly int BuildIndex; internal readonly int Renderers; internal readonly int Colliders; internal DonorSelection(int buildIndex, int renderers, int colliders) { BuildIndex = buildIndex; Renderers = renderers; Colliders = colliders; } public override string ToString() { return "Level_" + BuildIndex + " renderers=" + Renderers + " colliders=" + Colliders; } } }