Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DungeonSizeLimiter v1.1.0
DungeonSizeLimiter.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DungeonSizeLimiter.Patches; using DungeonSizeLimiter.Radar; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.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 DungeonSizeLimiter { public static class Configuration { public static ConfigEntry<float> MaxDungeonSizeMultiplier { get; private set; } public static ConfigEntry<float> MinDungeonSizeMultiplier { get; private set; } public static ConfigEntry<bool> SanitizeBoxColliders { get; private set; } public static ConfigEntry<bool> SuppressHarmlessConsoleSpam { get; private set; } public static ConfigEntry<bool> AccelerateStartupTypeCache { get; private set; } public static ConfigEntry<bool> FixAllMoonsInTerminal { get; private set; } public static ConfigEntry<bool> RestoreNaturalMoonPrices { get; private set; } public static ConfigEntry<bool> EnableAllScrapOnAllMoons { get; private set; } public static ConfigEntry<bool> EnableAllMonstersOnAllMoons { get; private set; } public static ConfigEntry<bool> KeepLockerItemsOnTeamWipe { get; private set; } public static ConfigEntry<bool> HealToFullInOrbit { get; private set; } public static ConfigEntry<bool> EnableWiderShipCompatibility { get; private set; } public static ConfigEntry<bool> EnableEntranceRadar { get; private set; } public static ConfigEntry<string> TrailColorHex { get; private set; } public static ConfigEntry<float> PulseDuration { get; private set; } public static ConfigEntry<float> PulseSpeed { get; private set; } public static ConfigEntry<float> TrailWidth { get; private set; } public static ConfigEntry<float> HeightOffset { get; private set; } public static ConfigEntry<string> TargetMode { get; private set; } public static Color TrailColor { get; private set; } = new Color(1f, 0.42f, 0f, 1f); public static ConfigEntry<bool> EnableTwoHandedLadders { get; private set; } public static ConfigEntry<bool> EnableAutoLadderClimb { get; private set; } public static ConfigEntry<float> LadderBoostForce { get; private set; } public static void Init(ConfigFile cfg) { //IL_0250: 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) MaxDungeonSizeMultiplier = cfg.Bind<float>("DungeonSize", "MaxDungeonSizeMultiplier", 1.35f, "Maximum allowed dungeon size multiplier across ALL moons and interiors. Vanilla moons are usually 1.0 - 1.3. Modded moons often push 2.5 - 4.0 which causes timeouts, desyncs, and crashes. Default 1.35 keeps generation fast, stable, and perfectly playable."); MinDungeonSizeMultiplier = cfg.Bind<float>("DungeonSize", "MinDungeonSizeMultiplier", 0.8f, "Minimum allowed dungeon size multiplier."); SanitizeBoxColliders = cfg.Bind<bool>("Optimization", "SanitizeBoxColliders", true, "Automatically fixes negative-scaled BoxColliders in custom dungeon prefabs (such as Deep Sewers) to prevent Unity from printing thousands of collision warnings and lagging the main thread."); SuppressHarmlessConsoleSpam = cfg.Bind<bool>("Optimization", "SuppressHarmlessConsoleSpam", true, "Silences harmless Unity asset warnings (missing editor scripts, non-readable NavMesh source meshes, null PlayOneShot clips, HarmonyX soft-dependency warnings) while keeping all genuine errors visible."); AccelerateStartupTypeCache = cfg.Bind<bool>("Optimization", "AccelerateStartupTypeCache", true, "Caches Harmony AccessTools.GetTypesFromAssembly results in memory so 110+ mods do not repeatedly throw ReflectionTypeLoadExceptions during startup."); FixAllMoonsInTerminal = cfg.Bind<bool>("ModpackFixes", "FixAllMoonsInTerminal", true, "Fixes DawnLib's inverted confirm/deny terminalOptions on LethalLevelLoader custom moons, fixes CrackedTerminal scrollbar/mousewheel, and ensures all moons appear and route properly."); RestoreNaturalMoonPrices = cfg.Bind<bool>("ModpackFixes", "RestoreNaturalMoonPrices", true, "Neutralizes FreeMoons overrides and restores natural moon routing prices across vanilla and custom LLL/DawnLib moons."); EnableAllScrapOnAllMoons = cfg.Bind<bool>("ModpackFixes", "EnableAllScrapOnAllMoons", true, "Repairs custom scrap items with null ItemGroup entries and ensures all valid floor scrap items can spawn across all moons and interiors."); EnableAllMonstersOnAllMoons = cfg.Bind<bool>("ModpackFixes", "EnableAllMonstersOnAllMoons", true, "Ensures all valid Inside, Outside, and Daytime monsters can spawn across all moons and interiors."); KeepLockerItemsOnTeamWipe = cfg.Bind<bool>("Gameplay", "KeepLockerItemsOnTeamWipe", true, "Preserves scrap items stored inside the ship's Storage Locker when all players die on a moon (items outside the locker on the ship floor are still lost on team wipe)."); HealToFullInOrbit = cfg.Bind<bool>("Gameplay", "HealToFullInOrbit", true, "Restores all surviving players to 100 HP and clears critical injuries/bleeding upon returning to orbit."); EnableWiderShipCompatibility = cfg.Bind<bool>("Gameplay", "EnableWiderShipCompatibility", true, "Fixes WiderShipMod + 2StoryShip + ShipWindows compatibility: resolves 'Can't exit terminal' lockup, pre-initializes window materials, re-aligns magnet switch to new wider wall, and guards level generation."); EnableEntranceRadar = cfg.Bind<bool>("EntranceRadar", "EnableEntranceRadar", true, "Enables RMB scanner facility radar trail, camera-facing floating billboard icon, and bottom-right visor distance HUD."); TrailColorHex = cfg.Bind<string>("EntranceRadar", "TrailColorHex", "#FF6A00", "Hex color code for the orange pulse trail (default: #FF6A00 high-vis orange)."); PulseDuration = cfg.Bind<float>("EntranceRadar", "PulseDuration", 2.5f, "Duration of the pulse animation in seconds (matches scan duration)."); PulseSpeed = cfg.Bind<float>("EntranceRadar", "PulseSpeed", 45f, "Speed at which the pulse wave travels along the path in meters per second."); TrailWidth = cfg.Bind<float>("EntranceRadar", "TrailWidth", 0.24f, "Width of the trail in meters."); HeightOffset = cfg.Bind<float>("EntranceRadar", "HeightOffset", 0.25f, "Vertical offset in meters above terrain to prevent clipping/z-fighting."); TargetMode = cfg.Bind<string>("EntranceRadar", "TargetMode", "MainEntrance", "Entrance target mode: 'MainEntrance' or 'NearestEntrance'."); Color trailColor = default(Color); if (ColorUtility.TryParseHtmlString(TrailColorHex.Value, ref trailColor)) { TrailColor = trailColor; } else { TrailColor = new Color(1f, 0.42f, 0f, 1f); } EnableTwoHandedLadders = cfg.Bind<bool>("Ladders", "EnableTwoHandedLadders", true, "Enables climbing all ladders while carrying two-handed scrap, big engines, or drills."); EnableAutoLadderClimb = cfg.Bind<bool>("Ladders", "EnableAutoLadderClimb", true, "Enables Half-Life 1 style ladder climbing: walking into a ladder climbs automatically; pressing Space jumps off."); LadderBoostForce = cfg.Bind<float>("Ladders", "LadderBoostForce", 4.5f, "Horizontal push force when jumping off a ladder with Space."); } } [BepInPlugin("com.khameli0n.dungeonsizelimiter", "DungeonSizeLimiter", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.khameli0n.dungeonsizelimiter"; public const string PLUGIN_NAME = "DungeonSizeLimiter"; public const string PLUGIN_VERSION = "1.1.0"; public const string PLUGIN_AUTHOR = "Khameli0n"; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public static Harmony HarmonyInstance { get; private set; } private void Awake() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Configuration.Init(((BaseUnityPlugin)this).Config); try { if (Debug.unityLogger != null && Debug.unityLogger.logHandler != null) { Debug.unityLogger.logHandler = (ILogHandler)(object)new FilteredLogHandler(Debug.unityLogger.logHandler); Log.LogInfo((object)"Installed FilteredLogHandler to silence BoxCollider negative-scale spam."); } HarmonyInstance = new Harmony("com.khameli0n.dungeonsizelimiter"); HarmonyInstance.PatchAll(); ModpackFixes.TryApplyDynamicPatches(HarmonyInstance); WiderShipCompatPatches.TryApplyPatches(HarmonyInstance); if (Configuration.EnableEntranceRadar.Value) { PulseTrailRenderer.GetOrCreate(); Log.LogInfo((object)"Entrance Radar module initialized."); } Log.LogInfo((object)"================================================================================"); Log.LogInfo((object)"DungeonSizeLimiter v1.1.0 by Khameli0n ALL-IN-ONE CORE LOADED SUCCESSFULLY!"); Log.LogInfo((object)$" [+] Dungeon Size Clamped to {Configuration.MaxDungeonSizeMultiplier.Value:F2}x"); Log.LogInfo((object)(" [+] Facility Entrance Radar (RMB scan trail + door beacon): " + (Configuration.EnableEntranceRadar.Value ? "ENABLED" : "DISABLED"))); Log.LogInfo((object)(" [+] Two-Handed Ladder & HL1 Auto-Climbing: " + (Configuration.EnableTwoHandedLadders.Value ? "ENABLED" : "DISABLED"))); Log.LogInfo((object)(" [+] WiderShip + 2StoryShip + ShipWindows Terminal Unfreeze: " + (Configuration.EnableWiderShipCompatibility.Value ? "ENABLED" : "DISABLED"))); Log.LogInfo((object)(" [+] 55-Moon CrackedTerminal & Scrollbar Fix: " + (Configuration.FixAllMoonsInTerminal.Value ? "ENABLED" : "DISABLED"))); Log.LogInfo((object)" [+] Natural Moon Prices & Team-Wipe Locker Protection: ACTIVE"); Log.LogInfo((object)" [+] Universal Scrap (265+) & Monster (138+) Dynamic Pools: ACTIVE"); Log.LogInfo((object)"================================================================================"); } catch (Exception arg) { Log.LogError((object)$"Failed to patch: {arg}"); } } } } namespace DungeonSizeLimiter.Radar { public static class EntranceManager { private static GameObject scanNodeObject = null; private static Sprite fallbackReticleSprite = null; public static Vector3 MainEntrancePosition { get; private set; } = Vector3.zero; public static Vector3 MainEntranceNavPosition { get; private set; } = Vector3.zero; public static bool HasValidEntrance { get; private set; } = false; public static ScanNodeProperties ActiveScanNode { get; private set; } = null; public static EntranceTeleport BestEntrance { get; private set; } = null; public static void Clear() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) HasValidEntrance = false; MainEntrancePosition = Vector3.zero; MainEntranceNavPosition = Vector3.zero; BestEntrance = null; if ((Object)(object)scanNodeObject != (Object)null) { Object.Destroy((Object)(object)scanNodeObject); scanNodeObject = null; ActiveScanNode = null; } } public static bool RefreshEntrances() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_00b0: 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_01d3: 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_00c2: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; BestEntrance = null; EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); EntranceTeleport val2 = null; if (array != null && array.Length != 0) { foreach (EntranceTeleport val3 in array) { if ((Object)(object)val3 != (Object)null && val3.isEntranceToBuilding && val3.entranceId == 0) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { foreach (EntranceTeleport val4 in array) { if ((Object)(object)val4 != (Object)null && val4.isEntranceToBuilding) { val2 = val4; break; } } } } if ((Object)(object)val2 != (Object)null) { BestEntrance = val2; val = (((Object)(object)val2.entrancePoint != (Object)null) ? val2.entrancePoint.position : ((Component)val2).transform.position); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[EntranceRadar] Found door via EntranceTeleport '{((Object)val2).name}' (entranceId: {val2.entranceId}) at {val}"); } } else if ((Object)(object)RoundManager.Instance != (Object)null) { try { val = RoundManager.FindMainEntrancePosition(true, true); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)$"[EntranceRadar] Found door via RoundManager.FindMainEntrancePosition at {val}"); } } catch { } } if (val == Vector3.zero) { GameObject val5 = GameObject.Find("EntranceTeleportA") ?? GameObject.Find("EntranceTeleportB") ?? GameObject.Find("MainEntrance"); if ((Object)(object)val5 != (Object)null) { val = val5.transform.position; ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)$"[EntranceRadar] Found door via GameObject search '{((Object)val5).name}' at {val}"); } } } if (val == Vector3.zero) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { log4.LogWarning((object)"[EntranceRadar] Unable to find main entrance door position in this scene."); } HasValidEntrance = false; return false; } MainEntrancePosition = val; NavMeshHit val6 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val6, 15f, -1)) { MainEntranceNavPosition = ((NavMeshHit)(ref val6)).position; } else { MainEntranceNavPosition = val; } HasValidEntrance = true; EnsureScanNode(); return true; } public static Vector3 GetEntrancePosition(Vector3 playerPosition) { //IL_00db: 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_00bc: 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_0066: 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) if (Configuration.TargetMode.Value == "NearestEntrance") { EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); if (array != null && array.Length != 0) { EntranceTeleport val = null; float num = float.MaxValue; foreach (EntranceTeleport val2 in array) { if ((Object)(object)val2 != (Object)null && val2.isEntranceToBuilding) { Vector3 val3 = (((Object)(object)val2.entrancePoint != (Object)null) ? val2.entrancePoint.position : ((Component)val2).transform.position) - playerPosition; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val = val2; } } } if ((Object)(object)val != (Object)null) { if (!((Object)(object)val.entrancePoint != (Object)null)) { return ((Component)val).transform.position; } return val.entrancePoint.position; } } } if (!HasValidEntrance) { RefreshEntrances(); } return MainEntrancePosition; } public static Vector3 GetEntranceNavPosition(Vector3 playerPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001f: 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) Vector3 entrancePosition = GetEntrancePosition(playerPosition); NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(entrancePosition, ref val, 15f, -1)) { return ((NavMeshHit)(ref val)).position; } return entrancePosition; } private static void EnsureScanNode() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //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_0044: 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_0109: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scanNodeObject != (Object)null || !HasValidEntrance) { return; } try { scanNodeObject = new GameObject("GuidedCompany_EntranceScanNode"); scanNodeObject.transform.position = MainEntrancePosition + Vector3.up * 1.5f; int num = LayerMask.NameToLayer("ScanNode"); if (num != -1) { scanNodeObject.layer = num; } BoxCollider obj = scanNodeObject.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(8f, 8f, 8f); ActiveScanNode = scanNodeObject.AddComponent<ScanNodeProperties>(); ActiveScanNode.headerText = "FACILITY MAIN ENTRANCE"; ActiveScanNode.subText = "Entry Door"; ActiveScanNode.nodeType = 0; ActiveScanNode.minRange = 0; ActiveScanNode.maxRange = 250; ActiveScanNode.requiresLineOfSight = false; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[EntranceRadar] Created scan node at {scanNodeObject.transform.position}"); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[EntranceRadar] Could not create scan node: " + ex.Message)); } } } public static Sprite GetEntranceIconSprite() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0118: 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_0222: 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_0144: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fallbackReticleSprite != (Object)null) { return fallbackReticleSprite; } int num = 64; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.45f, 0.05f, 0.95f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.65f, 0.2f, 0.35f); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { val.SetPixel(j, i, val2); } } Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(31.5f, 31.5f); float num2 = 26f; float num3 = 21f; for (int k = 0; k < num; k++) { for (int l = 0; l < num; l++) { float num4 = Vector2.Distance(new Vector2((float)l, (float)k), val5); if (num4 >= num3 && num4 <= num2) { float num5 = Mathf.Clamp01(Mathf.Min(num4 - num3, num2 - num4) / 1f); val.SetPixel(l, k, Color.Lerp(val2, val3, num5)); } else if (num4 >= num3 - 2.5f && num4 <= num2 + 2.5f) { val.SetPixel(l, k, val4); } } } for (int m = 16; m <= 45; m++) { for (int n = 23; n <= 39; n++) { if (n <= 25 || n >= 37 || m >= 43 || m <= 17) { val.SetPixel(n, m, val3); } else { val.SetPixel(n, m, new Color(1f, 0.5f, 0.1f, 0.25f)); } } } for (int num6 = -1; num6 <= 1; num6++) { for (int num7 = -1; num7 <= 1; num7++) { val.SetPixel(28 + num7, 29 + num6, Color.white); } } val.Apply(); fallbackReticleSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 64f); return fallbackReticleSprite; } } public class PulseTrailRenderer : MonoBehaviour { private LineRenderer lineRenderer; private Material trailMaterial; private Material iconMaterial; private GameObject entranceBeacon; private SpriteRenderer beaconSpriteRenderer; private Light entranceLight; private readonly List<Vector3> rawWaypoints = new List<Vector3>(64); private readonly List<Vector3> waypoints = new List<Vector3>(160); private GameObject toastPanelObj; private CanvasGroup toastCanvasGroup; private TextMeshProUGUI toastHeaderText; private TextMeshProUGUI toastBodyText; private float toastTimer; private float toastDuration = 3.2f; private float pulseStartTime; private bool isPulsing; private float lastTriggerTime = -1f; private Vector3 currentEntranceBasePos = Vector3.zero; private float normalizedIconScale = 1f; public static PulseTrailRenderer Instance { get; private set; } public bool IsPulsing => isPulsing; public static PulseTrailRenderer GetOrCreate() { //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: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("DungeonSizeLimiter_PulseTrailRenderer"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; Instance = val.AddComponent<PulseTrailRenderer>(); return Instance; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; SetupComponents(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[EntranceRadar] PulseTrailRenderer (Icon Billboard + Smooth Transparent Trail + Bottom-Right UI) ready."); } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void SetupComponents() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a5: 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_01c3: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown ((Component)this).gameObject.layer = LayerMask.NameToLayer("Default"); lineRenderer = ((Component)this).gameObject.GetComponent<LineRenderer>(); if ((Object)(object)lineRenderer == (Object)null) { lineRenderer = ((Component)this).gameObject.AddComponent<LineRenderer>(); } lineRenderer.useWorldSpace = true; lineRenderer.numCornerVertices = 8; lineRenderer.numCapVertices = 8; lineRenderer.alignment = (LineAlignment)0; lineRenderer.textureMode = (LineTextureMode)0; ((Renderer)lineRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)lineRenderer).receiveShadows = false; AnimationCurve widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 0.08f), new Keyframe(0.15f, 0.24f), new Keyframe(0.5f, 0.28f), new Keyframe(0.85f, 0.22f), new Keyframe(1f, 0.12f) }); lineRenderer.widthCurve = widthCurve; lineRenderer.widthMultiplier = ((Configuration.TrailWidth != null) ? Configuration.TrailWidth.Value : 0.24f); Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Unlit/Transparent"); if ((Object)(object)val != (Object)null) { trailMaterial = new Material(val); trailMaterial.renderQueue = 3100; ((Renderer)lineRenderer).material = trailMaterial; } Gradient val2 = new Gradient(); Color trailColor = Configuration.TrailColor; val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[4] { new GradientColorKey(new Color(1f, 0.85f, 0.5f), 0f), new GradientColorKey(trailColor, 0.35f), new GradientColorKey(new Color(1f, 0.35f, 0f), 0.75f), new GradientColorKey(trailColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[5] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.55f, 0.2f), new GradientAlphaKey(0.7f, 0.5f), new GradientAlphaKey(0.55f, 0.8f), new GradientAlphaKey(0f, 1f) }); lineRenderer.colorGradient = val2; ((Renderer)lineRenderer).enabled = false; CreateEntranceBeacon(); } private void CreateEntranceBeacon() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0155: 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_0096: Expected O, but got Unknown if (!((Object)(object)entranceBeacon != (Object)null)) { entranceBeacon = new GameObject("GuidedCompany_EntranceBeacon"); Object.DontDestroyOnLoad((Object)(object)entranceBeacon); ((Object)entranceBeacon).hideFlags = (HideFlags)61; beaconSpriteRenderer = entranceBeacon.AddComponent<SpriteRenderer>(); beaconSpriteRenderer.sprite = EntranceManager.GetEntranceIconSprite(); ((Renderer)beaconSpriteRenderer).sortingOrder = 3000; Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Transparent"); if ((Object)(object)val != (Object)null) { iconMaterial = new Material(val); iconMaterial.renderQueue = 3150; ((Renderer)beaconSpriteRenderer).material = iconMaterial; } Color trailColor = Configuration.TrailColor; beaconSpriteRenderer.color = new Color(trailColor.r, trailColor.g, trailColor.b, 0.95f); entranceBeacon.transform.localScale = Vector3.one * 1.5f; entranceLight = entranceBeacon.AddComponent<Light>(); entranceLight.type = (LightType)2; entranceLight.range = 8f; entranceLight.intensity = 1.8f; entranceLight.color = new Color(1f, 0.55f, 0.1f); entranceLight.shadows = (LightShadows)0; entranceBeacon.SetActive(false); } } public void TriggerPulse() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_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_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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0145: 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_014f: 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_0198: 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_01c2: Unknown result type (might be due to invalid IL or missing references) if (!Configuration.EnableEntranceRadar.Value) { return; } PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if ((Object)(object)val == (Object)null || val.isPlayerDead) { return; } if (val.isInsideFactory) { StopPulse(); } else { if (Time.time - lastTriggerTime < 0.35f) { return; } lastTriggerTime = Time.time; if (!EntranceManager.HasValidEntrance && !EntranceManager.RefreshEntrances()) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[EntranceRadar] No entrance found in current level."); } return; } Vector3 val2 = (((Object)(object)val.thisPlayerBody != (Object)null) ? val.thisPlayerBody.position : ((Component)val).transform.position); Vector3 entrancePosition = EntranceManager.GetEntrancePosition(val2); Vector3 entranceNavPosition = EntranceManager.GetEntranceNavPosition(val2); if (Vector3.Distance(val2, entrancePosition) < 3f) { StopPulse(); return; } ComputeSmoothPath(val2, entranceNavPosition, entrancePosition); if (waypoints.Count < 2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)"[EntranceRadar] Path computation returned insufficient waypoints."); } return; } lineRenderer.positionCount = waypoints.Count; lineRenderer.SetPositions(waypoints.ToArray()); ((Renderer)lineRenderer).enabled = true; currentEntranceBasePos = entrancePosition + Vector3.up * 1.8f; if ((Object)(object)entranceBeacon != (Object)null) { entranceBeacon.transform.position = currentEntranceBasePos; entranceBeacon.SetActive(true); } pulseStartTime = Time.time; isPulsing = true; ShowBottomRightToast(Vector3.Distance(val2, entrancePosition)); ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)$"[EntranceRadar] Radar pulse active: {waypoints.Count} Catmull-Rom points smoothly mapped to {entrancePosition}."); } } } public void StopPulse() { isPulsing = false; if ((Object)(object)lineRenderer != (Object)null) { ((Renderer)lineRenderer).enabled = false; } if ((Object)(object)entranceBeacon != (Object)null) { entranceBeacon.SetActive(false); } HideBottomRightToast(); } private void ComputeSmoothPath(Vector3 start, Vector3 endNav, Vector3 finalDoor) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00bf: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_005a: 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_0095: 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_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_0272: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) rawWaypoints.Clear(); waypoints.Clear(); Vector3 val = start; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(start, ref val2, 6f, -1)) { val = ((NavMeshHit)(ref val2)).position; } NavMeshPath val3 = new NavMeshPath(); if (NavMesh.CalculatePath(val, endNav, -1, val3) && val3.corners != null && val3.corners.Length >= 2) { rawWaypoints.Add(start); for (int i = 0; i < val3.corners.Length; i++) { rawWaypoints.Add(val3.corners[i]); } rawWaypoints.Add(finalDoor); } else { rawWaypoints.Add(start); int num = 14; RaycastHit val5 = default(RaycastHit); for (int j = 1; j < num; j++) { float num2 = (float)j / (float)num; Vector3 val4 = Vector3.Lerp(start, finalDoor, num2); if (Physics.Raycast(val4 + Vector3.up * 15f, Vector3.down, ref val5, 40f, ((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1))) { val4 = ((RaycastHit)(ref val5)).point; } rawWaypoints.Add(val4); } rawWaypoints.Add(finalDoor); } float num3 = ((Configuration.HeightOffset != null) ? Configuration.HeightOffset.Value : 0.25f); int num4 = 6; RaycastHit val8 = default(RaycastHit); for (int k = 0; k < rawWaypoints.Count - 1; k++) { Vector3 p = ((k > 0) ? rawWaypoints[k - 1] : rawWaypoints[k]); Vector3 p2 = rawWaypoints[k]; Vector3 val6 = rawWaypoints[k + 1]; Vector3 p3 = ((k + 2 < rawWaypoints.Count) ? rawWaypoints[k + 2] : val6); for (int l = 0; l < num4; l++) { float t = (float)l / (float)num4; Vector3 val7 = CatmullRom(p, p2, val6, p3, t); if (Physics.Raycast(val7 + Vector3.up * 4f, Vector3.down, ref val8, 8f, -1, (QueryTriggerInteraction)1)) { val7.y = ((RaycastHit)(ref val8)).point.y + num3; } else { val7.y += num3; } waypoints.Add(val7); } } waypoints.Add(finalDoor + Vector3.up * 0.2f); } private static Vector3 CatmullRom(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t) { //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) //IL_001b: 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_0022: 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_0038: 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_0043: 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_0049: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_006f: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_008b: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) float num = t * t; float num2 = num * t; return 0.5f * (2f * p1 + (-p0 + p2) * t + (2f * p0 - 5f * p1 + 4f * p2 - p3) * num + (-p0 + 3f * p1 - 3f * p2 + p3) * num2); } public void Tick(PlayerControllerB localPlayer) { UpdateToastTimer(); if (isPulsing) { UpdatePulseVisuals(localPlayer); } } private void UpdatePulseVisuals(PlayerControllerB localPlayer) { //IL_007b: 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_0080: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01b1: Unknown result type (might be due to invalid IL or missing references) if (!isPulsing) { return; } if ((Object)(object)localPlayer == (Object)null || localPlayer.isPlayerDead || localPlayer.isInsideFactory) { StopPulse(); return; } float num = ((Configuration.PulseDuration != null) ? Configuration.PulseDuration.Value : 2.5f); float num2 = Time.time - pulseStartTime; if (num2 >= num) { StopPulse(); return; } Vector3 val = (((Object)(object)localPlayer.thisPlayerBody != (Object)null) ? localPlayer.thisPlayerBody.position : ((Component)localPlayer).transform.position); if ((Object)(object)lineRenderer != (Object)null && lineRenderer.positionCount > 0 && waypoints.Count > 0) { lineRenderer.SetPosition(0, val + Vector3.up * 0.28f); } if ((Object)(object)entranceBeacon != (Object)null && entranceBeacon.activeSelf) { float num3 = Mathf.Sin(Time.time * 2.4f) * 0.07f; entranceBeacon.transform.position = currentEntranceBasePos + Vector3.up * num3; Camera val2 = (((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.activeCamera != (Object)null) ? StartOfRound.Instance.activeCamera : localPlayer.gameplayCamera); if ((Object)(object)val2 != (Object)null) { Vector3 val3 = entranceBeacon.transform.position - ((Component)val2).transform.position; if (((Vector3)(ref val3)).sqrMagnitude > 0.001f) { entranceBeacon.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up); } } } if ((Object)(object)toastBodyText != (Object)null && EntranceManager.HasValidEntrance) { float num4 = Vector3.Distance(val, EntranceManager.MainEntrancePosition); ((TMP_Text)toastBodyText).text = $"Main Entrance: {Mathf.RoundToInt(num4)}m"; } float num5 = Mathf.Clamp01(num2 / 0.25f); float num6 = ((num2 < 2f) ? 1f : Mathf.Clamp01(1f - (num2 - 2f) / Mathf.Max(0.5f, num - 2f))); SetAlpha(num5 * num6); } private void SetAlpha(float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0024: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) Color trailColor = Configuration.TrailColor; Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[4] { new GradientColorKey(new Color(1f, 0.85f, 0.5f), 0f), new GradientColorKey(trailColor, 0.35f), new GradientColorKey(new Color(1f, 0.35f, 0f), 0.75f), new GradientColorKey(trailColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[5] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.55f * alpha, 0.2f), new GradientAlphaKey(0.7f * alpha, 0.5f), new GradientAlphaKey(0.55f * alpha, 0.8f), new GradientAlphaKey(0f, 1f) }); if ((Object)(object)lineRenderer != (Object)null) { lineRenderer.colorGradient = val; } if ((Object)(object)beaconSpriteRenderer != (Object)null) { beaconSpriteRenderer.color = new Color(trailColor.r, trailColor.g, trailColor.b, 0.95f * alpha); } if ((Object)(object)entranceLight != (Object)null) { entranceLight.intensity = 1.8f * alpha; } } private void EnsureToastUI() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00a4: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_017e: 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_01a8: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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) if ((Object)(object)toastPanelObj != (Object)null || (Object)(object)HUDManager.Instance == (Object)null) { return; } Transform val = (((Object)(object)HUDManager.Instance.HUDContainer != (Object)null) ? HUDManager.Instance.HUDContainer.transform : null); if ((Object)(object)val == (Object)null) { Canvas val2 = Object.FindObjectOfType<Canvas>(); if ((Object)(object)val2 != (Object)null) { val = ((Component)val2).transform; } } if ((Object)(object)val == (Object)null) { return; } try { toastPanelObj = new GameObject("GuidedCompany_BottomRightToast"); toastPanelObj.transform.SetParent(val, false); RectTransform obj = toastPanelObj.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 0f); obj.anchorMax = new Vector2(1f, 0f); obj.pivot = new Vector2(1f, 0f); obj.anchoredPosition = new Vector2(-28f, 32f); obj.sizeDelta = new Vector2(230f, 54f); ((Graphic)toastPanelObj.AddComponent<Image>()).color = new Color(0.02f, 0.03f, 0.04f, 0.82f); toastCanvasGroup = toastPanelObj.AddComponent<CanvasGroup>(); toastCanvasGroup.alpha = 0f; GameObject val3 = new GameObject("ToastHeader"); val3.transform.SetParent(toastPanelObj.transform, false); RectTransform obj2 = val3.AddComponent<RectTransform>(); obj2.anchorMin = new Vector2(0f, 0.5f); obj2.anchorMax = new Vector2(1f, 1f); obj2.offsetMin = new Vector2(12f, 0f); obj2.offsetMax = new Vector2(-10f, -4f); toastHeaderText = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)toastHeaderText).text = "[!] FACILITY RADAR"; ((TMP_Text)toastHeaderText).fontSize = 13f; ((TMP_Text)toastHeaderText).fontStyle = (FontStyles)1; ((Graphic)toastHeaderText).color = new Color(1f, 0.55f, 0.1f, 1f); ((TMP_Text)toastHeaderText).alignment = (TextAlignmentOptions)513; GameObject val4 = new GameObject("ToastBody"); val4.transform.SetParent(toastPanelObj.transform, false); RectTransform obj3 = val4.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0f, 0f); obj3.anchorMax = new Vector2(1f, 0.5f); obj3.offsetMin = new Vector2(12f, 4f); obj3.offsetMax = new Vector2(-10f, 0f); toastBodyText = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)toastBodyText).text = "Tracking Entrance..."; ((TMP_Text)toastBodyText).fontSize = 12f; ((Graphic)toastBodyText).color = new Color(0.92f, 0.92f, 0.95f, 0.95f); ((TMP_Text)toastBodyText).alignment = (TextAlignmentOptions)513; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[EntranceRadar] Could not create bottom-right toast UI: " + ex.Message)); } } } private void ShowBottomRightToast(float distance) { EnsureToastUI(); if (!((Object)(object)toastCanvasGroup == (Object)null)) { if ((Object)(object)toastBodyText != (Object)null) { ((TMP_Text)toastBodyText).text = $"Main Entrance: {Mathf.RoundToInt(distance)}m"; } toastTimer = toastDuration; } } private void HideBottomRightToast() { toastTimer = 0f; if ((Object)(object)toastCanvasGroup != (Object)null) { toastCanvasGroup.alpha = 0f; } } private void UpdateToastTimer() { if (!((Object)(object)toastCanvasGroup == (Object)null)) { if (toastTimer > 0f) { toastTimer -= Time.deltaTime; toastCanvasGroup.alpha = Mathf.MoveTowards(toastCanvasGroup.alpha, 1f, Time.deltaTime * 6f); } else { toastCanvasGroup.alpha = Mathf.MoveTowards(toastCanvasGroup.alpha, 0f, Time.deltaTime * 3f); } } } } } namespace DungeonSizeLimiter.Patches { public class FilteredLogHandler : ILogHandler { private readonly ILogHandler original; public FilteredLogHandler(ILogHandler original) { this.original = original; } public static bool ShouldSuppressMessage(LogType logType, string msg) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(msg)) { return false; } if (msg.Contains("BoxCollider does not support negative scale")) { return true; } if (Configuration.SuppressHarmlessConsoleSpam == null || !Configuration.SuppressHarmlessConsoleSpam.Value) { return false; } if ((int)logType == 2) { if (msg.Contains("The referenced script") && msg.Contains("is missing!")) { return true; } if (msg.Contains("PlayOneShot was called with a null AudioClip")) { return true; } if (msg.Contains("Only custom filters can be played")) { return true; } if (msg.Contains("NetworkVariable is written to, but doesn't know its NetworkBehaviour yet")) { return true; } if (msg.Contains("must be instantiated using the ScriptableObject.CreateInstance")) { return true; } if (msg.Contains("GrabbableObject search called with inactive objects")) { return true; } } else if ((int)logType == 0) { if (msg.Contains("RuntimeNavMeshBuilder: Source mesh") && msg.Contains("does not allow read access")) { return true; } if (msg.Contains("Main entrance position could not be found. Returning origin.")) { return true; } } return false; } public void LogFormat(LogType logType, Object context, string format, params object[] args) { //IL_0018: 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) try { string msg = ((args != null && args.Length != 0 && format != null) ? string.Format(format, args) : format); if (ShouldSuppressMessage(logType, msg)) { return; } } catch { } ILogHandler obj2 = original; if (obj2 != null) { obj2.LogFormat(logType, context, format, args); } } public void LogException(Exception exception, Object context) { if (!(exception is NullReferenceException) || exception.StackTrace == null || (!exception.StackTrace.Contains("ManualCameraRenderer.LateUpdate") && !exception.StackTrace.Contains("SpikeRoofTrap.GetNearEntrance"))) { ILogHandler obj = original; if (obj != null) { obj.LogException(exception, context); } } } } [HarmonyPatch] public static class DungeonSizePatches { private static readonly Dictionary<Assembly, Type[]> cachedAssemblyTypes = new Dictionary<Assembly, Type[]>(); private static bool loggedCacheHeartbeat = false; [HarmonyPatch(typeof(AccessTools), "GetTypesFromAssembly")] [HarmonyPrefix] public static bool AccessTools_GetTypesFromAssembly_Prefix(Assembly assembly, ref Type[] __result) { if (assembly == null) { __result = Type.EmptyTypes; return false; } if (Configuration.AccelerateStartupTypeCache != null && !Configuration.AccelerateStartupTypeCache.Value) { return true; } lock (cachedAssemblyTypes) { if (cachedAssemblyTypes.TryGetValue(assembly, out var value)) { __result = value; return false; } } Type[] array; try { array = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { Type[] types = ex.Types; if (types == null) { array = Type.EmptyTypes; } else { List<Type> list = new List<Type>(types.Length); for (int i = 0; i < types.Length; i++) { if (types[i] != null) { list.Add(types[i]); } } array = list.ToArray(); } } catch { array = Type.EmptyTypes; } lock (cachedAssemblyTypes) { cachedAssemblyTypes[assembly] = array; } if (!loggedCacheHeartbeat) { loggedCacheHeartbeat = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[DungeonSizeLimiter] Startup Type-Cache active (eliminated redundant ReflectionTypeLoadException scans across assemblies)."); } } __result = array; return false; } [HarmonyPatch(typeof(ManualCameraRenderer), "LateUpdate")] [HarmonyFinalizer] public static Exception ManualCameraRenderer_LateUpdate_Finalizer(Exception __exception) { if (__exception is NullReferenceException) { return null; } return __exception; } [HarmonyPatch(typeof(SpikeRoofTrap), "GetNearEntrance")] [HarmonyFinalizer] public static Exception SpikeRoofTrap_GetNearEntrance_Finalizer(Exception __exception, ref bool __result) { if (__exception is NullReferenceException) { __result = false; return null; } return __exception; } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPrefix] public static void RoundManager_GenerateNewFloor_Prefix(RoundManager __instance) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.currentLevel == (Object)null) { return; } float num = Mathf.Max(__instance.currentLevel.factorySizeMultiplier, 0.05f); float num2 = num * __instance.mapSizeMultiplier; float value = Configuration.MaxDungeonSizeMultiplier.Value; if (num2 > value) { float mapSizeMultiplier = __instance.mapSizeMultiplier; __instance.mapSizeMultiplier = value / num; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[DungeonSizeLimiter] Clamped {__instance.currentLevel.PlanetName} dungeon multiplier: {num2:F2} -> {value:F2} (mapSizeMultiplier: {mapSizeMultiplier:F2} -> {__instance.mapSizeMultiplier:F2})"); } } } catch (Exception arg) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogError((object)$"[DungeonSizeLimiter] Error in GenerateNewFloor prefix: {arg}"); } } } [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] public static void DunGen_Generate_Prefix(DungeonGenerator __instance) { try { if (__instance == null) { return; } float value = Configuration.MaxDungeonSizeMultiplier.Value; if (__instance.LengthMultiplier > value) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[DungeonSizeLimiter] Clamping DunGen.LengthMultiplier: {__instance.LengthMultiplier:F2} -> {value:F2}"); } __instance.LengthMultiplier = value; } } catch (Exception arg) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogError((object)$"[DungeonSizeLimiter] Error in DunGen Generate prefix: {arg}"); } } } [HarmonyPatch(typeof(UnityLogSource), "OnUnityLogMessageReceived")] [HarmonyPrefix] public static bool UnityLogSource_OnUnityLogMessageReceived_Prefix(string message, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (FilteredLogHandler.ShouldSuppressMessage(type, message)) { return false; } return true; } [HarmonyPatch(typeof(RoundManager), "GeneratedFloorPostProcessing")] [HarmonyPostfix] public static void RoundManager_GeneratedFloorPostProcessing_Postfix() { //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_005c: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0078: Unknown result type (might be due to invalid IL or missing references) try { if (!Configuration.SanitizeBoxColliders.Value) { return; } GameObject val = GameObject.Find("Systems/LevelGeneration/LevelGenerationRoot"); if ((Object)(object)val == (Object)null) { return; } BoxCollider[] componentsInChildren = val.GetComponentsInChildren<BoxCollider>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } int num = 0; foreach (BoxCollider val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { Vector3 size = val2.size; if (size.x < 0f || size.y < 0f || size.z < 0f) { val2.size = new Vector3(Mathf.Abs(size.x), Mathf.Abs(size.y), Mathf.Abs(size.z)); num++; } } } if (num > 0) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[DungeonSizeLimiter] Sanitized {num} negative-scale BoxColliders in generated dungeon floor."); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[DungeonSizeLimiter] PostProcessing sanitizer notice: " + ex.Message)); } } } } [HarmonyPatch] public static class HUDScanPatch { private static float lastScanTime = -1f; private static bool loggedHeartbeat = false; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void PlayerUpdate_Postfix(PlayerControllerB __instance) { try { if (!Configuration.EnableEntranceRadar.Value || (Object)(object)__instance == (Object)null || !((NetworkBehaviour)__instance).IsOwner) { return; } if (!loggedHeartbeat && __instance.isPlayerControlled) { loggedHeartbeat = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[EntranceRadar] PlayerControllerB.Update hook verified active on local player!"); } } PulseTrailRenderer orCreate = PulseTrailRenderer.GetOrCreate(); if ((Object)(object)orCreate != (Object)null) { orCreate.Tick(__instance); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[EntranceRadar] PlayerUpdate_Postfix error: " + ex.Message)); } } } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] public static void HUDUpdate_Postfix(HUDManager __instance) { try { if (Configuration.EnableEntranceRadar.Value && !((Object)(object)__instance == (Object)null) && Traverse.Create((object)__instance).Field("playerPingingScan").GetValue<float>() > 0.05f && Time.time - lastScanTime > 0.45f) { lastScanTime = Time.time; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[EntranceRadar] HUDManager.playerPingingScan active -> triggering radar pulse!"); } PulseTrailRenderer.GetOrCreate()?.TriggerPulse(); } } catch { } } [HarmonyPatch(typeof(HUDManager), "NodeIsNotVisible")] [HarmonyPrefix] public static bool NodeIsNotVisible_Prefix(HUDManager __instance, ScanNodeProperties node, ref bool __result) { if (!Configuration.EnableEntranceRadar.Value) { return true; } if ((Object)(object)node != (Object)null && (Object)(object)node == (Object)(object)EntranceManager.ActiveScanNode && (Object)(object)PulseTrailRenderer.Instance != (Object)null && PulseTrailRenderer.Instance.IsPulsing) { __result = false; return false; } return true; } [HarmonyPatch(typeof(HUDManager), "AssignNewNodes")] [HarmonyPostfix] public static void AssignNewNodes_Postfix(HUDManager __instance, PlayerControllerB playerScript) { try { if (Configuration.EnableEntranceRadar.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)playerScript == (Object)null) && !playerScript.isInsideFactory && (Object)(object)PulseTrailRenderer.Instance != (Object)null && PulseTrailRenderer.Instance.IsPulsing && (Object)(object)EntranceManager.ActiveScanNode != (Object)null) { List<ScanNodeProperties> value = Traverse.Create((object)__instance).Field("nodesOnScreen").GetValue<List<ScanNodeProperties>>(); if (value != null && !value.Contains(EntranceManager.ActiveScanNode)) { value.Add(EntranceManager.ActiveScanNode); } } } catch { } } } [HarmonyPatch] public static class LadderPatches { private static float jumpCooldownTime; private static float lastMountTime; private static float nextLadderScanTime; private static bool loggedHeartbeat; private static bool IsLadderTrigger(InteractTrigger trig) { if ((Object)(object)trig == (Object)null) { return false; } if (trig.isLadder) { return true; } if (((Object)trig).name != null && ((Object)trig).name.IndexOf("ladder", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (trig.hoverTip != null && trig.hoverTip.IndexOf("Climb", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } private static void ConfigureLadderTrigger(InteractTrigger trig) { if (!((Object)(object)trig == (Object)null)) { trig.isLadder = true; trig.twoHandedItemAllowed = true; trig.oneHandedItemAllowed = true; trig.specialCharacterAnimation = false; trig.holdInteraction = false; trig.interactable = true; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] public static void PlayerUpdate_Prefix(PlayerControllerB __instance) { try { if (!Configuration.EnableTwoHandedLadders.Value || (Object)(object)__instance == (Object)null || !((NetworkBehaviour)__instance).IsOwner) { return; } if (!loggedHeartbeat && __instance.isPlayerControlled) { loggedHeartbeat = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[Ladders] PlayerControllerB.Update hook verified active on local player!"); } } if ((Object)(object)__instance.hoveringOverTrigger != (Object)null && IsLadderTrigger(__instance.hoveringOverTrigger)) { ConfigureLadderTrigger(__instance.hoveringOverTrigger); } if (!(Time.time >= nextLadderScanTime)) { return; } nextLadderScanTime = Time.time + 1.5f; InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>(); if (array == null) { return; } for (int i = 0; i < array.Length; i++) { if (IsLadderTrigger(array[i])) { ConfigureLadderTrigger(array[i]); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[Ladders] Prefix error: " + ex.Message)); } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void PlayerUpdate_Postfix(PlayerControllerB __instance) { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0247: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: 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_00c0: 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_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) try { if (!Configuration.EnableTwoHandedLadders.Value || (Object)(object)__instance == (Object)null || !((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || __instance.isPlayerDead) { return; } if ((Object)(object)__instance.hoveringOverTrigger != (Object)null && IsLadderTrigger(__instance.hoveringOverTrigger)) { ConfigureLadderTrigger(__instance.hoveringOverTrigger); if ((Object)(object)__instance.cursorTip != (Object)null) { ((TMP_Text)__instance.cursorTip).text = "Climb : [Walk / W] or [E]"; } } if (__instance.isClimbingLadder) { bool flag = false; try { if (Keyboard.current != null && ((ButtonControl)Keyboard.current.spaceKey).wasPressedThisFrame) { flag = true; } if (UnityInput.Current.GetKeyDown((KeyCode)32)) { flag = true; } if (__instance.playerActions != null) { MovementActions movement = __instance.playerActions.Movement; if (((MovementActions)(ref movement)).Jump.triggered) { flag = true; } } } catch { } if (flag) { __instance.CancelSpecialTriggerAnimations(); if ((Object)(object)__instance.thisController != (Object)null) { ((Collider)__instance.thisController).enabled = true; float value = Configuration.LadderBoostForce.Value; Vector3 val = -((Component)__instance).transform.forward * value + Vector3.up * 3.5f; __instance.thisController.Move(val * Time.deltaTime); } jumpCooldownTime = Time.time + 0.55f; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[Ladders] HL1: Jumped off ladder with Space."); } return; } } if (!Configuration.EnableAutoLadderClimb.Value || __instance.isClimbingLadder || __instance.inSpecialInteractAnimation || __instance.inTerminalMenu || __instance.isTypingChat || !(Time.time > jumpCooldownTime) || !(Time.time - lastMountTime > 0.4f)) { return; } bool flag2 = __instance.moveInputVector.y > 0.1f; try { if (Keyboard.current != null && ((ButtonControl)Keyboard.current.wKey).isPressed) { flag2 = true; } if (UnityInput.Current.GetKey((KeyCode)119)) { flag2 = true; } } catch { } if (!flag2) { return; } InteractTrigger val2 = null; if ((Object)(object)__instance.hoveringOverTrigger != (Object)null && IsLadderTrigger(__instance.hoveringOverTrigger) && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.hoveringOverTrigger).transform.position) < 2.2f) { val2 = __instance.hoveringOverTrigger; } if ((Object)(object)val2 == (Object)null) { Vector3 val3; Bounds bounds; if (!((Object)(object)__instance.thisController != (Object)null)) { val3 = ((Component)__instance).transform.position + Vector3.up * 1f; } else { bounds = ((Collider)__instance.thisController).bounds; val3 = ((Bounds)(ref bounds)).center; } Vector3 val4 = val3; Collider[] array = Physics.OverlapSphere(val4, 1.35f, -1, (QueryTriggerInteraction)2); if (array != null) { foreach (Collider val5 in array) { if ((Object)(object)val5 == (Object)null || (Object)(object)val5 == (Object)(object)__instance.thisController) { continue; } InteractTrigger val6 = ((Component)val5).GetComponent<InteractTrigger>() ?? ((Component)val5).GetComponentInParent<InteractTrigger>() ?? ((Component)val5).GetComponentInChildren<InteractTrigger>(); if ((Object)(object)val6 != (Object)null && IsLadderTrigger(val6)) { bounds = val5.bounds; Vector3 val7 = ((Bounds)(ref bounds)).center - val4; val7.y = 0f; Vector3 forward = ((Component)__instance).transform.forward; forward.y = 0f; if (((Vector3)(ref val7)).sqrMagnitude < 0.05f || Vector3.Dot(((Vector3)(ref forward)).normalized, ((Vector3)(ref val7)).normalized) > 0.15f) { val2 = val6; break; } } } } } if ((Object)(object)val2 != (Object)null && !val2.isPlayingSpecialAnimation && (Object)(object)__instance.thisPlayerBody != (Object)null) { lastMountTime = Time.time; ConfigureLadderTrigger(val2); bool twoHanded = __instance.twoHanded; bool isInHangarShipRoom = __instance.isInHangarShipRoom; __instance.twoHanded = false; __instance.isInHangarShipRoom = false; try { val2.Interact(__instance.thisPlayerBody); } finally { __instance.twoHanded = twoHanded; __instance.isInHangarShipRoom = isInHangarShipRoom; } ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)("[Ladders] HL1: Auto-mounted ladder '" + ((Object)val2).name + "' via walk-up!")); } } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogWarning((object)("[Ladders] Postfix error: " + ex.Message)); } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPrefix] public static void SetHoverTip_Prefix(PlayerControllerB __instance) { if (Configuration.EnableTwoHandedLadders.Value && (Object)(object)__instance != (Object)null && (Object)(object)__instance.hoveringOverTrigger != (Object)null && IsLadderTrigger(__instance.hoveringOverTrigger)) { ConfigureLadderTrigger(__instance.hoveringOverTrigger); } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPostfix] public static void SetHoverTip_Postfix(PlayerControllerB __instance) { if (Configuration.EnableTwoHandedLadders.Value && (Object)(object)__instance != (Object)null && (Object)(object)__instance.hoveringOverTrigger != (Object)null && IsLadderTrigger(__instance.hoveringOverTrigger)) { ConfigureLadderTrigger(__instance.hoveringOverTrigger); if ((Object)(object)__instance.cursorTip != (Object)null) { ((TMP_Text)__instance.cursorTip).text = "Climb : [Walk / W] or [E]"; } } } } [HarmonyPatch] public static class ModpackFixes { private static bool appliedDawnPatches = false; private static bool appliedCrackedTerminalPatch = false; private static bool unpatchedLcr2 = false; private static bool unpatchedFreeMoons = false; private static bool poolsBuilt = false; private static bool loggedScrapHeartbeat = false; private static bool loggedMonsterHeartbeat = false; private static bool loggedScrollHeartbeat = false; private static bool loggedMoonsHeartbeat = false; private static readonly Dictionary<int, TerminalNode> synthesizedRouteNodes = new Dictionary<int, TerminalNode>(); private static readonly List<GrabbableObject> temporarilyProtectedLockerItems = new List<GrabbableObject>(); private static readonly Dictionary<string, int> naturalMoonPriceFallbacks = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase) { { "85 Rend", 550 }, { "7 Dine", 600 }, { "8 Titan", 700 }, { "68 Artifice", 1500 }, { "5 Embrion", 150 }, { "52 Desperation", 300 }, { "30 Row", 800 }, { "154 Thrive", 600 }, { "62 Lithium", 1200 }, { "276 Makron", 350 }, { "6 Mazon", 400 }, { "186 Praetor", 800 }, { "161 Rockwell", 200 }, { "646 Ultimatum", 1500 }, { "67 Funland", 750 }, { "196 Baykal", 500 }, { "234 Oldred", 300 }, { "96 Calypso", 670 }, { "153714Gratar", 1500 }, { "134Gratar", 1500 }, { "Gratar", 1500 }, { "72019 StarlancerZero", 800 }, { "44 Atlantica", 1000 }, { "46 Infernis", 500 }, { "36 Gloom", 300 }, { "69Koblana", 100 }, { "Koblana", 100 }, { "715 Junic", 1000 }, { "152 Fairmont", 30 }, { "842 Polarus", 1850 }, { "727 Squat", 375 }, { "18Filitrios", 60 }, { "Filitrios", 60 }, { "129 Galetry", 800 }, { "281 Amarok", 600 }, { "94 Cubatres", 120 }, { "359 Cosmocos", 2100 }, { "476 Taldor", 450 } }; private static readonly Dictionary<Item, int> globalScrapWeights = new Dictionary<Item, int>(); private static readonly Dictionary<EnemyType, int> globalInsideEnemies = new Dictionary<EnemyType, int>(); private static readonly Dictionary<EnemyType, int> globalOutsideEnemies = new Dictionary<EnemyType, int>(); private static readonly Dictionary<EnemyType, int> globalDaytimeEnemies = new Dictionary<EnemyType, int>(); private static readonly HashSet<string> excludedInternalScrapNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Body", "RagdollGrabbableObject", "Apparatice", "Apparatus", "LungApparatus", "LungApparatusTurnedOff", "Hive", "RedLocustHive", "Key", "Sticky note", "StickyNoteItem", "Clipboard", "ClipboardItem", "Shotgun", "Kitchen knife", "KnifeItem" }; private static readonly HashSet<string> excludedInternalEnemyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Red pill", "RedPillEnemyType", "Lasso", "LassoMan", "Whistleblower", "SCP-323-1", "SCP-427-1", "Revenant" }; public static void TryApplyDynamicPatches(Harmony harmony) { //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_033e: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown if (harmony == null) { return; } WiderShipCompatPatches.TryApplyPatches(harmony); if (!unpatchedLcr2) { try { if (AccessTools.TypeByName("lcr2.lcr2") != null) { Harmony.UnpatchID("polic72.LCR2"); unpatchedLcr2 = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[ModpackFixes] Unpatched polic72.LCR2 single-moon currentLevel swapper (replaced by universal All-Scrap & All-Monsters pool)."); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[ModpackFixes] Notice while unpatching polic72.LCR2: " + ex.Message)); } } } if (!unpatchedFreeMoons && Configuration.RestoreNaturalMoonPrices.Value) { try { if (AccessTools.TypeByName("SRH.Mods.LC.FreeMoonsPlugin") != null) { Harmony.UnpatchID("SlushyRH.LethalCompany.FreeMoons"); unpatchedFreeMoons = true; ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)"[ModpackFixes] Unpatched SlushyRH.LethalCompany.FreeMoons to restore natural moon progression prices!"); } } } catch (Exception ex2) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { log4.LogWarning((object)("[ModpackFixes] Notice while unpatching FreeMoons: " + ex2.Message)); } } } if (!appliedDawnPatches) { try { Type type = AccessTools.TypeByName("Dawn.ItemRegistrationHandler"); Type type2 = AccessTools.TypeByName("Dawn.EnemyRegistrationHandler"); if (type != null && type2 != null) { MethodInfo methodInfo = AccessTools.Method(type, "FreezeItemContent", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ModpackFixes), "Dawn_FreezeItemContent_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(type, "UpdateItemWeightsOnLevel", new Type[1] { typeof(SelectableLevel) }, (Type[])null); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(ModpackFixes), "Dawn_UpdateItemWeightsOnLevel_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo3 = AccessTools.Method(type2, "RegisterEnemies", (Type[])null, (Type[])null); if (methodInfo3 != null) { harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(ModpackFixes), "Dawn_RegisterEnemies_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo4 = AccessTools.Method(type2, "UpdateEnemyWeightsOnLevel", new Type[1] { typeof(SelectableLevel) }, (Type[])null); if (methodInfo4 != null) { harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(ModpackFixes), "Dawn_UpdateEnemyWeightsOnLevel_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } appliedDawnPatches = true; ManualLogSource log5 = Plugin.Log; if (log5 != null) { log5.LogInfo((object)"[ModpackFixes] Hooked DawnLib ItemRegistrationHandler & EnemyRegistrationHandler successfully!"); } } } catch (Exception ex3) { ManualLogSource log6 = Plugin.Log; if (log6 != null) { log6.LogWarning((object)("[ModpackFixes] Notice while hooking DawnLib: " + ex3.Message)); } } } if (appliedCrackedTerminalPatch) { return; } try { Type type3 = AccessTools.TypeByName("CrackedTerminal.Ship"); Type type4 = AccessTools.TypeByName("CrackedTerminal.Ui"); Type type5 = AccessTools.TypeByName("CrackedTerminal.Page"); if (!(type3 != null)) { return; } MethodInfo methodInfo5 = AccessTools.Method(type3, "Confirmed", new Type[1] { typeof(TerminalNode) }, (Type[])null); if (methodInfo5 != null) { harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(typeof(ModpackFixes), "CrackedTerminal_Ship_Confirmed_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo6 = AccessTools.Method(type3, "Moons", (Type[])null, (Type[])null); if (methodInfo6 != null) { harmony.Patch((MethodBase)methodInfo6, new HarmonyMethod(typeof(ModpackFixes), "CrackedTerminal_Ship_Moons_Prefix", (Type[])null), new HarmonyMethod(typeof(ModpackFixes), "CrackedTerminal_Ship_Moons_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (type4 != null) { MethodInfo methodInfo7 = AccessTools.Method(type4, "Scroll", (Type[])null, (Type[])null); if (methodInfo7 != null) { harmony.Patch((MethodBase)methodInfo7, (HarmonyMethod)null, new HarmonyMethod(typeof(ModpackFixes), "CrackedTerminal_Ui_Scroll_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } if (type5 != null) { MethodInfo methodInfo8 = AccessTools.Method(type5, "Redraw", (Type[])null, (Type[])null); if (methodInfo8 != null) { harmony.Patch((MethodBase)methodInfo8, (HarmonyMethod)null, new HarmonyMethod(typeof(ModpackFixes), "CrackedTerminal_Page_Redraw_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } appliedCrackedTerminalPatch = true; ManualLogSource log7 = Plugin.Log; if (log7 != null) { log7.LogInfo((object)"[ModpackFixes] Hooked CrackedTerminal (Ship.Confirmed, Ship.Moons, Ui.Scroll, Page.Redraw) successfully!"); } } catch (Exception ex4) { ManualLogSource log8 = Plugin.Log; if (log8 != null) { log8.LogWarning((object)("[ModpackFixes] Notice while hooking CrackedTerminal: " + ex4.Message)); } } } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] [HarmonyPriority(800)] public static void StartOfRound_Awake_Prefix() { TryApplyDynamicPatches(Plugin.HarmonyInstance); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] [HarmonyPriority(0)] public static void StartOfRound_Start_Postfix(StartOfRound __instance) { try { TryApplyDynamicPatches(Plugin.HarmonyInstance); RepairAllItemGroups(); BuildGlobalPools(forceRebuild: true); if ((Object)(object)__instance != (Object)null && __instance.levels != null) { for (int i = 0; i < __instance.levels.Length; i++) { SelectableLevel val = __instance.levels[i]; if (!((Object)(object)val == (Object)null)) { if (Configuration.EnableAllScrapOnAllMoons.Value) { EnsureLevelHasAllScrap(val); } if (Configuration.EnableAllMonstersOnAllMoons.Value) { EnsureLevelHasAllMonsters(val); } } } } Terminal val2 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val2 != (Object)null && Configuration.FixAllMoonsInTerminal.Value) { RepairTerminalMoonRoutes(val2); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[ModpackFixes] StartOfRound_Start_Postfix error: " + ex.Message)); } } } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] [HarmonyPriority(0)] public static void Terminal_Start_Postfix(Terminal __instance) { if (Configuration.FixAllMoonsInTerminal.Value) { RepairTerminalMoonRoutes(__instance); } } [HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")] [HarmonyPrefix] [HarmonyPriority(800)] public static void Terminal_BeginUsingTerminal_Prefix(Terminal __instance) { if (Configuration.FixAllMoonsInTerminal.Value) { RepairTerminalMoonRoutes(__instance); } } public static void CrackedTerminal_Ship_Confirmed_Postfix(TerminalNode node, ref TerminalNode __result) { if (!Configuration.FixAllMoonsInTerminal.Value || (Object)(object)node == (Object)null || (!((Object)(object)__result == (Object)null) && __result.buyRerouteToMoon >= 0) || node.terminalOptions == null) { return; } for (int i = 0; i < node.terminalOptions.Length; i++) { CompatibleNoun val = node.terminalOptions[i]; if (val != null && (Object)(object)val.result != (Object)null && val.result.buyRerouteToMoon >= 0) { __result = val.result; break; } } } public static void CrackedTerminal_Ship_Moons_Prefix() { if (!Configuration.FixAllMoonsInTerminal.Value) { return; } try { Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val != (Object)null) { RepairTerminalMoonRoutes(val); } } catch { } } public static void CrackedTerminal_Ship_Moons_Postfix(ref object __result) { if (!Configuration.FixAllMoonsInTerminal.Value || __result == null) { return; } try { if (!(__result is IList list) || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.levels == null) { return; } Type type = AccessTools.TypeByName("CrackedTerminal.Ship")?.GetNestedType("Moon", BindingFlags.Public | BindingFlags.NonPublic); if (type == null) { return; } FieldInfo fieldInfo = AccessTools.Field(type, "Level"); FieldInfo fieldInfo2 = AccessTools.Field(type, "Route"); FieldInfo fieldInfo3 = AccessTools.Field(type, "Cost"); FieldInfo fieldInfo4 = AccessTools.Field(type, "Hidden"); FieldInfo fieldInfo5 = AccessTools.Field(type, "Company"); if (fieldInfo == null || fieldInfo2 == null || fieldInfo3 == null || fieldInfo4 == null || fieldInfo5 == null) { return; } Dictionary<SelectableLevel, object> dictionary = null; PropertyInfo propertyInfo = null; PropertyInfo propertyInfo2 = null; try { Type type2 = AccessTools.TypeByName("LethalLevelLoader.PatchedContent"); Type type3 = AccessTools.TypeByName("LethalLevelLoader.ExtendedLevel"); if (type2 != null && type3 != null) { dictionary = AccessTools.Property(type2, "ExtendedLevelDictionary")?.GetValue(null) as Dictionary<SelectableLevel, object>; propertyInfo = AccessTools.Property(type3, "RouteConfirmNode"); propertyInfo2 = AccessTools.Property(type3, "RoutePrice"); } } catch { } HashSet<int> hashSet = new HashSet<int>(); for (int i = 0; i < list.Count; i++) { object obj2 = list[i]; if (obj2 == null) { continue; } object? value = fieldInfo.GetValue(obj2); SelectableLevel val = (SelectableLevel)((value is SelectableLevel) ? value : null); if ((Object)(object)val != (Object)null) { hashSet.Add(val.levelID); if (Configuration.RestoreNaturalMoonPrices.Value) { int num = 0; try { num = (int)fieldInfo3.GetValue(obj2); } catch { } int num2 = ResolveNaturalMoonPrice(val, num, dictionary, propertyInfo2); if (num2 > 0 && num != num2) { fieldInfo3.SetValue(obj2, num2); object? value2 = fieldInfo2.GetValue(obj2); TerminalNode val2 = (TerminalNode)((value2 is TerminalNode) ? value2 : null); if ((Object)(object)val2 != (Object)null) { val2.itemCost = num2; } } } } fieldInfo4.SetValue(obj2, false); } int num3 = 0; SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val3 in levels) { if ((Object)(object)val3 == (Object)null || hashSet.Contains(val3.levelID) || string.IsNullOrEmpty(val3.PlanetName) || val3.PlanetName.IndexOf("Liquidation", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } TerminalNode value3 = n