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 Y4NGZCore v1.0.0
Y4NGZCore.dll
Decompiled 4 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Dawn; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Y4NGZCompany.Facility.Cameras.Placement; using Y4NGZCompany.Facility.Interior.Placement.Authored; using Y4NGZCore; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("Y4NGZCompany")] [assembly: InternalsVisibleTo("LethalCCTV")] [assembly: InternalsVisibleTo("Y4NGZBloodFX")] [assembly: InternalsVisibleTo("Y4NGZAtmosphere")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Y4NGZCore")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Shared Y4NGZ runtime services consumed by the other Y4NGZ plugin assemblies")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+94d3a829a505ef9557dc44e52b76374a6a8f3a82")] [assembly: AssemblyProduct("Y4NGZCore")] [assembly: AssemblyTitle("Y4NGZCore")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 Y4NGZCompany.ShipSystems { public static class ShipClock24h { public const string UnavailableText = "--:--"; public static string GetShipTime24h() { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return "--:--"; } StartOfRound instance2 = StartOfRound.Instance; if ((Object)(object)instance2 != (Object)null && instance2.inShipPhase) { return "--:--"; } int num = (int)(instance.normalizedTimeOfDay * (60f * (float)instance.numberOfHours)) + 360; if (num < 0) { return "--:--"; } int num2 = num / 60; int num3 = num % 60; if (num2 >= 24) { return "00:00"; } return $"{num2:00}:{num3:00}"; } } } namespace Y4NGZCompany.ShipSystems.Rendering { internal enum OffscreenRigSlot { PowerFuel, MonitorRowCard, QuotaAnnouncement, ProfitQuotaPanel, DeadlinePanel, CctvVanillaMonitor } internal readonly struct OffscreenRigPlacement { internal string Name { get; } internal float CenterX { get; } internal float CenterY { get; } internal float HalfWidth { get; } internal float HalfHeight { get; } internal OffscreenRigPlacement(string name, float centerX, float centerY, float halfWidth, float halfHeight) { Name = name; CenterX = centerX; CenterY = centerY; HalfWidth = halfWidth; HalfHeight = halfHeight; } } internal static class OffscreenRigParking { internal const float ParkingHeight = -10000f; internal const float SlotOrigin = 8192f; internal const float SlotPitch = 4096f; internal const float MinimumClearance = 1024f; internal const float MaxHalfExtent = 1536f; internal static float SlotX(OffscreenRigSlot slot) { return 8192f + (float)slot * 4096f; } internal static bool Fits(float extentFromRootX, float extentFromRootY) { if (extentFromRootX > 0f && extentFromRootY > 0f && extentFromRootX <= 1536f) { return extentFromRootY <= 1536f; } return false; } internal static OffscreenRigPlacement[] CurrentPlacements() { return new OffscreenRigPlacement[6] { Place(OffscreenRigSlot.PowerFuel, 256f, 192f), Place(OffscreenRigSlot.MonitorRowCard, 416f, 96f), Place(OffscreenRigSlot.QuotaAnnouncement, 384f, 216f), Place(OffscreenRigSlot.ProfitQuotaPanel, 256f, 192f), Place(OffscreenRigSlot.DeadlinePanel, 256f, 192f), Place(OffscreenRigSlot.CctvVanillaMonitor, 1408f, 216f) }; } private static OffscreenRigPlacement Place(OffscreenRigSlot slot, float halfWidth, float halfHeight) { return new OffscreenRigPlacement(slot.ToString(), SlotX(slot), -10000f, halfWidth, halfHeight); } internal static bool TryFindConflict(IReadOnlyList<OffscreenRigPlacement> placements, float minimumClearance, out string detail) { detail = null; if (placements == null) { return false; } for (int i = 0; i < placements.Count; i++) { for (int j = i + 1; j < placements.Count; j++) { OffscreenRigPlacement offscreenRigPlacement = placements[i]; OffscreenRigPlacement offscreenRigPlacement2 = placements[j]; float num = offscreenRigPlacement.HalfWidth + offscreenRigPlacement2.HalfWidth + minimumClearance; float num2 = offscreenRigPlacement.HalfHeight + offscreenRigPlacement2.HalfHeight + minimumClearance; float num3 = Math.Abs(offscreenRigPlacement.CenterX - offscreenRigPlacement2.CenterX); float num4 = Math.Abs(offscreenRigPlacement.CenterY - offscreenRigPlacement2.CenterY); if (!(num3 >= num) && !(num4 >= num2)) { detail = "'" + offscreenRigPlacement.Name + "' and '" + offscreenRigPlacement2.Name + "' are not separated: " + $"x gap {num3:0.###} needs {num:0.###}, " + $"y gap {num4:0.###} needs {num2:0.###}"; return true; } } } return false; } } } namespace Y4NGZCompany.Facility.Stash { public enum CompanyStashKeypadDisplayState { Normal, Denied, Granted } public sealed class CompanyStashKeypadInteractor : MonoBehaviour { public const int EnterButton = -1; private const int InteractLayer = 9; private const float RefreshInterval = 0.2f; private const float ButtonPressDistance = 0.0025f; private const float ButtonPressDuration = 0.1f; private const float ButtonReturnDuration = 0.1f; public static Func<string[], AudioClip> BundledAudioClipProvider; private readonly List<CompanyStashKeypadButton> _buttons = new List<CompanyStashKeypadButton>(11); private readonly Dictionary<Transform, Coroutine> _buttonAnimations = new Dictionary<Transform, Coroutine>(); private TMP_Text _displayText; private Renderer _displayRenderer; private AudioSource _audioSource; private AudioClip _clickClip; private AudioClip _deniedClip; private AudioClip _grantedClip; private bool _built; private float _nextRefreshAt; private bool _warnedMissingButtonVisuals; private static readonly Color NormalColor = new Color(0.98f, 0.5f, 0.032f, 1f); private static readonly Color DeniedColor = new Color(1f, 0.04f, 0.02f, 1f); private static readonly Color GrantedColor = new Color(0.08f, 0.72f, 0.14f, 1f); public ICompanyStashKeypadClient Client { get; private set; } internal int BuiltButtonCount => _buttons.Count; private void Awake() { ResolveOwner(); EnsureBuilt(); } private void Start() { ResolveOwner(); EnsureBuilt(); RefreshButtons(); } private void Update() { ResolveOwner(); EnsureBuilt(); HandleKeyboardEnterSubmit(); if (!(Time.time < _nextRefreshAt)) { _nextRefreshAt = Time.time + 0.2f; RefreshButtons(); } } internal void EnsureBuilt() { if (!_built) { DisableDemoKeypadBehaviours(); ResolveDisplay(); ResolveAudio(); BuildButtonInteractions(); _built = true; } } internal void RefreshButtons() { for (int i = 0; i < _buttons.Count; i++) { _buttons[i]?.RefreshState(); } } internal void RequestButtonPress(int button, PlayerControllerB player, Transform visual) { ResolveOwner(); ICompanyStashKeypadClient client = Client; if (client != null) { if (!client.IsKeypadInteractable()) { SetDisplayText(client.GetKeypadLockedDisplayText(), client.GetKeypadLockedDisplayState()); RefreshButtons(); return; } PlayClick(); AnimateButton(visual); client.PressKeypadButtonLocally(button, player); RefreshButtons(); } } internal string GetButtonTip(int button) { ResolveOwner(); if (Client == null) { return ButtonLabel(button); } return Client.GetKeypadButtonTip(button); } internal string GetDisabledTip() { ResolveOwner(); if (Client == null) { return "[ Keypad unavailable ]"; } return Client.GetKeypadDisabledTip(); } internal bool IsButtonInteractable() { ResolveOwner(); if (Client != null) { return Client.IsKeypadInteractable(); } return false; } internal void SetDisplayText(string text, CompanyStashKeypadDisplayState state) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00ac: 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_00e2: Unknown result type (might be due to invalid IL or missing references) ResolveDisplay(); if ((Object)(object)_displayText != (Object)null) { _displayText.text = text ?? string.Empty; } Color displayColor = GetDisplayColor(state); if ((Object)(object)_displayText != (Object)null) { ((Graphic)_displayText).color = displayColor; } if ((Object)(object)_displayRenderer != (Object)null) { Material material = _displayRenderer.material; if ((Object)(object)material != (Object)null) { if (material.HasProperty("_EmissionColor")) { material.SetColor("_EmissionColor", displayColor * 2.4f); } if (material.HasProperty("_EmissiveColor")) { material.SetColor("_EmissiveColor", displayColor * 2.4f); } if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", displayColor); } if (material.HasProperty("_Color")) { material.SetColor("_Color", displayColor); } } } switch (state) { case CompanyStashKeypadDisplayState.Denied: PlayDenied(); break; case CompanyStashKeypadDisplayState.Granted: PlayGranted(); break; } } private void ResolveOwner() { if (Client == null) { Client = ((Component)this).GetComponentInParent<ICompanyStashKeypadClient>() ?? ((Component)this).GetComponent<ICompanyStashKeypadClient>(); } } private void ResolveDisplay() { if ((Object)(object)_displayText == (Object)null) { _displayText = ((Component)this).GetComponentInChildren<TMP_Text>(true); } if ((Object)(object)_displayRenderer == (Object)null) { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string transformPath = GetTransformPath(((Component)val).transform); if (transformPath.IndexOf("display", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("screen", StringComparison.OrdinalIgnoreCase) >= 0) { _displayRenderer = val; break; } } } } if ((Object)(object)_displayText == (Object)null && Client != null && Client.AllowsFallbackDisplayText) { _displayText = CreateFallbackDisplayText(); } } private void ResolveAudio() { if ((Object)(object)_audioSource == (Object)null) { _audioSource = ((Component)this).GetComponentInChildren<AudioSource>(true); if ((Object)(object)_audioSource == (Object)null) { _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } _audioSource.playOnAwake = false; _audioSource.spatialBlend = 1f; _audioSource.rolloffMode = (AudioRolloffMode)1; _audioSource.volume = 0.72f; _audioSource.minDistance = 1.5f; _audioSource.maxDistance = 14f; } _clickClip = _clickClip ?? LoadKeypadClip("sfx_keypadClick", "sfx_keypadClick.wav"); _deniedClip = _deniedClip ?? LoadKeypadClip("sfx_keypadDeniedd", "sfx_keypadDeniedd.wav"); _grantedClip = _grantedClip ?? LoadKeypadClip("sfx_keypadGranted", "sfx_keypadGranted.wav"); } private static AudioClip LoadKeypadClip(params string[] names) { Func<string[], AudioClip> bundledAudioClipProvider = BundledAudioClipProvider; if (bundledAudioClipProvider == null) { return null; } try { return bundledAudioClipProvider(names); } catch (Exception ex) { ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)("[Keypad] Audio clip provider failed for '" + string.Join("/", names) + "': " + ex.Message)); } return null; } } private void BuildButtonInteractions() { _buttons.Clear(); for (int i = 0; i <= 9; i++) { BuildButtonInteraction(i); } BuildButtonInteraction(-1); } private void BuildButtonInteraction(int button) { Transform val = FindButtonVisual(button); if ((Object)(object)val == (Object)null && Client != null && !Client.AllowsFallbackButtonVisuals) { if (_warnedMissingButtonVisuals) { return; } _warnedMissingButtonVisuals = true; string missingButtonVisualsWarning = Client.MissingButtonVisualsWarning; if (!string.IsNullOrEmpty(missingButtonVisualsWarning)) { ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)missingButtonVisualsWarning); } } return; } if ((Object)(object)val == (Object)null) { val = CreateFallbackButtonVisual(button); } GameObject val2 = FindOrCreateTriggerChild(val, "CompanyStash_KeypadButton_" + ButtonObjectName(button) + "_Interact"); ConfigureTriggerCollider(val2, val, button); CompanyStashKeypadButton companyStashKeypadButton = val2.GetComponent<CompanyStashKeypadButton>(); if ((Object)(object)companyStashKeypadButton == (Object)null) { companyStashKeypadButton = val2.AddComponent<CompanyStashKeypadButton>(); } companyStashKeypadButton.Owner = this; companyStashKeypadButton.Button = button; companyStashKeypadButton.Visual = val; companyStashKeypadButton.ConfigureTrigger(); _buttons.Add(companyStashKeypadButton); } private Transform FindButtonVisual(int button) { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); string[] array = ((button != -1) ? new string[4] { $"bttn{button}", $"button{button}", $"key{button}", button.ToString() } : new string[11] { "bttnEnter", "bttn10", "buttonEnter", "button10", "keyEnter", "key10", "Enter", "Submit", "Confirm", "Return", "OK" }); foreach (Transform val in componentsInChildren) { if (!IsUsableButtonVisual(val)) { continue; } string name = ((Object)val).name ?? string.Empty; for (int j = 0; j < array.Length; j++) { if (IsExactOrPrefixedButtonName(name, array[j])) { return val; } } } foreach (Transform val2 in componentsInChildren) { if (!IsUsableButtonVisual(val2)) { continue; } string name2 = ((Object)val2).name ?? string.Empty; if (button == -1) { if (IsEnterButtonName(name2)) { return val2; } } else if (IsDigitButtonName(name2, button)) { return val2; } } return null; } private static bool IsUsableButtonVisual(Transform candidate) { if ((Object)(object)candidate == (Object)null) { return false; } string transformPath = GetTransformPath(candidate); if (transformPath.IndexOf("Interact", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("Trigger", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("Fallback", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("DD_Wire", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("DD_KeypadTerminal", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("DD_Detonator", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("DD_Display", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("DD_Marking", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("Socket", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } if (!((Object)(object)((Component)candidate).GetComponent<Renderer>() != (Object)null)) { return ((Component)candidate).GetComponentsInChildren<Renderer>(true).Length != 0; } return true; } private static bool IsExactOrPrefixedButtonName(string name, string exactName) { if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(exactName)) { return false; } if (string.Equals(name, exactName, StringComparison.OrdinalIgnoreCase)) { return true; } if (!name.EndsWith("_" + exactName, StringComparison.OrdinalIgnoreCase) && !name.EndsWith("-" + exactName, StringComparison.OrdinalIgnoreCase)) { return name.EndsWith("." + exactName, StringComparison.OrdinalIgnoreCase); } return true; } private void HandleKeyboardEnterSubmit() { Keyboard current = Keyboard.current; if (current == null || (!((ButtonControl)current.enterKey).wasPressedThisFrame && !((ButtonControl)current.numpadEnterKey).wasPressedThisFrame)) { return; } ResolveOwner(); ICompanyStashKeypadClient client = Client; bool num = client?.HasLocalKeypadInput ?? false; bool flag = client?.IsKeypadInteractable() ?? false; if (num && flag) { PlayerControllerB player = GameNetworkManager.Instance?.localPlayerController ?? StartOfRound.Instance?.localPlayerController; if (CanLocalPlayerSubmitKeyboardEnter(player)) { RequestButtonPress(-1, player, FindButtonVisual(-1)); } } } private TMP_Text CreateFallbackDisplayText() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //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_0048: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Renderer val = _displayRenderer ?? FindPanelRenderer(); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = new GameObject("DisplayCanvas"); val2.transform.SetParent(((Component)val).transform, false); Bounds val3 = CalculateRendererLocalBounds(((Component)val).transform, val); int num = SmallestAxis(((Bounds)(ref val3)).size); Vector3 val4 = AxisVector(num); Vector3 extents = ((Bounds)(ref val3)).extents; float num2 = num switch { 1 => extents.y, 0 => extents.x, _ => extents.z, }; val2.transform.localPosition = ((Bounds)(ref val3)).center + val4 * (num2 + 0.001f); val2.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, val4); val2.transform.localScale = Vector3.one * 0.018f; GameObject val5 = new GameObject("DisplayText"); val5.transform.SetParent(val2.transform, false); val5.transform.localPosition = Vector3.zero; val5.transform.localRotation = Quaternion.identity; val5.transform.localScale = Vector3.one; TextMeshPro obj = val5.AddComponent<TextMeshPro>(); ((TMP_Text)obj).text = "_ _ _ _"; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).enableAutoSizing = true; ((TMP_Text)obj).fontSizeMin = 0.18f; ((TMP_Text)obj).fontSizeMax = 0.85f; ((Graphic)obj).color = NormalColor; ((TMP_Text)obj).rectTransform.sizeDelta = new Vector2(5.4f, 1.3f); return (TMP_Text)(object)obj; } private Renderer FindPanelRenderer() { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string transformPath = GetTransformPath(((Component)val).transform); if (transformPath.IndexOf("panel", StringComparison.OrdinalIgnoreCase) >= 0 || transformPath.IndexOf("keypad", StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } } return null; } private bool CanLocalPlayerSubmitKeyboardEnter(PlayerControllerB player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return false; } if (player.inTerminalMenu) { return false; } if ((Object)(object)player.quickMenuManager != (Object)null && player.quickMenuManager.isMenuOpen) { return false; } if (player.isTypingChat) { return false; } return Vector3.Distance(((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform.position : ((Component)player).transform.position, ((Component)this).transform.position) <= 4f; } private static bool IsEnterButtonName(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.ToLowerInvariant(); if (text.Contains("enter") || text.Contains("submit") || text.Contains("confirm") || text.Contains("return")) { return true; } if (text == "ok" || text.EndsWith("_ok") || text.EndsWith("-ok")) { return true; } if (text.Contains("10")) { if (!text.Contains("bttn") && !text.Contains("button")) { return text.Contains("key"); } return true; } return false; } private static bool IsDigitButtonName(string name, int digit) { if (string.IsNullOrWhiteSpace(name)) { return false; } string value = Mathf.Clamp(digit, 0, 9).ToString(); string text = name.ToLowerInvariant(); if (text.Contains(value)) { if (!text.Contains("bttn") && !text.Contains("button")) { return text.Contains("key"); } return true; } return false; } private Transform CreateFallbackButtonVisual(int button) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = ((button == -1) ? "bttnEnter" : $"bttn{button}"); obj.transform.SetParent(((Component)this).transform, false); obj.transform.localPosition = EstimateFallbackButtonPosition(button); obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = ((button == -1) ? new Vector3(0.13f, 0.035f, 0.045f) : new Vector3(0.045f, 0.035f, 0.045f)); Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } return obj.transform; } private static Vector3 EstimateFallbackButtonPosition(int button) { //IL_0013: 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) int num; switch (button) { case -1: return new Vector3(0.055f, 0.73f, 0.435f); default: num = button - 1; break; case 0: num = 10; break; } int num2 = num / 3; return new Vector3((float)(num % 3 - 1) * 0.055f, 0.92f - (float)num2 * 0.06f, 0.435f); } private static GameObject FindOrCreateTriggerChild(Transform visual, string name) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)visual != (Object)null) ? visual.Find(name) : null); GameObject val2 = (GameObject)(((Object)(object)val != (Object)null) ? ((object)((Component)val).gameObject) : ((object)new GameObject(name))); if ((Object)(object)visual != (Object)null) { val2.transform.SetParent(visual, false); } val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; return val2; } private static void ConfigureTriggerCollider(GameObject triggerObject, Transform visual, int button) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_004a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) triggerObject.layer = ResolveLayer("InteractableObject", 9); SetTagSafe(triggerObject, "InteractTrigger"); BoxCollider val = triggerObject.GetComponent<BoxCollider>(); if ((Object)(object)val == (Object)null) { val = triggerObject.AddComponent<BoxCollider>(); } ((Collider)val).isTrigger = true; Bounds val2 = CalculateButtonColliderBounds(visual); if (button == -1) { ((Bounds)(ref val2)).size = new Vector3(ExpandLocalColliderAxis(((Bounds)(ref val2)).size.x, 2f, 0.002f), ExpandLocalColliderAxis(((Bounds)(ref val2)).size.y, 2f, 0.002f), ExpandLocalColliderAxis(((Bounds)(ref val2)).size.z, 2.5f, 0.002f)); } val.center = ((Bounds)(ref val2)).center; val.size = ((Bounds)(ref val2)).size; } private static Bounds CalculateButtonColliderBounds(Transform visual) { //IL_0009: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0271: 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_0294: 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_022c: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c0: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_01e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)visual == (Object)null) { return new Bounds(Vector3.zero, new Vector3(0.006f, 0.006f, 0.004f)); } Renderer[] componentsInChildren = ((Component)visual).GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return new Bounds(Vector3.zero, new Vector3(0.006f, 0.006f, 0.004f)); } bool flag = false; Bounds result = default(Bounds); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } Mesh rendererMesh = GetRendererMesh(val); if ((Object)(object)rendererMesh == (Object)null) { continue; } Bounds bounds = rendererMesh.bounds; Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z) }; for (int j = 0; j < array.Length; j++) { Vector3 val2 = visual.InverseTransformPoint(((Component)val).transform.TransformPoint(array[j])); if (!flag) { ((Bounds)(ref result))..ctor(val2, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val2); } } } if (!flag) { return new Bounds(Vector3.zero, new Vector3(0.006f, 0.006f, 0.004f)); } ((Bounds)(ref result)).size = new Vector3(ExpandLocalColliderAxis(((Bounds)(ref result)).size.x, 1.45f, 0.0005f), ExpandLocalColliderAxis(((Bounds)(ref result)).size.y, 1.45f, 0.0005f), ExpandLocalColliderAxis(((Bounds)(ref result)).size.z, 2.25f, 0.0015f)); return result; } private static Bounds CalculateRendererLocalBounds(Transform localRoot, Renderer renderer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00cf: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0140: 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) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localRoot == (Object)null || (Object)(object)renderer == (Object)null) { return new Bounds(Vector3.zero, Vector3.one * 0.01f); } Mesh rendererMesh = GetRendererMesh(renderer); if ((Object)(object)rendererMesh == (Object)null) { return new Bounds(Vector3.zero, Vector3.one * 0.01f); } Bounds bounds = rendererMesh.bounds; Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z) }; Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(localRoot.InverseTransformPoint(((Component)renderer).transform.TransformPoint(array[0])), Vector3.zero); for (int i = 1; i < array.Length; i++) { ((Bounds)(ref result)).Encapsulate(localRoot.InverseTransformPoint(((Component)renderer).transform.TransformPoint(array[i]))); } return result; } private static int SmallestAxis(Vector3 size) { //IL_0000: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (size.x <= size.y && size.x <= size.z) { return 0; } if (size.y <= size.x && size.y <= size.z) { return 1; } return 2; } private static Vector3 AxisVector(int axis) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(axis switch { 0 => Vector3.right, 1 => Vector3.up, _ => Vector3.forward, }); } private static Mesh GetRendererMesh(Renderer renderer) { if ((Object)(object)renderer == (Object)null) { return null; } MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { return component.sharedMesh; } SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (!((Object)(object)val != (Object)null)) { return null; } return val.sharedMesh; } private static float ExpandLocalColliderAxis(float size, float multiplier, float padding) { if (size <= 1E-05f) { return padding; } return Mathf.Max(size * multiplier, size + padding); } private void AnimateButton(Transform visual) { if (!((Object)(object)visual == (Object)null)) { if (_buttonAnimations.TryGetValue(visual, out var value) && value != null) { ((MonoBehaviour)this).StopCoroutine(value); } _buttonAnimations[visual] = ((MonoBehaviour)this).StartCoroutine(AnimateButtonRoutine(visual)); } } private IEnumerator AnimateButtonRoutine(Transform visual) { Vector3 start = visual.localPosition; Vector3 pressed = start + new Vector3(0f, 0f, 0.0025f); float elapsed = 0f; while (elapsed < 0.1f) { elapsed += Time.deltaTime; visual.localPosition = Vector3.Lerp(start, pressed, Mathf.Clamp01(elapsed / 0.1f)); yield return null; } visual.localPosition = pressed; elapsed = 0f; while (elapsed < 0.1f) { elapsed += Time.deltaTime; visual.localPosition = Vector3.Lerp(pressed, start, Mathf.Clamp01(elapsed / 0.1f)); yield return null; } visual.localPosition = start; _buttonAnimations.Remove(visual); } private void DisableDemoKeypadBehaviours() { MonoBehaviour[] componentsInChildren = ((Component)this).GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string a = ((object)val).GetType().FullName ?? string.Empty; if (string.Equals(a, "NavKeypad.Keypad", StringComparison.Ordinal) || string.Equals(a, "NavKeypad.KeypadInteractionFPV", StringComparison.Ordinal)) { ((Behaviour)val).enabled = false; } } } } private void PlayClick() { PlayOneShot(_clickClip, 0.62f); } private void PlayDenied() { PlayOneShot(_deniedClip, 0.75f); } private void PlayGranted() { PlayOneShot(_grantedClip, 0.8f); } private void PlayOneShot(AudioClip clip, float volume) { ResolveAudio(); if ((Object)(object)_audioSource != (Object)null && (Object)(object)clip != (Object)null) { _audioSource.PlayOneShot(clip, volume); } } private static Color GetDisplayColor(CompanyStashKeypadDisplayState state) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (Color)(state switch { CompanyStashKeypadDisplayState.Denied => DeniedColor, CompanyStashKeypadDisplayState.Granted => GrantedColor, _ => NormalColor, }); } private static string ButtonLabel(int button) { if (button != -1) { return $"Press [{Mathf.Clamp(button, 0, 9)}]"; } return "Press [Enter]"; } private static string ButtonObjectName(int button) { if (button != -1) { return button.ToString(); } return "Enter"; } private static Bounds Encapsulate(Bounds a, Bounds b) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) ((Bounds)(ref a)).Encapsulate(((Bounds)(ref b)).min); ((Bounds)(ref a)).Encapsulate(((Bounds)(ref b)).max); return a; } private static string GetTransformPath(Transform transform) { if ((Object)(object)transform == (Object)null) { return string.Empty; } string text = ((Object)transform).name; Transform parent = transform.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static int ResolveLayer(string name, int fallback) { int num = LayerMask.NameToLayer(name); if (num < 0) { return fallback; } return num; } private static void SetTagSafe(GameObject obj, string tag) { try { obj.tag = tag; } catch { obj.tag = "Untagged"; } } } public sealed class CompanyStashKeypadButton : MonoBehaviour { public CompanyStashKeypadInteractor Owner; public int Button; public Transform Visual; private InteractTrigger _trigger; private Collider _collider; internal void ConfigureTrigger() { _collider = ((Component)this).GetComponent<Collider>(); _trigger = ((Component)this).GetComponent<InteractTrigger>(); if ((Object)(object)_trigger == (Object)null) { _trigger = ((Component)this).gameObject.AddComponent<InteractTrigger>(); } ConfigureCommonTrigger(_trigger); ((UnityEvent<PlayerControllerB>)(object)_trigger.onInteract).RemoveListener((UnityAction<PlayerControllerB>)OnInteract); ((UnityEvent<PlayerControllerB>)(object)_trigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OnInteract); RefreshState(); } internal void RefreshState() { if (!((Object)(object)_trigger == (Object)null)) { bool interactable = (Object)(object)Owner != (Object)null && Owner.IsButtonInteractable(); _trigger.interactable = interactable; _trigger.hoverTip = (((Object)(object)Owner != (Object)null) ? Owner.GetButtonTip(Button) : "Press keypad"); _trigger.disabledHoverTip = (((Object)(object)Owner != (Object)null) ? Owner.GetDisabledTip() : "[ Keypad unavailable ]"); ApplyInteractionIcons(_trigger); if ((Object)(object)_collider != (Object)null) { _collider.enabled = true; } } } public void OnInteract(PlayerControllerB player) { Owner?.RequestButtonPress(Button, player, Visual); RefreshState(); } private static void ApplyInteractionIcons(InteractTrigger trigger) { if (!((Object)(object)trigger == (Object)null) && !((Object)(object)trigger.hoverIcon != (Object)null)) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController ?? StartOfRound.Instance?.localPlayerController; if (!((Object)(object)val?.grabItemIcon == (Object)null)) { trigger.hoverIcon = val.grabItemIcon; trigger.disabledHoverIcon = val.grabItemIcon; } } } private static void ConfigureCommonTrigger(InteractTrigger trigger) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown trigger.oneHandedItemAllowed = true; trigger.twoHandedItemAllowed = true; trigger.holdInteraction = false; trigger.timeToHold = 0.1f; trigger.timeToHoldSpeedMultiplier = 1f; trigger.interactCooldown = true; trigger.cooldownTime = 0.08f; trigger.disableTriggerMesh = true; ApplyInteractionIcons(trigger); if (trigger.onInteract == null) { trigger.onInteract = new InteractEvent(); } if (trigger.onInteractEarly == null) { trigger.onInteractEarly = new InteractEvent(); } if (trigger.onInteractEarlyOtherClients == null) { trigger.onInteractEarlyOtherClients = new InteractEvent(); } if (trigger.onStopInteract == null) { trigger.onStopInteract = new InteractEvent(); } if (trigger.onCancelAnimation == null) { trigger.onCancelAnimation = new InteractEvent(); } if (trigger.holdingInteractEvent == null) { trigger.holdingInteractEvent = new InteractEventFloat(); } } } public interface ICompanyStashKeypadClient { bool HasLocalKeypadInput { get; } bool AllowsFallbackDisplayText { get; } bool AllowsFallbackButtonVisuals { get; } string MissingButtonVisualsWarning { get; } bool IsKeypadInteractable(); string GetKeypadButtonTip(int button); string GetKeypadDisabledTip(); void PressKeypadButtonLocally(int button, PlayerControllerB player); string GetKeypadLockedDisplayText(); CompanyStashKeypadDisplayState GetKeypadLockedDisplayState(); } } namespace Y4NGZCompany.Facility.Shared { public static class FacilityAudioClipLoader { private const string AudioDirectory = "Audio"; private const string ContractAudioDirectory = "ContractAudio"; private static readonly string[] PackageDirectoryNames = new string[6] { "Y4NGZCore", "y4ngz-Y4NGZCore", "Y4NGZCompany", "y4ngz-Y4NGZCompany", "LethalCCTV", "y4ngz-LethalCCTV" }; private static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, List<Action<AudioClip>>> Pending = new Dictionary<string, List<Action<AudioClip>>>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> Failed = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public static void Request(MonoBehaviour owner, string fileName, Action<AudioClip> completed) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || string.IsNullOrWhiteSpace(fileName)) { return; } if (Clips.TryGetValue(fileName, out var value) && (Object)(object)value != (Object)null) { completed?.Invoke(value); } else { if (Failed.Contains(fileName)) { return; } if (Pending.TryGetValue(fileName, out var value2)) { if (completed != null) { value2.Add(completed); } return; } string text = ResolvePath(fileName, ((object)owner).GetType().Assembly); if (string.IsNullOrEmpty(text)) { Failed.Add(fileName); ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)("[LethalCCTV][Audio] Missing facility audio '" + fileName + "'.")); } return; } AudioType val = ResolveAudioType(text); if ((int)val == 0) { Failed.Add(fileName); ManualLogSource log2 = CoreDiagnostics.Log; if (log2 != null) { log2.LogWarning((object)("[LethalCCTV][Audio] Unsupported facility audio extension '" + fileName + "'.")); } return; } value2 = new List<Action<AudioClip>>(); if (completed != null) { value2.Add(completed); } Pending[fileName] = value2; owner.StartCoroutine(Load(fileName, text, val)); } } private static IEnumerator Load(string fileName, string path, AudioType audioType) { //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) UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, audioType); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { Failed.Add(fileName); Pending.Remove(fileName); ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)("[LethalCCTV][Audio] Failed loading '" + fileName + "': " + request.error)); } yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content == (Object)null) { Failed.Add(fileName); Pending.Remove(fileName); ManualLogSource log2 = CoreDiagnostics.Log; if (log2 != null) { log2.LogWarning((object)("[LethalCCTV][Audio] Decoded null clip '" + fileName + "'.")); } yield break; } ((Object)content).name = "Y4NGZ_" + Path.GetFileNameWithoutExtension(fileName); Clips[fileName] = content; if (Pending.TryGetValue(fileName, out var value)) { Pending.Remove(fileName); for (int i = 0; i < value.Count; i++) { try { value[i]?.Invoke(content); } catch (Exception ex) { ManualLogSource log3 = CoreDiagnostics.Log; if (log3 != null) { log3.LogWarning((object)("[LethalCCTV][Audio] Clip callback failed for '" + fileName + "': " + ex.Message)); } } } } ManualLogSource log4 = CoreDiagnostics.Log; if (log4 != null) { log4.LogInfo((object)$"[LethalCCTV][Audio] Loaded '{fileName}' as {audioType}."); } } finally { ((IDisposable)request)?.Dispose(); } } private static string ResolvePath(string fileName, Assembly requester) { string text = fileName.Replace('/', Path.DirectorySeparatorChar); foreach (string item in EnumerateRoots(requester)) { string text2 = Path.Combine(item, "Audio", text); if (File.Exists(text2)) { return text2; } string text3 = Path.Combine(item, "ContractAudio", text); if (File.Exists(text3)) { return text3; } string text4 = Path.Combine(item, text); if (File.Exists(text4)) { return text4; } } return null; } private static IEnumerable<string> EnumerateRoots(Assembly requester) { HashSet<string> seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase); List<string> roots = new List<string>(); Add(DirectoryOf(requester)); Add(DirectoryOf(typeof(FacilityAudioClipLoader).Assembly)); string text = null; try { text = Paths.PluginPath; } catch (Exception ex) { ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)("[Y4NGZCore][Audio] Plugin root resolve failed: " + ex.Message)); } } if (!string.IsNullOrEmpty(text)) { for (int i = 0; i < PackageDirectoryNames.Length; i++) { string text2 = Path.Combine(text, PackageDirectoryNames[i]); if (Directory.Exists(text2)) { Add(text2); } } } return roots; void Add(string candidate) { if (!string.IsNullOrEmpty(candidate) && seen.Add(candidate)) { roots.Add(candidate); } } } private static string DirectoryOf(Assembly assembly) { if (assembly == null) { return null; } try { string location = assembly.Location; return string.IsNullOrEmpty(location) ? null : Path.GetDirectoryName(location); } catch (Exception ex) { ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)("[Y4NGZCore][Audio] Assembly directory resolve failed: " + ex.Message)); } return null; } } private static AudioType ResolveAudioType(string path) { string extension = Path.GetExtension(path); if (!string.Equals(extension, ".ogg", StringComparison.OrdinalIgnoreCase)) { if (!string.Equals(extension, ".wav", StringComparison.OrdinalIgnoreCase)) { if (!string.Equals(extension, ".mp3", StringComparison.OrdinalIgnoreCase)) { return (AudioType)0; } return (AudioType)13; } return (AudioType)20; } return (AudioType)14; } } internal static class FacilitySmokeEffectBuilder { private static Material _smokeMaterial; private static Texture2D _softCircleTexture; internal static ParticleSystem BuildSmoke(Transform parent, string objectName, float scale = 1f) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(scale, 0.1f, 2f); GameObject val = new GameObject(string.IsNullOrWhiteSpace(objectName) ? "Smoke" : objectName); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.6f, 2.6f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.22f, 0.48f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.18f * num, 0.4f * num); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.2f, 0.2f, 0.22f, 0.35f), new Color(0.32f, 0.32f, 0.34f, 0.28f)); ((MainModule)(ref main)).gravityModifier = new MinMaxCurve(-0.015f); ((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(90f * num); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(9f * num); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 16f; ((ShapeModule)(ref shape)).radius = 0.06f * num; ((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.42f, 0.15f), new GradientAlphaKey(0.26f, 0.6f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val3); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 0.6f, 1f, 1.8f)); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)0; component.alignment = (ParticleSystemRenderSpace)0; component.minParticleSize = 0.004f; component.maxParticleSize = 0.28f * num; ((Renderer)component).sharedMaterial = GetOrCreateSmokeMaterial(); return val2; } internal static Material CreateParticleMaterial(string name, Color color, bool additive) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("HDRP/Unlit") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Transparent") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard")) { name = name, hideFlags = (HideFlags)61, renderQueue = 3100 }; Texture2D orCreateSoftCircleTexture = GetOrCreateSoftCircleTexture(); SetTextureIfPresent(val, "_BaseColorMap", (Texture)(object)orCreateSoftCircleTexture); SetTextureIfPresent(val, "_MainTex", (Texture)(object)orCreateSoftCircleTexture); SetTextureIfPresent(val, "_UnlitColorMap", (Texture)(object)orCreateSoftCircleTexture); val.color = color; SetColorIfPresent(val, "_Color", color); SetColorIfPresent(val, "_BaseColor", color); SetColorIfPresent(val, "_UnlitColor", color); SetColorIfPresent(val, "_TintColor", color); if (additive) { SetColorIfPresent(val, "_EmissionColor", color * 6f); SetColorIfPresent(val, "_EmissiveColor", color * 6f); } BlendMode val2 = (BlendMode)(additive ? 1 : 10); SetFloatIfPresent(val, "_SurfaceType", 1f); SetFloatIfPresent(val, "_BlendMode", additive ? 1f : 0f); SetFloatIfPresent(val, "_AlphaCutoffEnable", 0f); SetFloatIfPresent(val, "_ZWrite", 0f); SetFloatIfPresent(val, "_SrcBlend", 5f); SetFloatIfPresent(val, "_DstBlend", (float)val2); SetFloatIfPresent(val, "_AlphaSrcBlend", 5f); SetFloatIfPresent(val, "_AlphaDstBlend", (float)val2); SetFloatIfPresent(val, "_CullMode", 0f); SetFloatIfPresent(val, "_TransparentCullMode", 0f); val.SetOverrideTag("RenderType", "Transparent"); val.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); if (additive) { val.EnableKeyword("_BLENDMODE_ADD"); val.DisableKeyword("_BLENDMODE_ALPHA"); } else { val.EnableKeyword("_BLENDMODE_ALPHA"); val.DisableKeyword("_BLENDMODE_ADD"); } val.EnableKeyword("_ENABLE_FOG_ON_TRANSPARENT"); val.DisableKeyword("_ALPHATEST_ON"); return val; } private static Material GetOrCreateSmokeMaterial() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_smokeMaterial == (Object)null) { _smokeMaterial = CreateParticleMaterial("Y4NGZ_BlackoutBreakerSmoke", new Color(0.5f, 0.5f, 0.52f, 1f), additive: false); } return _smokeMaterial; } private static Texture2D GetOrCreateSoftCircleTexture() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_softCircleTexture != (Object)null) { return _softCircleTexture; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { name = "Y4NGZ_BlackoutDistressTexture", hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; float num = 15.5f; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num2 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num) * ((float)i - num)) / num; float num3 = Mathf.Clamp01(1f - num2); num3 *= num3; val.SetPixel(j, i, new Color(1f, 1f, 1f, num3)); } } val.Apply(false, true); _softCircleTexture = val; return val; } private static void SetTextureIfPresent(Material material, string property, Texture texture) { if ((Object)(object)texture != (Object)null && material.HasProperty(property)) { material.SetTexture(property, texture); } } private static void SetColorIfPresent(Material material, string property, Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(property)) { material.SetColor(property, color); } } private static void SetFloatIfPresent(Material material, string property, float value) { if (material.HasProperty(property)) { material.SetFloat(property, value); } } } } namespace Y4NGZCompany.Facility.Security { public static class EnemyLocationPulseService { public const float PulseIntervalSeconds = 20f; private static readonly List<Vector3> InteriorPlayerLocations = new List<Vector3>(8); private static readonly Dictionary<int, float> NextAllowedPulseByEnemy = new Dictionary<int, float>(); public static void ResetRunState() { InteriorPlayerLocations.Clear(); NextAllowedPulseByEnemy.Clear(); } public static void PulseEnemies(IReadOnlyList<EnemyAI> enemies, float unscaledNow) { //IL_0068: 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) if (enemies == null || enemies.Count == 0) { return; } CaptureInteriorPlayerLocations(); if (InteriorPlayerLocations.Count == 0) { return; } for (int i = 0; i < enemies.Count; i++) { EnemyAI val = enemies[i]; if (IsValidInteriorEnemy(val) && (((NetworkBehaviour)val).IsServer || ((NetworkBehaviour)val).IsOwner)) { int instanceID = ((Object)val).GetInstanceID(); if ((!NextAllowedPulseByEnemy.TryGetValue(instanceID, out var value) || !(unscaledNow + 0.001f < value)) && TryPickClosestLocation(((Component)val).transform.position, out var destination)) { ApplyFrozenDestination(val, destination); NextAllowedPulseByEnemy[instanceID] = unscaledNow + 20f; } } } } public static bool IsValidInteriorEnemy(EnemyAI enemy) { if ((Object)(object)enemy != (Object)null && !enemy.isEnemyDead && !enemy.isOutside) { return !enemy.isInsidePlayerShip; } return false; } private static void CaptureInteriorPlayerLocations() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) InteriorPlayerLocations.Clear(); PlayerControllerB[] array = StartOfRound.Instance?.allPlayerScripts; if (array == null) { return; } foreach (PlayerControllerB val in array) { if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && val.isInsideFactory) { InteriorPlayerLocations.Add(((Component)val).transform.position); } } } private static bool TryPickClosestLocation(Vector3 enemyPosition, out Vector3 destination) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) destination = Vector3.zero; float num = float.PositiveInfinity; bool result = false; for (int i = 0; i < InteriorPlayerLocations.Count; i++) { Vector3 val = InteriorPlayerLocations[i]; Vector3 val2 = val - enemyPosition; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; destination = val; result = true; } } return result; } private static void ApplyFrozenDestination(EnemyAI enemy, Vector3 frozenDestination) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) enemy.moveTowardsDestination = true; enemy.SetDestinationToPosition(frozenDestination, false); } } } namespace Y4NGZCompany.Facility.Interior { internal enum InteriorSelectionProfile { Generic, ShadowRaid } internal readonly struct InteriorTileSelection { internal readonly Tile Tile; internal readonly Vector3 FloorPosition; internal readonly Quaternion Rotation; internal readonly float Score; internal readonly float PathDistance; internal readonly float HorizontalDistance; internal readonly float NormalizedDepth; internal readonly float NormalizedBranchDepth; internal readonly float Area; internal readonly int DoorwayCount; internal readonly bool IsOnMainPath; internal string TileName { get { if (!((Object)(object)Tile != (Object)null)) { return "<null>"; } return ((Object)Tile).name; } } internal Bounds Bounds { get { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Tile != (Object)null)) { return default(Bounds); } return Tile.Bounds; } } internal InteriorTileSelection(Tile tile, Vector3 floorPosition, Quaternion rotation, float score, float pathDistance, float horizontalDistance, float normalizedDepth, float normalizedBranchDepth, float area, int doorwayCount, bool isOnMainPath) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Tile = tile; FloorPosition = floorPosition; Rotation = rotation; Score = score; PathDistance = pathDistance; HorizontalDistance = horizontalDistance; NormalizedDepth = normalizedDepth; NormalizedBranchDepth = normalizedBranchDepth; Area = area; DoorwayCount = doorwayCount; IsOnMainPath = isOnMainPath; } } internal static class InteriorAnchorService { private readonly struct Candidate { internal readonly Tile Tile; internal readonly Vector3 FloorPosition; internal readonly float Score; internal readonly float PathDistance; internal readonly float HorizontalDistance; internal readonly float NormalizedDepth; internal readonly float NormalizedBranchDepth; internal readonly float Area; internal readonly int DoorwayCount; internal readonly bool IsOnMainPath; internal readonly bool Valid; internal readonly string DecisionReason; internal Candidate(Tile tile, Vector3 floorPosition, float score, float pathDistance, float horizontalDistance, float normalizedDepth, float normalizedBranchDepth, float area, int doorwayCount, bool isOnMainPath, bool valid, string decisionReason) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Tile = tile; FloorPosition = floorPosition; Score = score; PathDistance = pathDistance; HorizontalDistance = horizontalDistance; NormalizedDepth = normalizedDepth; NormalizedBranchDepth = normalizedBranchDepth; Area = area; DoorwayCount = doorwayCount; IsOnMainPath = isOnMainPath; Valid = valid; DecisionReason = decisionReason ?? string.Empty; } } private readonly struct CandidateRules { internal readonly float MinArea; internal readonly float MinDepth; internal readonly float MinBranchDepth; internal readonly float AbsoluteMinBranchDepth; internal readonly float MinPathDistance; internal readonly float MinHorizontalDistance; internal readonly int MinDoorways; internal readonly int MaxDoorways; internal readonly float HorizontalWeight; internal readonly float DepthWeight; internal readonly float BranchWeight; internal readonly float AreaWeight; internal readonly float BranchRoomBonus; internal readonly float MainPathPenalty; internal readonly float LowDoorwayBonus; internal readonly float ExtraDoorwayPenalty; internal CandidateRules(float minArea, float minDepth, float minBranchDepth, float absoluteMinBranchDepth, float minPathDistance, float minHorizontalDistance, int minDoorways, int maxDoorways, float horizontalWeight, float depthWeight, float branchWeight, float areaWeight, float branchRoomBonus, float mainPathPenalty, float lowDoorwayBonus, float extraDoorwayPenalty) { MinArea = minArea; MinDepth = minDepth; MinBranchDepth = minBranchDepth; AbsoluteMinBranchDepth = absoluteMinBranchDepth; MinPathDistance = minPathDistance; MinHorizontalDistance = minHorizontalDistance; MinDoorways = minDoorways; MaxDoorways = maxDoorways; HorizontalWeight = horizontalWeight; DepthWeight = depthWeight; BranchWeight = branchWeight; AreaWeight = areaWeight; BranchRoomBonus = branchRoomBonus; MainPathPenalty = mainPathPenalty; LowDoorwayBonus = lowDoorwayBonus; ExtraDoorwayPenalty = extraDoorwayPenalty; } internal static CandidateRules Create(InteriorSelectionProfile profile) { if (profile == InteriorSelectionProfile.ShadowRaid) { return new CandidateRules(44f, 0.55f, 0.28f, 0.12f, 95f, 48f, 1, 4, 0.6f, 430f, 260f, 0.28f, 130f, -180f, 35f, 26f); } return new CandidateRules(28f, 0.22f, 0f, 0f, 30f, 18f, 0, 6, 0.55f, 240f, 150f, 0.25f, 70f, -20f, 35f, 18f); } } private readonly struct CachedSelection { internal readonly InteriorTileSelection Selection; internal readonly bool HasSelection; internal CachedSelection(InteriorTileSelection selection, bool hasSelection) { Selection = selection; HasSelection = hasSelection; } } private const float MinTileArea = 28f; private static readonly Dictionary<InteriorSelectionProfile, CachedSelection> CachedSelections = new Dictionary<InteriorSelectionProfile, CachedSelection>(); private static readonly Dictionary<Tile, float> CachedTileEntrancePathDistances = new Dictionary<Tile, float>(); private static readonly Dictionary<Tile, bool> CachedTileEntranceReachable = new Dictionary<Tile, bool>(); private static List<Vector3> CachedEntrancePositions; private static int CachedDungeonHash; private static bool LastEntranceResolutionWasProvisional; private static bool ReachabilityVetoSuppressed; private static bool AnchorRefreshAttempted; private static bool AnchorRejectionWarningLogged; private static List<Vector3> ProvisionalEntrancePositions; private static int ProvisionalEntranceFrame; private const int ProvisionalEntranceReresolveFrames = 30; private const float PointSetMatchSqrEpsilon = 0.0001f; internal static int NavMeshPathCalculationCount { get; private set; } internal static int PhysicsQueryCount { get; private set; } internal static bool AreEntranceAnchorsValidated => CachedEntrancePositions != null; internal static void ResetRunState() { CachedSelections.Clear(); CachedTileEntrancePathDistances.Clear(); CachedTileEntranceReachable.Clear(); CachedEntrancePositions = null; CachedDungeonHash = 0; LastEntranceResolutionWasProvisional = false; ReachabilityVetoSuppressed = false; AnchorRefreshAttempted = false; AnchorRejectionWarningLogged = false; ProvisionalEntrancePositions = null; ProvisionalEntranceFrame = 0; NavMeshPathCalculationCount = 0; PhysicsQueryCount = 0; } internal static void RecordNavMeshPathCalculation() { NavMeshPathCalculationCount++; } internal static void RecordPhysicsQuery(int count = 1) { if (count > 0) { PhysicsQueryCount += count; } } internal static bool TryGetPrimaryInteriorTile(out InteriorTileSelection selection) { return TryGetInteriorTile(InteriorSelectionProfile.Generic, out selection); } internal static bool TryGetInteriorTile(InteriorSelectionProfile profile, out InteriorTileSelection selection) { EnsureDungeonCacheFresh(); if (CachedSelections.TryGetValue(profile, out var value) && value.HasSelection) { selection = value.Selection; return true; } bool num = TrySelectInteriorTile(profile, out selection); if (num) { CachedSelections[profile] = new CachedSelection(selection, hasSelection: true); } return num; } internal static List<Vector3> GetInteriorEntrancePositions() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EnsureDungeonCacheFresh(); if (CachedEntrancePositions != null) { return new List<Vector3>(CachedEntrancePositions); } if (ProvisionalEntrancePositions != null && Time.frameCount - ProvisionalEntranceFrame < 30) { return new List<Vector3>(ProvisionalEntrancePositions); } List<Vector3> list = new List<Vector3>(); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); foreach (EntranceTeleport val in array) { if (!((Object)(object)val == (Object)null) && !val.isEntranceToBuilding) { Transform val2 = (((Object)(object)val.entrancePoint != (Object)null) ? val.entrancePoint : ((Component)val).transform); list.Add(ResolveFloorPosition(val2.position)); } } if (list.Count == 0) { list.Add(RoundManager.FindMainEntrancePosition(false, false)); } List<Vector3> list2 = FilterValidEntrancePositions(list); if (list2.Count == 0) { LastEntranceResolutionWasProvisional = true; ProvisionalEntrancePositions = list; ProvisionalEntranceFrame = Time.frameCount; return new List<Vector3>(list); } if (LastEntranceResolutionWasProvisional) { CachedTileEntrancePathDistances.Clear(); CachedTileEntranceReachable.Clear(); LastEntranceResolutionWasProvisional = false; if (ReachabilityVetoSuppressed) { ReachabilityVetoSuppressed = false; AnchorRefreshAttempted = false; ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)$"[Y4NGZ.InteriorAnchor] REACHABILITY_FAIL_OPEN_END reason=validated-anchors-resolved anchors={list2.Count}. Restoring the entrance-reachability veto and recomputing every tile verdict from the validated anchors."); } } } ProvisionalEntrancePositions = null; ProvisionalEntranceFrame = 0; AnchorRejectionWarningLogged = false; CachedEntrancePositions = list2; return new List<Vector3>(CachedEntrancePositions); } private static void InvalidateEntranceCache() { CachedEntrancePositions = null; ProvisionalEntrancePositions = null; ProvisionalEntranceFrame = 0; } private static List<Vector3> FilterValidEntrancePositions(List<Vector3> points) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(points.Count); if (!TryGetDungeonElevationBand(out var bandMinY, out var bandMaxY)) { bandMinY = 1f; bandMaxY = 0f; } int num = 0; int num2 = 0; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < points.Count; i++) { Vector3 val = points[i]; bool hasNavMeshNearby = NavMesh.SamplePosition(val, ref val2, 12f, -1); EntranceAnchorVerdict entranceAnchorVerdict = InteriorEntranceAnchorPolicy.Evaluate(val.y, hasNavMeshNearby, bandMinY, bandMaxY, 25f); if (entranceAnchorVerdict.Accepted) { float snapDistanceMeters = Vector3.Distance(val, ((NavMeshHit)(ref val2)).position); list.Add(InteriorEntranceAnchorPolicy.ShouldAdoptNavMeshSnap(snapDistanceMeters) ? ((NavMeshHit)(ref val2)).position : val); continue; } if (entranceAnchorVerdict.OffElevationBand) { num++; } if (entranceAnchorVerdict.OffNavMesh) { num2++; } } if (list.Count < points.Count && !AnchorRejectionWarningLogged) { AnchorRejectionWarningLogged = true; ManualLogSource log = CoreDiagnostics.Log; if (log != null) { log.LogWarning((object)string.Format("[Y4NGZ.InteriorAnchor] Rejected {0} of {1} facility entrance anchor(s): offElevationBand={2}, offNavMesh={3}, band={4:0.0}..{5:0.0} (+/-{6:0.0}). {7}", points.Count - list.Count, points.Count, num, num2, bandMinY, bandMaxY, 25f, (list.Count == 0) ? "No usable anchor this query; not caching, will re-resolve." : "Keeping the validated anchors.")); } } return list; } private static bool TryGetDungeonElevationBand(out float bandMinY, out float bandMaxY) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) bandMinY = 1f; bandMaxY = 0f; RoundManager instance = RoundManager.Instance; object obj; if (instance == null) { obj = null; } else { RuntimeDungeon dungeonGenerator = instance.dungeonGenerator; if (dungeonGenerator == null) { obj = null; } else { DungeonGenerator generator = dungeonGenerator.Generator; obj = ((generator != null) ? generator.CurrentDungeon : null); } } Dungeon val = (Dungeon)obj; if (((val != null) ? val.AllTiles : null) == null || val.AllTiles.Count == 0) { return false; } List<float> list = new List<float>(val.AllTiles.Count); List<float> list2 = new List<float>(val.AllTiles.Count); for (int i = 0; i < val.AllTiles.Count; i++) { Tile val2 = val.AllTiles[i]; if (!((Object)(object)val2 == (Object)null)) { Bounds bounds = val2.Bounds; list.Add(((Bounds)(ref bounds)).min.y); list2.Add(((Bounds)(ref bounds)).max.y); } } return InteriorEntranceAnchorPolicy.TryBuildElevationBand(list, list2, out bandMinY, out bandMaxY); } internal static Vector3 ResolveFloorPosition(Vector3 origin) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!TryResolveFloorPosition(origin, out var floor)) { return origin; } return floor; } internal static bool TryResolveFloorPosition(Vector3 origin, out Vector3 floor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) floor = origin; StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } RecordPhysicsQuery(); RaycastHit val = default(RaycastHit); if (!Physics.Raycast(origin + Vector3.up * 5f, Vector3.down, ref val, 12f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } floor = ((RaycastHit)(ref val)).point; return true; } internal static float EstimatePathDistance(Vector3 from, Vector3 to) { //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) TryEstimatePathDistance(from, to, out var distance); return distance; } private static bool TryEstimatePathDistance(Vector3 from, Vector3 to, out float distance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //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_0049: 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_0086: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(from, ref val, 12f, -1) && NavMesh.SamplePosition(to, ref val2, 12f, -1)) { NavMeshPath val3 = new NavMeshPath(); RecordNavMeshPathCalculation(); if (NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position, -1, val3) && (int)val3.status == 0 && val3.corners != null && val3.corners.Length > 1) { float num = 0f; for (int i = 1; i < val3.corners.Length; i++) { num += Vector3.Distance(val3.corners[i - 1], val3.corners[i]); } distance = num; return true; } } distance = Vector3.Distance(from, to); return false; } internal static float EstimateNearestPathDistance(IReadOnlyList<Vector3> fromPoints, Vector3 to) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) TryEstimateNearestPathDistance(fromPo