using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace Pix.Accessibility; [BepInPlugin("Pix.Accessibility", "Accessibility", "0.6.0")] public sealed class AccessibilityPlugin : BaseUnityPlugin { internal enum ThreatKind { Radar, Aggro, Attack, Damage } private enum ColorblindMode { Off, Deuteranopia, Protanopia, Tritanopia } [HarmonyPatch(typeof(Character), "Damage")] private static class Patch_Character_Damage { private static void Postfix(Character __instance, HitData hit) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ca: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0160: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) try { if (CfgEnabled == null || !CfgEnabled.Value || CfgSrcDamageDirection == null || !CfgSrcDamageDirection.Value) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || __instance != localPlayer || hit == null) { return; } Character val = null; try { val = hit.GetAttacker(); } catch { } string text = ""; float num = 0f; Vector3 val2; if ((Object)(object)val != (Object)null) { val2 = ((Component)val).transform.position; text = SafePrefabName(((Component)val).gameObject); num = Vector3.Distance(((Component)localPlayer).transform.position, val2); _hud?.TryRegisterIconSource(val, text); } else { Vector3 val3 = hit.m_dir; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { val3 = -((Component)localPlayer).transform.forward; } val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { val3 = Vector3.back; } ((Vector3)(ref val3)).Normalize(); val2 = ((Component)localPlayer).transform.position - val3 * 6f; text = "Unknown"; num = 6f; } float num2 = 0f; try { num2 = hit.GetTotalDamage(); } catch { try { num2 = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage(); } catch { } } int severity = ((num2 >= 35f) ? 3 : ((!(num2 >= 12f)) ? 1 : 2)); PushThreat(val2, severity, ThreatKind.Damage, text, num); } catch { } } } [HarmonyPatch(typeof(MonsterAI), "SetTarget")] private static class Patch_MonsterAI_SetTarget { private static void Postfix(MonsterAI __instance, Character attacker) { //IL_00ca: 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_0121: Unknown result type (might be due to invalid IL or missing references) try { if (CfgEnabled == null || !CfgEnabled.Value || CfgSrcAggroTargeting == null || !CfgSrcAggroTargeting.Value) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)attacker == (Object)null || attacker != localPlayer) { return; } Character val = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent() : null); if (!((Object)(object)val == (Object)null) && !val.IsDead()) { string text = SafePrefabName(((Component)val).gameObject); float distance = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)val).transform.position); _hud?.TryRegisterIconSource(val, text); int severity = 2; if (CfgRadarBoostDangerousMobs != null && CfgRadarBoostDangerousMobs.Value && IsDangerousPrefab(text)) { severity = 3; } PushThreat(((Component)val).transform.position, severity, ThreatKind.Aggro, text, distance); } } catch { } } } internal sealed class AccessibilityHud : MonoBehaviour { private struct Callout { public string Text; public float Until; public int Severity; } private struct ThreatSignal { public Vector3 WorldPos; public float Born; public int Severity; public ThreatKind Kind; public string Prefab; public float Distance; } private struct SpriteIcon { public Texture2D Texture; public Rect UV; public bool IsValid; } [CompilerGenerated] private sealed class d__92 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string dictPath; public AccessibilityHud <>4__this; private string[] 5__1; private int 5__2; private string 5__3; private string 5__4; private string 5__5; private UnityWebRequest 5__6; private UnityWebRequestAsyncOperation 5__7; private bool 5__8; private Texture2D 5__9; private SpriteIcon 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__92(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__9 = null; 5__10 = default(SpriteIcon); <>1__state = -2; } private bool MoveNext() { //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Invalid comparison between Unknown and I4 try { int num; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._fileSpriteIconsByPrefab.Clear(); <>4__this._fileIconTexByPrefab.Clear(); 5__1 = null; try { 5__1 = Directory.GetFiles(dictPath, "*.png", SearchOption.TopDirectoryOnly); } catch { 5__1 = null; } if (5__1 == null || 5__1.Length == 0) { <>4__this._fileIconsLoaded = true; <>4__this._fileIconsLoading = false; return false; } 5__2 = 0; goto IL_03ef; case 1: <>1__state = -3; goto IL_021a; case 2: { <>1__state = -1; goto IL_03c0; } IL_021a: if (!((AsyncOperation)5__7).isDone) { <>2__current = null; <>1__state = 1; return true; } 5__8 = false; try { 5__8 = (int)5__6.result == 1; } catch { 5__8 = string.IsNullOrEmpty(5__6.error); } if (5__8) { 5__9 = null; try { 5__9 = DownloadHandlerTexture.GetContent(5__6); } catch { 5__9 = null; } if (!((Object)(object)5__9 == (Object)null)) { try { ((Texture)5__9).filterMode = (FilterMode)1; ((Texture)5__9).wrapMode = (TextureWrapMode)1; } catch { } <>4__this._fileIconTexByPrefab[5__4] = 5__9; 5__10 = default(SpriteIcon); 5__10.Texture = 5__9; 5__10.UV = new Rect(0f, 0f, 1f, 1f); 5__10.IsValid = true; <>4__this._fileSpriteIconsByPrefab[5__4] = 5__10; 5__7 = null; 5__9 = null; 5__10 = default(SpriteIcon); <>m__Finally1(); if (5__2 % 8 == 7) { <>2__current = null; <>1__state = 2; return true; } goto IL_03c0; } } <>m__Finally1(); goto IL_03dd; IL_03c0: 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; goto IL_03dd; IL_03ef: if (5__2 < 5__1.Length) { 5__3 = 5__1[5__2]; if (!string.IsNullOrEmpty(5__3)) { 5__4 = null; try { 5__4 = Path.GetFileNameWithoutExtension(5__3); } catch { 5__4 = null; } if (!string.IsNullOrEmpty(5__4) && !<>4__this._fileIconTexByPrefab.ContainsKey(5__4)) { 5__5 = null; try { 5__5 = "file:///" + 5__3.Replace("\\", "/"); } catch { 5__5 = null; } if (!string.IsNullOrEmpty(5__5)) { 5__6 = null; try { 5__6 = UnityWebRequestTexture.GetTexture(5__5, true); } catch { 5__6 = null; } if (5__6 != null) { <>1__state = -3; 5__7 = 5__6.SendWebRequest(); goto IL_021a; } } } } goto IL_03dd; } <>4__this._fileIconsLoaded = true; <>4__this._fileIconsLoading = false; try { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Accessibility] Loaded Dictionary icons: " + <>4__this._fileSpriteIconsByPrefab.Count)); } } catch { } return false; IL_03dd: num = 5__2 + 1; 5__2 = num; goto IL_03ef; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; try { 5__6.Dispose(); } catch { } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly List _callouts = new List(16); private readonly List _signals = new List(96); private float _lastSignalTime; private GUIStyle _calloutStyle; private Texture2D _bgTex; private Texture2D _bgTexStrong; private GUIStyle _iconLabelStyle; private GUIStyle _iconLabelStyleHC; private Texture2D _iconLabelBgTex; private Texture2D _shapeCircle; private Texture2D _shapeTriangle; private Texture2D _shapeDiamond; private Texture2D _shapeX; private Texture2D _whiteTex; private static Material _glMat; private Texture2D _blackTex; private static float[] _segIntensity; private static Color[] _segColor; private static int[] _segPriority; private float _nextRadarScan; private float _ringAutoAlpha; private readonly Dictionary _radarLastPingById = new Dictionary(256); private readonly Collider[] _radarHitsBuffer = (Collider[])(object)new Collider[256]; private bool _suspended; private bool _wasDead; private readonly Dictionary _spriteIconsByPrefab = new Dictionary(64); private readonly Dictionary _iconTexByPrefab = new Dictionary(64); private bool _fileIconsLoaded; private bool _fileIconsLoading; private readonly Dictionary _fileIconTexByPrefab = new Dictionary(128, StringComparer.OrdinalIgnoreCase); private readonly Dictionary _fileSpriteIconsByPrefab = new Dictionary(128, StringComparer.OrdinalIgnoreCase); private readonly Dictionary _soundLastByPrefab = new Dictionary(128); private readonly HashSet _loggedNoIconForPrefab = new HashSet(128); private readonly HashSet _loggedPortraitFailForPrefab = new HashSet(128); private readonly Dictionary _portraitRtByPrefab = new Dictionary(32); private readonly Dictionary _portraitCloneByPrefab = new Dictionary(32, StringComparer.Ordinal); private readonly Dictionary _iconBuiltAtByPrefab = new Dictionary(StringComparer.Ordinal); private static FieldInfo[] _spriteFields_Character; private static FieldInfo[] _spriteFields_BaseAI; private static PropertyInfo[] _spriteProps_Character; private static PropertyInfo[] _spriteProps_BaseAI; private static MethodInfo[] _spriteMethods_Character; private static MethodInfo[] _spriteMethods_BaseAI; private static bool _spriteFieldScanDone; private GameObject _iconRigRoot; private Camera _iconCam; private Light _iconLight; private void Awake() { //IL_0018: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) _bgTex = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.45f)); _bgTexStrong = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.7f)); _whiteTex = MakeTex(1, 1, Color.white); _blackTex = MakeTex(1, 1, new Color(0f, 0f, 0f, 1f)); _iconLabelBgTex = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.7f)); _shapeCircle = BuildShapeCircle(32, 32); _shapeTriangle = BuildShapeTriangle(32, 32); _shapeDiamond = BuildShapeDiamond(32, 32); _shapeX = BuildShapeX(32, 32); LoadEmbeddedIconDictionary(); } private void OnDestroy() { try { if ((Object)(object)_bgTex != (Object)null) { Object.Destroy((Object)(object)_bgTex); } } catch { } try { if ((Object)(object)_bgTexStrong != (Object)null) { Object.Destroy((Object)(object)_bgTexStrong); } } catch { } try { if ((Object)(object)_whiteTex != (Object)null) { Object.Destroy((Object)(object)_whiteTex); } } catch { } try { if ((Object)(object)_blackTex != (Object)null) { Object.Destroy((Object)(object)_blackTex); } } catch { } foreach (KeyValuePair item in _iconTexByPrefab) { try { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } catch { } } _iconTexByPrefab.Clear(); foreach (KeyValuePair item2 in _fileIconTexByPrefab) { try { if ((Object)(object)item2.Value != (Object)null) { Object.Destroy((Object)(object)item2.Value); } } catch { } } _fileIconTexByPrefab.Clear(); _fileSpriteIconsByPrefab.Clear(); foreach (KeyValuePair item3 in _portraitRtByPrefab) { try { if ((Object)(object)item3.Value != (Object)null) { item3.Value.Release(); } } catch { } } _portraitRtByPrefab.Clear(); try { if ((Object)(object)_iconCam != (Object)null) { Object.Destroy((Object)(object)((Component)_iconCam).gameObject); } } catch { } try { if ((Object)(object)_iconRigRoot != (Object)null) { Object.Destroy((Object)(object)_iconRigRoot); } } catch { } } internal void PushCallout(string text, int severity) { float unscaledTime = Time.unscaledTime; for (int i = 0; i < _callouts.Count; i++) { if (_callouts[i].Text == text) { Callout value = _callouts[i]; value.Until = Mathf.Max(value.Until, unscaledTime + Mathf.Max(0.5f, CfgCalloutSeconds.Value * 0.75f)); value.Severity = Mathf.Max(value.Severity, severity); _callouts[i] = value; return; } } _callouts.Add(new Callout { Text = text, Severity = Mathf.Clamp(severity, 1, 3), Until = unscaledTime + Mathf.Max(0.5f, CfgCalloutSeconds.Value) }); int num = Mathf.Clamp(CfgMaxQueue.Value, 1, 20); while (_callouts.Count > num) { _callouts.RemoveAt(0); } } internal void PushThreat(Vector3 worldPos, int severity, ThreatKind kind, string prefabName, float distance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; _signals.Add(new ThreatSignal { WorldPos = worldPos, Born = unscaledTime, Severity = Mathf.Clamp(severity, 1, 3), Kind = kind, Prefab = (prefabName ?? ""), Distance = Mathf.Max(0f, distance) }); if (_signals.Count > 96) { _signals.RemoveRange(0, _signals.Count - 96); } _lastSignalTime = unscaledTime; } internal bool TrySoundCooldown(string prefab, float cd) { if (string.IsNullOrEmpty(prefab)) { return false; } float unscaledTime = Time.unscaledTime; if (_soundLastByPrefab.TryGetValue(prefab, out var value) && unscaledTime - value < cd) { return false; } _soundLastByPrefab[prefab] = unscaledTime; if (_soundLastByPrefab.Count > 2048) { _soundLastByPrefab.Clear(); } return true; } internal void TryRegisterIconSource(Character ch, string prefabName) { if ((Object)(object)ch == (Object)null || string.IsNullOrEmpty(prefabName) || CfgIconsEnabled == null || !CfgIconsEnabled.Value || _spriteIconsByPrefab.ContainsKey(prefabName)) { return; } if (CfgIconUseSprite != null && CfgIconUseSprite.Value && TryExtractSpriteIcon(ch, prefabName, out var icon) && icon.IsValid) { _spriteIconsByPrefab[prefabName] = icon; if (CfgIconCutoutEnabled == null || !CfgIconCutoutEnabled.Value) { return; } try { Texture2D val = BuildCutoutFromSpriteIcon(icon); if ((Object)(object)val != (Object)null) { _iconTexByPrefab[prefabName] = val; } return; } catch { return; } } if (!_loggedNoIconForPrefab.Contains(prefabName)) { _loggedNoIconForPrefab.Add(prefabName); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Accessibility] No sprite icon found for prefab: " + prefabName + " (will draw without icon unless portrait fallback is enabled)")); } } } private static void EnsureSpriteFieldScan() { if (_spriteFieldScanDone) { return; } _spriteFieldScanDone = true; string[] candidates = new string[7] { "m_minimapIcon", "m_mapIcon", "m_icon", "m_hudIcon", "m_portrait", "m_statusIcon", "m_alertIcon" }; string[] candidates2 = new string[7] { "MinimapIcon", "MapIcon", "Icon", "HudIcon", "Portrait", "StatusIcon", "AlertIcon" }; string[] candidates3 = new string[7] { "GetMinimapIcon", "GetMapIcon", "GetIcon", "GetHudIcon", "GetPortrait", "GetStatusIcon", "GetAlertIcon" }; _spriteFields_Character = CollectSpriteFields(typeof(Character), candidates); _spriteFields_BaseAI = CollectSpriteFields(typeof(BaseAI), candidates); _spriteProps_Character = CollectSpriteProps(typeof(Character), candidates2); _spriteProps_BaseAI = CollectSpriteProps(typeof(BaseAI), candidates2); _spriteMethods_Character = CollectSpriteMethods(typeof(Character), candidates3); _spriteMethods_BaseAI = CollectSpriteMethods(typeof(BaseAI), candidates3); if ((_spriteFields_Character != null && _spriteFields_Character.Length != 0) || (_spriteFields_BaseAI != null && _spriteFields_BaseAI.Length != 0) || (_spriteProps_Character != null && _spriteProps_Character.Length != 0) || (_spriteProps_BaseAI != null && _spriteProps_BaseAI.Length != 0) || (_spriteMethods_Character != null && _spriteMethods_Character.Length != 0) || (_spriteMethods_BaseAI != null && _spriteMethods_BaseAI.Length != 0)) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Accessibility] Icon member scan: Character fields=" + ((_spriteFields_Character != null) ? _spriteFields_Character.Length : 0) + ", props=" + ((_spriteProps_Character != null) ? _spriteProps_Character.Length : 0) + ", methods=" + ((_spriteMethods_Character != null) ? _spriteMethods_Character.Length : 0) + " | BaseAI fields=" + ((_spriteFields_BaseAI != null) ? _spriteFields_BaseAI.Length : 0) + ", props=" + ((_spriteProps_BaseAI != null) ? _spriteProps_BaseAI.Length : 0) + ", methods=" + ((_spriteMethods_BaseAI != null) ? _spriteMethods_BaseAI.Length : 0))); } } else { ManualLogSource log2 = Log; if (log2 != null) { log2.LogInfo((object)"[Accessibility] No Sprite fields/properties/methods discovered on Character/BaseAI (this build may not expose sprite icons via members)."); } } } private static FieldInfo[] CollectSpriteFields(Type t, string[] candidates) { List list = new List(8); for (int i = 0; i < candidates.Length; i++) { try { FieldInfo field = t.GetField(candidates[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (field != null && typeof(Sprite).IsAssignableFrom(field.FieldType)) { list.Add(field); } } catch { } } return (list.Count > 0) ? list.ToArray() : new FieldInfo[0]; } private static PropertyInfo[] CollectSpriteProps(Type t, string[] candidates) { List list = new List(8); for (int i = 0; i < candidates.Length; i++) { try { PropertyInfo property = t.GetProperty(candidates[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (!(property == null) && typeof(Sprite).IsAssignableFrom(property.PropertyType) && (property.GetIndexParameters() == null || property.GetIndexParameters().Length == 0)) { MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (getMethod != null && getMethod.GetParameters().Length == 0) { list.Add(property); } } } catch { } } return (list.Count > 0) ? list.ToArray() : new PropertyInfo[0]; } private static MethodInfo[] CollectSpriteMethods(Type t, string[] candidates) { List list = new List(8); for (int i = 0; i < candidates.Length; i++) { try { MethodInfo method = t.GetMethod(candidates[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, null, Type.EmptyTypes, null); if (!(method == null) && typeof(Sprite).IsAssignableFrom(method.ReturnType) && method.GetParameters().Length == 0) { list.Add(method); } } catch { } } return (list.Count > 0) ? list.ToArray() : new MethodInfo[0]; } private static bool TryExtractSpriteIcon(Character ch, string prefabName, out SpriteIcon icon) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown icon = default(SpriteIcon); EnsureSpriteFieldScan(); if ((Object)ch == (Object)null) { return false; } string pn = NormalizeIconName(prefabName); int bestScore = int.MinValue; SpriteIcon best = default(SpriteIcon); if (_spriteFields_Character != null && _spriteFields_Character.Length != 0) { for (int i = 0; i < _spriteFields_Character.Length; i++) { FieldInfo fieldInfo = _spriteFields_Character[i]; if (!(fieldInfo == null)) { Sprite val = null; try { object? value = fieldInfo.GetValue(ch); val = (Sprite)((value is Sprite) ? value : null); } catch { val = null; } Consider(val); } } } if (_spriteFields_BaseAI != null && _spriteFields_BaseAI.Length != 0) { BaseAI val2 = null; try { val2 = ((Component)ch).GetComponent(); } catch { val2 = null; } if ((Object)val2 != (Object)null) { for (int j = 0; j < _spriteFields_BaseAI.Length; j++) { FieldInfo fieldInfo2 = _spriteFields_BaseAI[j]; if (!(fieldInfo2 == null)) { Sprite val3 = null; try { object? value2 = fieldInfo2.GetValue(val2); val3 = (Sprite)((value2 is Sprite) ? value2 : null); } catch { val3 = null; } Consider(val3); } } } } if (bestScore == int.MinValue) { return false; } icon = best; return true; void Consider(Sprite sp) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown try { if (!((Object)sp == (Object)null) && TryBuildSpriteIcon(sp, out var icon2)) { Texture2D texture = icon2.Texture; if (!((Object)texture == (Object)null)) { int num = 0; int width = ((Texture)texture).width; int height = ((Texture)texture).height; int num2 = width * height; num = ((num2 >= 65536) ? (num + 20) : ((num2 >= 16384) ? (num + 10) : ((num2 < 4096) ? (num + 1) : (num + 5)))); if (((Texture)texture).isReadable) { num += 5; } num += NameMatchBoost(sp, texture); if (num > bestScore) { bestScore = num; best = icon2; } } } } catch { } } int NameMatchBoost(Sprite sp, Texture2D tex) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (string.IsNullOrEmpty(pn)) { return 0; } string text = NormalizeIconName(((Object)sp != (Object)null) ? ((Object)sp).name : null); string text2 = NormalizeIconName(((Object)tex != (Object)null) ? ((Object)tex).name : null); if (!string.IsNullOrEmpty(text) && (text.Contains(pn) || pn.Contains(text))) { return 10000; } if (!string.IsNullOrEmpty(text2) && (text2.Contains(pn) || pn.Contains(text2))) { return 8000; } return 0; } static string NormalizeIconName(string s) { if (string.IsNullOrEmpty(s)) { return string.Empty; } s = s.ToLowerInvariant(); s = s.Replace("(clone)", ""); s = s.Replace("icon", ""); s = s.Replace("ico", ""); StringBuilder stringBuilder = new StringBuilder(s.Length); foreach (char c in s) { if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } } private static bool TryBuildSpriteIcon(Sprite sp, out SpriteIcon icon) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) icon = default(SpriteIcon); if ((Object)(object)sp == (Object)null) { return false; } if ((Object)(object)sp.texture == (Object)null) { return false; } Texture2D texture = sp.texture; Rect textureRect = sp.textureRect; if (((Rect)(ref textureRect)).width < 1f || ((Rect)(ref textureRect)).height < 1f) { return false; } Rect uV = default(Rect); ((Rect)(ref uV))..ctor(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height); icon = new SpriteIcon { Texture = texture, UV = uV, IsValid = true }; return true; } private static bool IsRingModeAlways() { string text = ((CfgRingMode != null && CfgRingMode.Value != null) ? CfgRingMode.Value.Trim() : "Auto"); return text.Equals("Always", StringComparison.OrdinalIgnoreCase); } private static bool IsRingModeAuto() { string text = ((CfgRingMode != null && CfgRingMode.Value != null) ? CfgRingMode.Value.Trim() : "Auto"); return text.Equals("Auto", StringComparison.OrdinalIgnoreCase); } private bool ShouldDrawRing() { if (CfgEnabled == null || !CfgEnabled.Value) { return false; } if (CfgRingEnabled == null || !CfgRingEnabled.Value) { return false; } if (IsRingModeAlways()) { return true; } float unscaledTime = Time.unscaledTime; float num = Mathf.Max(0f, CfgRingAutoHideSeconds.Value); return unscaledTime - _lastSignalTime <= num; } private void EnsureCalloutStyle() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00be: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) float num = 1f; try { if (CfgUiTextScale != null) { num = Mathf.Clamp(CfgUiTextScale.Value, 0.5f, 3f); } } catch { num = 1f; } int num2 = Mathf.Clamp(Mathf.RoundToInt((float)CfgFontSize.Value * num), 10, 64); if (_calloutStyle == null || _calloutStyle.fontSize != num2) { _calloutStyle = new GUIStyle(GUI.skin.label) { wordWrap = true, richText = true, alignment = (TextAnchor)0, fontSize = num2, padding = new RectOffset(10, 10, 8, 8) }; _calloutStyle.normal.textColor = Color.white; } } private void DrawCenterMarker() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && (int)Event.current.type != 7) { return; } float num = 14f; float num2 = 2f; try { if (CfgCenterMarkerSizePx != null) { num = Mathf.Clamp(CfgCenterMarkerSizePx.Value, 4f, 120f); } } catch { } try { if (CfgCenterMarkerThicknessPx != null) { num2 = Mathf.Clamp(CfgCenterMarkerThicknessPx.Value, 1f, 12f); } } catch { } float num3 = (float)Screen.width * 0.5f; float num4 = (float)Screen.height * 0.5f; float num5 = num * 0.5f; Rect val = default(Rect); ((Rect)(ref val))..ctor(num3 - num5, num4 - num2 * 0.5f, num, num2); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3 - num2 * 0.5f, num4 - num5, num2, num); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture); } private void Update() { //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; if (CfgEnabled != null && !CfgEnabled.Value) { if (_signals.Count > 0) { _signals.Clear(); } if (_callouts.Count > 0) { _callouts.Clear(); } _ringAutoAlpha = 0f; _suspended = true; _wasDead = false; return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { if (!_suspended) { _suspended = true; _wasDead = true; ClearTransientState(); } _ringAutoAlpha = 0f; return; } if (_suspended) { _suspended = false; if (_wasDead) { _wasDead = false; ClearTransientState(); } } for (int num = _callouts.Count - 1; num >= 0; num--) { if (_callouts[num].Until <= unscaledTime) { _callouts.RemoveAt(num); } } float num2 = Mathf.Clamp(CfgRingMaxSignalAge.Value, 0.15f, 10f); for (int num3 = _signals.Count - 1; num3 >= 0; num3--) { if (unscaledTime - _signals[num3].Born > num2) { _signals.RemoveAt(num3); } } if (CfgRingMode != null && string.Equals(CfgRingMode.Value, "Always", StringComparison.OrdinalIgnoreCase)) { _ringAutoAlpha = 1f; } else { float num4 = -999999f; for (int i = 0; i < _signals.Count; i++) { if (_signals[i].Born > num4) { num4 = _signals[i].Born; } } if (_signals.Count > 0) { float num5 = unscaledTime - num4; _ringAutoAlpha = Mathf.Clamp01(1f - num5 / Mathf.Max(0.0001f, num2)); } else { _ringAutoAlpha = 0f; } } int num6 = Mathf.Clamp(CfgRingSegments.Value, 8, 64); if (_segIntensity == null || _segIntensity.Length != num6) { _segIntensity = new float[num6]; _segColor = (Color[])(object)new Color[num6]; _segPriority = new int[num6]; } for (int j = 0; j < num6; j++) { _segIntensity[j] = 0f; _segColor[j] = Color.clear; _segPriority[j] = 0; } if (CfgSrcProximityRadar != null && CfgSrcProximityRadar.Value) { bool flag = true; if (CfgRadarMode != null && CfgRadarMode.Value != null) { string text = CfgRadarMode.Value.Trim(); if (text.Equals("Earshot", StringComparison.OrdinalIgnoreCase)) { flag = false; } } if (flag) { RadarTick(unscaledTime); } } RecomputeRingSegments(); } private void ClearTransientState() { try { _signals.Clear(); } catch { } try { _callouts.Clear(); } catch { } try { _radarLastPingById.Clear(); } catch { } try { _soundLastByPrefab.Clear(); } catch { } try { _loggedPortraitFailForPrefab.Clear(); } catch { } _nextRadarScan = 0f; _lastSignalTime = 0f; } private void RadarTick(float now) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) if (now < _nextRadarScan) { return; } float num = Mathf.Clamp(CfgRadarIntervalSeconds.Value, 0.15f, 5f); _nextRadarScan = now + num; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { return; } if (CfgRadarDisableWhileBuilding != null && CfgRadarDisableWhileBuilding.Value) { ItemData val = null; try { val = RightItemRef.Invoke((Humanoid)(object)localPlayer); } catch { } if (val != null && val.m_shared != null && val.m_shared.m_name != null && val.m_shared.m_name.IndexOf("Hammer", StringComparison.OrdinalIgnoreCase) >= 0) { return; } } float num2 = Mathf.Clamp(CfgRadarRadiusMeters.Value, 5f, 120f); float num3 = Mathf.Clamp(CfgRadarPerEnemyCooldownSeconds.Value, 0.15f, 30f); float num4 = Mathf.Clamp(CfgRadarDangerousExtraRadiusMult.Value, 1f, 4f); int mask = LayerMask.GetMask(new string[1] { "character" }); int num5 = Physics.OverlapSphereNonAlloc(((Component)localPlayer).transform.position, num2 * num4, _radarHitsBuffer, mask); for (int i = 0; i < num5; i++) { Collider val2 = _radarHitsBuffer[i]; if ((Object)(object)val2 == (Object)null) { continue; } Character componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.IsDead() || componentInParent == localPlayer || componentInParent is Player) { continue; } string text = SafePrefabName(((Component)componentInParent).gameObject); Vector3 val3 = ((Component)componentInParent).transform.position - ((Component)localPlayer).transform.position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; TryRegisterIconSource(componentInParent, text); bool flag = CfgRadarBoostDangerousMobs != null && CfgRadarBoostDangerousMobs.Value && IsDangerousPrefab(text); float num6 = (flag ? (num2 * num4) : num2); float num7 = num6 * num6; if (sqrMagnitude > num7) { continue; } float distance = Mathf.Sqrt(sqrMagnitude); int instanceID = ((Object)componentInParent).GetInstanceID(); if (_radarLastPingById.TryGetValue(instanceID, out var value) && now - value < num3) { continue; } _radarLastPingById[instanceID] = now; bool flag2 = false; if (CfgSrcAggroTargeting != null && CfgSrcAggroTargeting.Value && _aiGetTarget != null) { try { BaseAI component = ((Component)componentInParent).GetComponent(); if ((Object)(object)component != (Object)null) { Character val4 = _aiGetTarget(component); if ((Object)(object)val4 != (Object)null && val4 == localPlayer) { flag2 = true; } } } catch { } } int num8 = ((!flag) ? 1 : 3); if (!flag && IsMediumThreatPrefab(text)) { num8 = 2; } ThreatKind kind = (flag2 ? ThreatKind.Aggro : ThreatKind.Radar); if (flag2) { num8 = Mathf.Max(num8, 2); } PushThreat(((Component)componentInParent).transform.position, num8, kind, text, distance); } if (_radarLastPingById.Count > 1600) { _radarLastPingById.Clear(); } } private void RecomputeRingSegments() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(CfgRingSegments.Value, 8, 64); if (_segIntensity == null || _segIntensity.Length != num) { return; } Player localPlayer = Player.m_localPlayer; Camera main = Camera.main; if ((Object)(object)localPlayer == (Object)null || (Object)(object)main == (Object)null) { return; } Vector3 position = ((Component)localPlayer).transform.position; Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { return; } ((Vector3)(ref forward)).Normalize(); float unscaledTime = Time.unscaledTime; float num2 = Mathf.Clamp(CfgRingMaxSignalAge.Value, 0.15f, 10f); for (int i = 0; i < _signals.Count; i++) { ThreatSignal threatSignal = _signals[i]; float num3 = unscaledTime - threatSignal.Born; float num4 = Mathf.Clamp01(1f - num3 / num2); Vector3 val = threatSignal.WorldPos - position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val)).Normalize(); float num5 = Vector3.SignedAngle(forward, val, Vector3.up); if (num5 < 0f) { num5 += 360f; } int num6 = Mathf.FloorToInt(num5 / 360f * (float)num); if (num6 < 0) { num6 = 0; } if (num6 >= num) { num6 = num - 1; } float num7 = ((threatSignal.Severity == 3) ? 1f : ((threatSignal.Severity == 2) ? 0.72f : 0.5f)); float num8 = num7 * num4; Color c = KindColor(threatSignal.Kind); int num9 = KindPriority(threatSignal.Kind); ApplySegment(num6, num8, c, num9); float strength = num8 * 0.35f; int idx = (num6 - 1 + num) % num; int idx2 = (num6 + 1) % num; ApplySegment(idx, strength, c, num9 - 1); ApplySegment(idx2, strength, c, num9 - 1); } } } private void ApplySegment(int idx, float strength, Color c, int priority) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!(strength <= 0f) && (priority > _segPriority[idx] || (priority == _segPriority[idx] && strength > _segIntensity[idx]))) { _segPriority[idx] = priority; _segIntensity[idx] = strength; _segColor[idx] = c; } } private void OnGUI() { if (CfgEnabled == null || !CfgEnabled.Value) { return; } if (ShouldDrawRing()) { DrawThreatRing(); if (CfgIconsEnabled != null && CfgIconsEnabled.Value) { DrawThreatIcons(); } } if (CfgShowCallouts != null && CfgShowCallouts.Value && _callouts.Count > 0) { DrawCallouts(); } if (CfgCenterMarkerEnabled != null && CfgCenterMarkerEnabled.Value) { DrawCenterMarker(); } } private void DrawCallouts() { //IL_000d: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) EnsureCalloutStyle(); Vector2 value = CfgAnchor.Value; value.x = Mathf.Clamp01(value.x); value.y = Mathf.Clamp01(value.y); float num = (float)Screen.width * value.x; float num2 = (float)Screen.height * value.y; float num3 = Mathf.Min(520f, (float)Screen.width * 0.45f); float num4 = num2; int num5 = Mathf.Clamp(CfgMaxQueue.Value, 1, 20); int num6 = Mathf.Max(0, _callouts.Count - num5); Rect val = default(Rect); for (int i = num6; i < _callouts.Count; i++) { Callout callout = _callouts[i]; string text = ((callout.Severity >= 2) ? ("" + callout.Text + "") : callout.Text); float num7 = _calloutStyle.CalcHeight(new GUIContent(text), num3); ((Rect)(ref val))..ctor(num, num4, num3, num7); if (CfgHighContrast.Value) { GUI.DrawTexture(val, (Texture)(object)((callout.Severity >= 2) ? _bgTexStrong : _bgTex), (ScaleMode)0, false); } GUI.Label(val, text, _calloutStyle); num4 += num7 + 6f; } } private void DrawThreatRing() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0131: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) if (!CfgRingEnabled.Value || !ShouldDrawRing() || (Event.current != null && (int)Event.current.type != 7)) { return; } int num = Mathf.Clamp(CfgRingSegments.Value, 8, 64); float num2 = Mathf.Clamp(CfgRingRadiusPx.Value, 40f, 1000f); float num3 = Mathf.Clamp(CfgRingThicknessPx.Value, 2f, 128f); float num4 = Mathf.Clamp(CfgRingSegmentLengthPx.Value, 2f, 400f); float num5 = Mathf.Clamp01(CfgRingAlpha.Value) * _ringAutoAlpha; float num6 = Mathf.Clamp01(CfgRingBaseAlpha.Value) * num5; float num7 = Mathf.Clamp01(CfgRingActiveAlpha.Value) * num5; Vector2 pivot = default(Vector2); ((Vector2)(ref pivot))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); if (!EnsureGlMaterial()) { for (int i = 0; i < num; i++) { DrawSingleRingSegment(i, num, num2, num3, num4, pivot, new Color(1f, 1f, 1f, num6)); } for (int j = 0; j < num; j++) { float threatValueForSegment = GetThreatValueForSegment(_segIntensity, j, num); if (!(threatValueForSegment <= 0.001f)) { Color threatColor = GetThreatColor(threatValueForSegment); threatColor.a *= num7; DrawSingleRingSegment(j, num, num2, num3, num4, pivot, threatColor); } } return; } float num8 = ((num2 > 0.01f) ? (num4 / num2) : ((float)Math.PI * 2f / (float)num)); num8 = Mathf.Clamp(num8, 0.03f, (float)Math.PI * 2f / (float)num * 0.98f); GL.PushMatrix(); _glMat.SetPass(0); GL.LoadPixelMatrix(0f, (float)Screen.width, (float)Screen.height, 0f); GL.Begin(4); if (num6 > 0.001f) { Color col = default(Color); ((Color)(ref col))..ctor(1f, 1f, 1f, num6); AddRingWedges(num, pivot, num2, num3, num8, col, Mathf.Min(8f, num3 * 0.35f)); } for (int k = 0; k < num; k++) { float threatValueForSegment2 = GetThreatValueForSegment(_segIntensity, k, num); if (!(threatValueForSegment2 <= 0.001f)) { Color threatColor2 = GetThreatColor(threatValueForSegment2); threatColor2.a *= num7; Color col2 = threatColor2; col2.a *= 0.35f; AddSingleWedge(k, num, pivot, num2 + 3f, num3 + 6f, num8 * 1.1f, col2); AddSingleWedge(k, num, pivot, num2, num3, num8, threatColor2); } } GL.End(); GL.PopMatrix(); } private void AddRingWedges(int segs, Vector2 pivot, float radius, float thickness, float angleSpan, Color col, float featherPx) { //IL_0003: 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_0023: 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_0038: 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_0057: 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_006c: 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) AddAllWedges(segs, pivot, radius, thickness, angleSpan, col); if (!(featherPx <= 0.5f)) { Color col2 = col; col2.a *= 0.35f; AddAllWedges(segs, pivot, radius + featherPx, thickness + featherPx * 2f, angleSpan * 1.02f, col2); Color col3 = col; col3.a *= 0.2f; AddAllWedges(segs, pivot, radius, Mathf.Max(1f, thickness - featherPx * 0.9f), angleSpan * 1.02f, col3); } } private void AddAllWedges(int segs, Vector2 pivot, float radius, float thickness, float angleSpan, Color col) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < segs; i++) { AddSingleWedge(i, segs, pivot, radius, thickness, angleSpan, col); } } private void AddSingleWedge(int segIndex, int segs, Vector2 pivot, float radius, float thickness, float angleSpan, Color col) { //IL_004a: 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) float num = Mathf.Max(0f, radius - thickness); float outerR = Mathf.Max(num + 0.5f, radius); float num2 = (float)segIndex * ((float)Math.PI * 2f / (float)segs) - (float)Math.PI / 2f; float a = num2 - angleSpan * 0.5f; float a2 = num2 + angleSpan * 0.5f; AddWedgeTriangles(pivot, num, outerR, a, a2, col); } private void AddWedgeTriangles(Vector2 pivot, float innerR, float outerR, float a0, float a1, Color col) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00b1: 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_00c1: 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_00d1: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Cos(a0); float num2 = Mathf.Sin(a0); float num3 = Mathf.Cos(a1); float num4 = Mathf.Sin(a1); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(pivot.x + num * outerR, pivot.y + num2 * outerR, 0f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(pivot.x + num3 * outerR, pivot.y + num4 * outerR, 0f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(pivot.x + num * innerR, pivot.y + num2 * innerR, 0f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(pivot.x + num3 * innerR, pivot.y + num4 * innerR, 0f); GL.Color(col); GL.Vertex(val); GL.Vertex(val2); GL.Vertex(val4); GL.Vertex(val); GL.Vertex(val4); GL.Vertex(val3); } private bool EnsureGlMaterial() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown try { if ((Object)(object)_glMat != (Object)null) { return true; } Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val == (Object)null) { return false; } _glMat = new Material(val); ((Object)_glMat).hideFlags = (HideFlags)61; _glMat.SetInt("_SrcBlend", 5); _glMat.SetInt("_DstBlend", 10); _glMat.SetInt("_Cull", 0); _glMat.SetInt("_ZWrite", 0); return true; } catch { _glMat = null; return false; } } private void DrawSingleRingSegment(int segIndex, int segCount, float radiusPx, float thicknessPx, float segLengthPx, Vector2 pivot, Color c) { //IL_0039: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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)_whiteTex == (Object)null) { _whiteTex = MakeTex(2, 2, Color.white); } float num = (float)segIndex * 360f / (float)segCount - 90f; Rect val = default(Rect); ((Rect)(ref val))..ctor(pivot.x - segLengthPx * 0.5f, pivot.y - radiusPx - thicknessPx, segLengthPx, thicknessPx); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = c; GUIUtility.RotateAroundPivot(num, pivot); GUI.DrawTexture(val, (Texture)(object)_whiteTex, (ScaleMode)0, true); GUI.matrix = matrix; GUI.color = color; } private void DrawThreatIcons() { //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; Camera main = Camera.main; if ((Object)(object)localPlayer == (Object)null || (Object)(object)main == (Object)null) { return; } float unscaledTime = Time.unscaledTime; float num = Mathf.Clamp(CfgRingMaxSignalAge.Value, 0.15f, 10f); Dictionary dictionary = new Dictionary(16); for (int i = 0; i < _signals.Count; i++) { ThreatSignal value = _signals[i]; if (string.IsNullOrEmpty(value.Prefab)) { continue; } float num2 = unscaledTime - value.Born; if (num2 > num) { continue; } if (!dictionary.TryGetValue(value.Prefab, out var value2)) { dictionary[value.Prefab] = value; continue; } int num3 = KindPriority(value.Kind); int num4 = KindPriority(value2.Kind); if (num3 > num4) { dictionary[value.Prefab] = value; } else if (num3 == num4) { if (value.Distance < value2.Distance - 0.01f) { dictionary[value.Prefab] = value; } else if (Mathf.Abs(value.Distance - value2.Distance) < 0.01f && value.Born > value2.Born) { dictionary[value.Prefab] = value; } } } List list = new List(dictionary.Values); list.Sort(delegate(ThreatSignal a, ThreatSignal b) { int value4 = KindPriority(a.Kind); int num23 = KindPriority(b.Kind).CompareTo(value4); return (num23 != 0) ? num23 : a.Distance.CompareTo(b.Distance); }); int num5 = Mathf.Clamp(CfgIconMaxVisible.Value, 1, 16); if (list.Count > num5) { list.RemoveRange(num5, list.Count - num5); } Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { return; } ((Vector3)(ref forward)).Normalize(); float num6 = Mathf.Clamp(CfgRingRadius.Value, 60f, 520f); float num7 = Mathf.Clamp(CfgIconRingOffsetPx.Value, 0f, 120f); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); float num8 = Mathf.Clamp(CfgIconBasePx.Value, 12f, 140f); float num9 = Mathf.Clamp(CfgIconNearScale.Value, 0.5f, 3f); float num10 = Mathf.Clamp(CfgIconFarScale.Value, 0.25f, 2f); float num11 = Mathf.Max(5f, CfgRadarRadiusMeters.Value); float num12 = Mathf.Clamp(CfgRadarDangerousExtraRadiusMult.Value, 1f, 4f); bool value3 = CfgIconOutline.Value; Rect val3 = default(Rect); Rect val4 = default(Rect); for (int j = 0; j < list.Count; j++) { ThreatSignal threatSignal = list[j]; if (!TryGetIconForPrefab(threatSignal.Prefab, out var spriteIcon, out var portraitRt)) { continue; } Vector3 val2 = threatSignal.WorldPos - ((Component)localPlayer).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { continue; } ((Vector3)(ref val2)).Normalize(); float num13 = Vector3.SignedAngle(forward, val2, Vector3.up); float num14 = num13 * ((float)Math.PI / 180f); float num15 = (IsDangerousPrefab(threatSignal.Prefab) ? (num11 * num12) : num11); float num16 = Mathf.Clamp01(threatSignal.Distance / Mathf.Max(0.01f, num15)); float num17 = Mathf.Lerp(num9, num10, num16); float num18 = num8 * num17; float num19 = num6 + num7; float num20 = val.x + Mathf.Sin(num14) * num19; float num21 = val.y - Mathf.Cos(num14) * num19; Color c = KindColor(threatSignal.Kind); float num22 = 0.92f; if (threatSignal.Kind == ThreatKind.Radar) { num22 = 0.78f; } ((Rect)(ref val3))..ctor(num20 - num18 * 0.5f, num21 - num18 * 0.5f, num18, num18); if (value3) { Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.55f); ((Rect)(ref val4))..ctor(((Rect)(ref val3)).x - 2f, ((Rect)(ref val3)).y - 2f, ((Rect)(ref val3)).width + 4f, ((Rect)(ref val3)).height + 4f); GUI.DrawTexture(val4, (Texture)(object)_blackTex, (ScaleMode)0, false); GUI.color = color; } Color color2 = GUI.color; GUI.color = new Color(1f, 1f, 1f, num22); bool flag = CfgIconCutoutEnabled != null && CfgIconCutoutEnabled.Value; Texture2D val5 = EnsureIconTexture(threatSignal.Prefab, spriteIcon, portraitRt); if ((Object)(object)val5 != (Object)null) { GUI.DrawTexture(val3, (Texture)(object)val5, (ScaleMode)2, true); } else if (!flag) { if (spriteIcon.IsValid && (Object)(object)spriteIcon.Texture != (Object)null) { GUI.DrawTextureWithTexCoords(val3, (Texture)(object)spriteIcon.Texture, spriteIcon.UV, true); } else if ((Object)(object)portraitRt != (Object)null) { GUI.DrawTexture(val3, (Texture)(object)portraitRt, (ScaleMode)2, true); } } DrawThreatShapeBadge(val3, threatSignal.Kind); bool flag2 = false; try { flag2 = CfgIconLabelsEnabled != null && CfgIconLabelsEnabled.Value; } catch { flag2 = false; } if (flag2) { string displayNameForPrefab = GetDisplayNameForPrefab(threatSignal.Prefab); DrawIconLabel(val3, displayNameForPrefab); } if (CfgIconBorder != null && CfgIconBorder.Value) { DrawBorderRect(val3, c, Mathf.Lerp(3f, 2f, num16), num22); } GUI.color = color2; } } private void DrawBorderRect(Rect r, Color c, float thickness, float alpha) { //IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_whiteTex == (Object)null)) { float num = Mathf.Clamp(thickness, 1f, 6f); Color color = GUI.color; GUI.color = new Color(c.r, c.g, c.b, Mathf.Clamp01(alpha)); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, num), (Texture)(object)_whiteTex, (ScaleMode)0, false); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - num, ((Rect)(ref r)).width, num), (Texture)(object)_whiteTex, (ScaleMode)0, false); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, num, ((Rect)(ref r)).height), (Texture)(object)_whiteTex, (ScaleMode)0, false); GUI.DrawTexture(new Rect(((Rect)(ref r)).xMax - num, ((Rect)(ref r)).y, num, ((Rect)(ref r)).height), (Texture)(object)_whiteTex, (ScaleMode)0, false); GUI.color = color; } } private void LoadFileIconDictionary() { _fileIconsLoaded = true; _fileIconsLoading = false; } private void LoadEmbeddedIconDictionary() { //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_01e8: Expected O, but got Unknown if (_fileIconsLoaded || _fileIconsLoading) { return; } _fileIconsLoading = true; _fileSpriteIconsByPrefab.Clear(); _fileIconTexByPrefab.Clear(); try { Assembly assembly = typeof(AccessibilityPlugin).Assembly; string[] manifestResourceNames = assembly.GetManifestResourceNames(); int num = 0; foreach (string text in manifestResourceNames) { if (string.IsNullOrEmpty(text) || !text.EndsWith(".png", StringComparison.OrdinalIgnoreCase)) { continue; } int num2 = text.LastIndexOf('.'); if (num2 <= 0) { continue; } int num3 = text.LastIndexOf('.', num2 - 1); if (num3 < 0 || num3 >= num2) { continue; } string text2 = text.Substring(num3 + 1, num2 - num3 - 1); if (string.IsNullOrEmpty(text2) || _fileIconTexByPrefab.ContainsKey(text2)) { continue; } Stream stream = null; try { stream = assembly.GetManifestResourceStream(text); } catch { stream = null; } if (stream == null) { continue; } try { byte[] array; using (stream) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } if (array == null || array.Length < 8) { continue; } Texture2D val = null; try { int width; int height; byte[] array2 = PxDecodePngToRgba32(array, out width, out height); PxFlipRgbaVertically(array2, width, height); if (array2 == null || array2.Length == 0 || width <= 0 || height <= 0) { continue; } val = new Texture2D(width, height, (TextureFormat)4, false, false); ((Texture)val).filterMode = (FilterMode)0; ((Texture)val).wrapMode = (TextureWrapMode)1; val.LoadRawTextureData(array2); val.Apply(false, false); goto IL_022f; } catch { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } val = null; goto IL_022f; } IL_022f: if (!((Object)(object)val == (Object)null)) { try { ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; } catch { } _fileIconTexByPrefab[text2] = val; SpriteIcon value = default(SpriteIcon); value.Texture = val; value.UV = new Rect(0f, 0f, 1f, 1f); value.IsValid = true; _fileSpriteIconsByPrefab[text2] = value; num++; } } catch { } } } finally { _fileIconsLoaded = true; _fileIconsLoading = false; } } private static byte[] PxDecodePngToRgba32(byte[] png, out int width, out int height) { width = 0; height = 0; if (png == null || png.Length < 8) { return null; } if (png[0] != 137 || png[1] != 80 || png[2] != 78 || png[3] != 71 || png[4] != 13 || png[5] != 10 || png[6] != 26 || png[7] != 10) { return null; } int num = 8; int num2 = 0; int num3 = 0; byte[] array = null; uint num4; for (; num + 8 <= png.Length; num += (int)num4, num += 4) { num4 = PxReadU32BE(png, num); num += 4; if (num + 4 > png.Length) { break; } uint num5 = PxReadU32BE(png, num); num += 4; if (num + (int)num4 + 4 > png.Length) { break; } switch (num5) { case 1229472850u: width = (int)PxReadU32BE(png, num); height = (int)PxReadU32BE(png, num + 4); num2 = png[num + 8]; num3 = png[num + 9]; if (num2 != 8 || (num3 != 2 && num3 != 6)) { return null; } continue; case 1229209940u: if (num4 != 0) { if (array == null) { array = new byte[num4]; Buffer.BlockCopy(png, num, array, 0, (int)num4); } else { int num6 = array.Length; Array.Resize(ref array, num6 + (int)num4); Buffer.BlockCopy(png, num, array, num6, (int)num4); } } continue; default: continue; case 1229278788u: break; } break; } if (width <= 0 || height <= 0 || array == null || array.Length == 0) { return null; } byte[] array2 = PxInflateZlib(array); if (array2 == null || array2.Length == 0) { return null; } int num7 = ((num3 == 6) ? 4 : 3); int num8 = width * num7; int num9 = (num8 + 1) * height; if (array2.Length < num9) { return null; } byte[] array3 = new byte[num8 * height]; int num10 = 0; int num11 = 0; byte[] array4 = null; byte[] array5 = new byte[num8]; for (int i = 0; i < height; i++) { int filter = array2[num10++] & 0xFF; Buffer.BlockCopy(array2, num10, array5, 0, num8); num10 += num8; PxUnfilterRow(filter, array5, array4, num7); Buffer.BlockCopy(array5, 0, array3, num11, num8); num11 += num8; if (array4 == null) { array4 = new byte[num8]; } Buffer.BlockCopy(array5, 0, array4, 0, num8); } if (num3 == 2) { byte[] array6 = new byte[width * height * 4]; int num12 = 0; int num13 = 0; int num14 = width * height; for (int j = 0; j < num14; j++) { array6[num13++] = array3[num12++]; array6[num13++] = array3[num12++]; array6[num13++] = array3[num12++]; array6[num13++] = byte.MaxValue; } return array6; } return array3; } private static void PxUnfilterRow(int filter, byte[] row, byte[] prevRow, int bpp) { switch (filter) { case 0: break; case 1: { for (int l = bpp; l < row.Length; l++) { row[l] += row[l - bpp]; } break; } case 2: if (prevRow != null) { for (int k = 0; k < row.Length; k++) { row[k] += prevRow[k]; } } break; case 3: { if (prevRow == null) { for (int m = bpp; m < row.Length; m++) { row[m] = (byte)(row[m] + (row[m - bpp] >> 1)); } break; } for (int n = 0; n < row.Length; n++) { int num = ((n >= bpp) ? row[n - bpp] : 0); int num2 = prevRow[n]; row[n] = (byte)(row[n] + (num + num2 >> 1)); } break; } case 4: { if (prevRow == null) { for (int i = bpp; i < row.Length; i++) { row[i] += row[i - bpp]; } break; } for (int j = 0; j < row.Length; j++) { int a = ((j >= bpp) ? row[j - bpp] : 0); int b = prevRow[j]; int c = ((j >= bpp) ? prevRow[j - bpp] : 0); row[j] = (byte)(row[j] + PxPaeth(a, b, c)); } break; } } } private static int PxPaeth(int a, int b, int c) { int num = a + b - c; int num2 = Math.Abs(num - a); int num3 = Math.Abs(num - b); int num4 = Math.Abs(num - c); if (num2 <= num3 && num2 <= num4) { return a; } if (num3 <= num4) { return b; } return c; } private static void PxFlipRgbaVertically(byte[] rgba, int width, int height) { if (rgba != null && width > 0 && height > 0) { int num = width * 4; byte[] array = new byte[num]; int num2 = 0; int num3 = (height - 1) * num; for (int i = 0; i < height / 2; i++) { Buffer.BlockCopy(rgba, num2, array, 0, num); Buffer.BlockCopy(rgba, num3, rgba, num2, num); Buffer.BlockCopy(array, 0, rgba, num3, num); num2 += num; num3 -= num; } } } private static uint PxReadU32BE(byte[] buf, int offset) { return (uint)((buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]); } private static byte[] PxInflateZlib(byte[] zlibData) { if (zlibData == null || zlibData.Length < 6) { return null; } byte[] array = PxTryInflate(zlibData, 0, zlibData.Length); if (array != null && array.Length != 0) { return array; } if (zlibData.Length > 2) { return PxTryInflate(zlibData, 2, zlibData.Length - 2); } return null; } private static byte[] PxTryInflate(byte[] data, int offset, int count) { try { using MemoryStream stream = new MemoryStream(data, offset, count); using DeflateStream deflateStream = new DeflateStream(stream, CompressionMode.Decompress); using MemoryStream memoryStream = new MemoryStream(); deflateStream.CopyTo(memoryStream); return memoryStream.ToArray(); } catch { return null; } } [IteratorStateMachine(typeof(d__92))] private IEnumerator CoLoadFileIconDictionary(string dictPath) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__92(0) { <>4__this = this, dictPath = dictPath }; } private Texture2D EnsureIconTexture(string prefab, SpriteIcon spriteIcon, RenderTexture portraitRt) { if (string.IsNullOrEmpty(prefab)) { return null; } if (_fileIconTexByPrefab.TryGetValue(prefab, out var value) && (Object)(object)value != (Object)null) { return value; } if (_iconTexByPrefab.TryGetValue(prefab, out value) && (Object)(object)value != (Object)null) { return value; } bool flag = CfgIconCutoutEnabled != null && CfgIconCutoutEnabled.Value; if (spriteIcon.IsValid && (Object)(object)spriteIcon.Texture != (Object)null) { if (flag) { try { value = BuildCutoutFromSpriteIcon(spriteIcon); if ((Object)(object)value != (Object)null) { _iconTexByPrefab[prefab] = value; return value; } } catch { } return null; } return null; } if ((Object)(object)portraitRt != (Object)null) { if (flag) { try { value = BuildCutoutFromRenderTexture(portraitRt); if ((Object)(object)value != (Object)null) { _iconTexByPrefab[prefab] = value; return value; } } catch { } return null; } return null; } return null; } private bool TryGetIconForPrefab(string prefab, out SpriteIcon spriteIcon, out RenderTexture portraitRt) { spriteIcon = default(SpriteIcon); portraitRt = null; if (string.IsNullOrEmpty(prefab)) { return false; } float unscaledTime = Time.unscaledTime; float num = ((CfgIconRefreshSeconds != null) ? Mathf.Max(0f, CfgIconRefreshSeconds.Value) : 0f); if (IsSafeMode()) { num = 0f; } if (_fileSpriteIconsByPrefab.TryGetValue(prefab, out spriteIcon) && spriteIcon.IsValid && (Object)(object)spriteIcon.Texture != (Object)null) { return true; } if (CfgIconUseSprite != null && CfgIconUseSprite.Value && _spriteIconsByPrefab.TryGetValue(prefab, out spriteIcon) && spriteIcon.IsValid && (Object)(object)spriteIcon.Texture != (Object)null) { return true; } bool flag = false; return false; } private void EnsurePortraitRig() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_017d: 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_0193: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_iconRigRoot != (Object)null)) { _iconRigRoot = new GameObject("PX_AccessibilityPortraitRig"); try { Object.DontDestroyOnLoad((Object)(object)_iconRigRoot); } catch { } GameObject val = new GameObject("PX_AccessibilityPortraitCam"); val.transform.SetParent(_iconRigRoot.transform, false); _iconCam = val.AddComponent(); ((Behaviour)_iconCam).enabled = false; _iconCam.cullingMask = int.MinValue; _iconCam.clearFlags = (CameraClearFlags)2; _iconCam.backgroundColor = new Color(0f, 0f, 0f, 0f); _iconCam.orthographic = false; _iconCam.fieldOfView = 28f; _iconCam.nearClipPlane = 0.02f; _iconCam.farClipPlane = 50f; _iconCam.allowHDR = false; _iconCam.allowMSAA = false; GameObject val2 = new GameObject("PX_AccessibilityPortraitLight"); val2.transform.SetParent(_iconRigRoot.transform, false); _iconLight = val2.AddComponent(); _iconLight.type = (LightType)1; _iconLight.intensity = 1.25f; _iconLight.color = new Color(1f, 1f, 1f, 1f); GameObject val3 = new GameObject("PX_AccessibilityPortraitLightFill"); val3.transform.SetParent(_iconRigRoot.transform, false); Light val4 = val3.AddComponent(); val4.type = (LightType)1; val4.intensity = 0.65f; val4.color = new Color(0.92f, 0.92f, 1f, 1f); _iconRigRoot.transform.position = new Vector3(0f, 10000f, 0f); } } private RenderTexture BuildPortraitFallback(string prefabName) { return null; } private static void SetLayerRecursive(GameObject root, int layer) { if ((Object)(object)root == (Object)null) { return; } try { root.layer = layer; } catch { } Transform val = null; try { val = root.transform; } catch { } if ((Object)(object)val == (Object)null) { return; } int num = 0; try { num = val.childCount; } catch { } for (int i = 0; i < num; i++) { Transform val2 = null; try { val2 = val.GetChild(i); } catch { } if (!((Object)(object)val2 == (Object)null)) { GameObject val3 = null; try { val3 = ((Component)val2).gameObject; } catch { } if (!((Object)(object)val3 == (Object)null)) { SetLayerRecursive(val3, layer); } } } } private bool IsRenderTextureBlank(RenderTexture rt) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rt == (Object)null) { return true; } Texture2D val = null; try { val = new Texture2D(8, 8, (TextureFormat)4, false); } catch { return false; } RenderTexture active = null; try { active = RenderTexture.active; } catch { } try { try { RenderTexture.active = rt; } catch { return false; } int num = 0; int num2 = 0; try { num = Mathf.Clamp(((Texture)rt).width / 2 - 4, 0, Mathf.Max(0, ((Texture)rt).width - 8)); num2 = Mathf.Clamp(((Texture)rt).height / 2 - 4, 0, Mathf.Max(0, ((Texture)rt).height - 8)); } catch { } try { val.ReadPixels(new Rect((float)num, (float)num2, 8f, 8f), 0, 0, false); } catch { return false; } try { val.Apply(false, false); } catch { } Color32[] array = null; try { array = val.GetPixels32(); } catch { return false; } if (array == null || array.Length == 0) { return false; } Color32 val2 = array[0]; int num3 = 0; for (int i = 1; i < array.Length; i++) { Color32 val3 = array[i]; int num4 = val3.r - val2.r; if (num4 < 0) { num4 = -num4; } int num5 = val3.g - val2.g; if (num5 < 0) { num5 = -num5; } int num6 = val3.b - val2.b; if (num6 < 0) { num6 = -num6; } int num7 = val3.a - val2.a; if (num7 < 0) { num7 = -num7; } if (num4 + num5 + num6 + num7 > 8) { num3++; if (num3 > 3) { return false; } } } bool flag = val2.a < 25; bool flag2 = val2.r < 10 && val2.g < 10 && val2.b < 10; return flag || flag2; } finally { try { RenderTexture.active = active; } catch { } try { Object.Destroy((Object)(object)val); } catch { } } } private void LogPortraitFailOnce(string prefabName, string reason) { if (!string.IsNullOrEmpty(prefabName) && !_loggedPortraitFailForPrefab.Contains(prefabName)) { _loggedPortraitFailForPrefab.Add(prefabName); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Accessibility] Portrait fallback failed for " + prefabName + " (" + reason + ")")); } } } private Texture2D BuildCutoutFromSpriteIcon(SpriteIcon si) { //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) if (!si.IsValid || (Object)(object)si.Texture == (Object)null) { return null; } int width = ((Texture)si.Texture).width; int height = ((Texture)si.Texture).height; float num = Mathf.Clamp01(((Rect)(ref si.UV)).x); float num2 = Mathf.Clamp01(((Rect)(ref si.UV)).y); float num3 = Mathf.Clamp01(((Rect)(ref si.UV)).x + ((Rect)(ref si.UV)).width); float num4 = Mathf.Clamp01(((Rect)(ref si.UV)).y + ((Rect)(ref si.UV)).height); int num5 = Mathf.Clamp((int)Mathf.Round(num * (float)width), 0, width - 1); int num6 = Mathf.Clamp((int)Mathf.Round(num2 * (float)height), 0, height - 1); int num7 = Mathf.Clamp((int)Mathf.Round(num3 * (float)width), 0, width); int num8 = Mathf.Clamp((int)Mathf.Round(num4 * (float)height), 0, height); int num9 = Mathf.Clamp(num7 - num5, 1, width - num5); int num10 = Mathf.Clamp(num8 - num6, 1, height - num6); Color[] pixels; try { pixels = si.Texture.GetPixels(num5, num6, num9, num10); } catch { return null; } if (pixels == null || pixels.Length != num9 * num10) { return null; } bool flag = false; for (int i = 0; i < pixels.Length; i++) { if (pixels[i].a < 0.98f) { flag = true; break; } } float num11 = 0.12f; if (CfgIconCutoutBgTolerance != null) { num11 = Mathf.Clamp01(CfgIconCutoutBgTolerance.Value); } float num12 = num11 * num11; if (!flag) { Color val = SampleEdgeModeColor(pixels, num9, num10); bool[] array = new bool[pixels.Length]; for (int j = 0; j < pixels.Length; j++) { Color val2 = pixels[j]; float num13 = val2.r - val.r; float num14 = val2.g - val.g; float num15 = val2.b - val.b; float num16 = num13 * num13 + num14 * num14 + num15 * num15; array[j] = num16 <= num12; } bool[] array2 = new bool[pixels.Length]; Queue queue = new Queue(num9 * 2 + num10 * 2); for (int k = 0; k < num9; k++) { int num17 = k; int num18 = (num10 - 1) * num9 + k; if (array[num17]) { array2[num17] = true; queue.Enqueue(num17); } if (array[num18]) { array2[num18] = true; queue.Enqueue(num18); } } for (int l = 0; l < num10; l++) { int num19 = l * num9; int num20 = l * num9 + (num9 - 1); if (array[num19] && !array2[num19]) { array2[num19] = true; queue.Enqueue(num19); } if (array[num20] && !array2[num20]) { array2[num20] = true; queue.Enqueue(num20); } } while (queue.Count > 0) { int num21 = queue.Dequeue(); int num22 = num21 % num9; int num23 = num21 / num9; if (num22 > 0) { int num24 = num21 - 1; if (!array2[num24] && array[num24]) { array2[num24] = true; queue.Enqueue(num24); } } if (num22 < num9 - 1) { int num24 = num21 + 1; if (!array2[num24] && array[num24]) { array2[num24] = true; queue.Enqueue(num24); } } if (num23 > 0) { int num24 = num21 - num9; if (!array2[num24] && array[num24]) { array2[num24] = true; queue.Enqueue(num24); } } if (num23 < num10 - 1) { int num24 = num21 + num9; if (!array2[num24] && array[num24]) { array2[num24] = true; queue.Enqueue(num24); } } } for (int m = 0; m < pixels.Length; m++) { if (array2[m]) { pixels[m].a = 0f; } else { pixels[m].a = 1f; } } } Texture2D val3 = new Texture2D(num9, num10, (TextureFormat)4, false); ((Texture)val3).wrapMode = (TextureWrapMode)1; ((Texture)val3).filterMode = (FilterMode)1; val3.SetPixels(pixels); val3.Apply(false, false); if (CfgIconCutoutFeatherEdges != null && CfgIconCutoutFeatherEdges.Value) { FeatherAlphaEdge(val3); } return val3; } private Texture2D BuildCutoutFromRenderTexture(RenderTexture rt) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rt == (Object)null) { return null; } try { int width = ((Texture)rt).width; int height = ((Texture)rt).height; RenderTexture active = RenderTexture.active; RenderTexture.active = rt; Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; val.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0, false); val.Apply(false, false); RenderTexture.active = active; Color[] pixels = val.GetPixels(); bool flag = false; for (int i = 0; i < pixels.Length; i++) { if (pixels[i].a < 0.98f) { flag = true; break; } } if (!flag) { Color val2 = SampleEdgeModeColor(pixels, width, height); float num = 0.12f; if (CfgIconCutoutBgTolerance != null) { num = Mathf.Clamp01(CfgIconCutoutBgTolerance.Value); } float num2 = num * num; bool[] array = new bool[pixels.Length]; for (int j = 0; j < pixels.Length; j++) { Color val3 = pixels[j]; float num3 = val3.r - val2.r; float num4 = val3.g - val2.g; float num5 = val3.b - val2.b; float num6 = num3 * num3 + num4 * num4 + num5 * num5; array[j] = num6 <= num2; } bool[] array2 = new bool[pixels.Length]; Queue queue = new Queue(width * 2 + height * 2); for (int k = 0; k < width; k++) { int num7 = k; int num8 = (height - 1) * width + k; if (array[num7]) { array2[num7] = true; queue.Enqueue(num7); } if (array[num8]) { array2[num8] = true; queue.Enqueue(num8); } } for (int l = 0; l < height; l++) { int num9 = l * width; int num10 = l * width + (width - 1); if (array[num9] && !array2[num9]) { array2[num9] = true; queue.Enqueue(num9); } if (array[num10] && !array2[num10]) { array2[num10] = true; queue.Enqueue(num10); } } while (queue.Count > 0) { int num11 = queue.Dequeue(); int num12 = num11 % width; int num13 = num11 / width; if (num12 > 0) { int num14 = num11 - 1; if (!array2[num14] && array[num14]) { array2[num14] = true; queue.Enqueue(num14); } } if (num12 < width - 1) { int num14 = num11 + 1; if (!array2[num14] && array[num14]) { array2[num14] = true; queue.Enqueue(num14); } } if (num13 > 0) { int num14 = num11 - width; if (!array2[num14] && array[num14]) { array2[num14] = true; queue.Enqueue(num14); } } if (num13 < height - 1) { int num14 = num11 + width; if (!array2[num14] && array[num14]) { array2[num14] = true; queue.Enqueue(num14); } } } for (int m = 0; m < pixels.Length; m++) { if (array2[m]) { pixels[m].a = 0f; } else { pixels[m].a = 1f; } } val.SetPixels(pixels); val.Apply(false, false); } if (CfgIconCutoutFeatherEdges != null && CfgIconCutoutFeatherEdges.Value) { FeatherAlphaEdge(val); } return val; } catch { return null; } } private static Color SampleEdgeModeColor(Color[] px, int w, int h) { //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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (px == null || px.Length == 0 || w <= 0 || h <= 0) { return Color.white; } Dictionary counts = new Dictionary(128); Dictionary sums = new Dictionary(128); Func keyOf = delegate(Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) int num3 = Mathf.Clamp((int)Mathf.Round(c.r * 15f), 0, 15); int num4 = Mathf.Clamp((int)Mathf.Round(c.g * 15f), 0, 15); int num5 = Mathf.Clamp((int)Mathf.Round(c.b * 15f), 0, 15); return (num3 << 8) | (num4 << 4) | num5; }; Action action = delegate(int idx) { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) if (idx >= 0 && idx < px.Length) { Color val = px[idx]; int key = keyOf(val); counts.TryGetValue(key, out var value2); counts[key] = value2 + 1; sums.TryGetValue(key, out var value3); sums[key] = value3 + val; } }; for (int i = 0; i < w; i++) { action(i); action((h - 1) * w + i); } for (int j = 0; j < h; j++) { action(j * w); action(j * w + (w - 1)); } int num = -1; int num2 = -1; foreach (KeyValuePair item in counts) { if (item.Value > num2) { num2 = item.Value; num = item.Key; } } if (num == -1 || num2 <= 0) { return Color.white; } if (!sums.TryGetValue(num, out var value)) { return Color.white; } return value / (float)num2; } private static void FeatherAlphaEdge(Texture2D tex) { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)tex == (Object)null) { return; } int width = ((Texture)tex).width; int height = ((Texture)tex).height; Color[] pixels = tex.GetPixels(); Color[] array = (Color[])(object)new Color[pixels.Length]; Array.Copy(pixels, array, pixels.Length); for (int i = 1; i < height - 1; i++) { for (int j = 1; j < width - 1; j++) { int num = i * width + j; float a = pixels[num].a; if (a <= 0.01f || a >= 0.99f) { } } } for (int k = 1; k < height - 1; k++) { for (int l = 1; l < width - 1; l++) { int num2 = k * width + l; float a2 = pixels[num2].a; if (!(a2 < 0.99f) && (pixels[num2 - 1].a < 0.01f || pixels[num2 + 1].a < 0.01f || pixels[num2 - width].a < 0.01f || pixels[num2 + width].a < 0.01f || pixels[num2 - width - 1].a < 0.01f || pixels[num2 - width + 1].a < 0.01f || pixels[num2 + width - 1].a < 0.01f || pixels[num2 + width + 1].a < 0.01f)) { Color val = array[num2]; val.a = 0.85f; array[num2] = val; } } } tex.SetPixels(array); tex.Apply(false, false); } catch { } } private static Texture2D MakeTex(int w, int h, Color col) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = col; } val.SetPixels(array); val.Apply(false, false); return val; } private void EnsureIconLabelStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (_iconLabelStyle == null) { _iconLabelStyle = new GUIStyle(GUI.skin.label); _iconLabelStyle.alignment = (TextAnchor)1; _iconLabelStyle.wordWrap = false; _iconLabelStyle.clipping = (TextClipping)1; _iconLabelStyle.normal.textColor = Color.white; } if (_iconLabelStyleHC == null) { _iconLabelStyleHC = new GUIStyle(_iconLabelStyle); _iconLabelStyleHC.normal.textColor = Color.white; } int fontSize = 14; try { if (CfgIconLabelFontSize != null) { fontSize = Mathf.Clamp(CfgIconLabelFontSize.Value, 10, 24); } } catch { fontSize = 14; } _iconLabelStyle.fontSize = fontSize; _iconLabelStyleHC.fontSize = fontSize; } private static string GetDisplayNameForPrefab(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return ""; } string input = prefabName.Replace('_', ' ').Replace('-', ' ').Trim(); input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); return Regex.Replace(input, "\\s+", " ").Trim(); } private void DrawIconLabel(Rect iconRect, string text) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(text)) { EnsureIconLabelStyles(); float num = 2f; float num2 = Mathf.Clamp((float)_iconLabelStyle.fontSize + 6f, 14f, 34f); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref iconRect)).x - 18f, ((Rect)(ref iconRect)).yMax + num, ((Rect)(ref iconRect)).width + 36f, num2); bool flag = false; try { flag = CfgIconLabelHighContrast != null && CfgIconLabelHighContrast.Value; } catch { flag = false; } if (flag && (Object)(object)_iconLabelBgTex != (Object)null) { Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.85f); GUI.DrawTexture(val, (Texture)(object)_iconLabelBgTex, (ScaleMode)0, false); GUI.color = color; } GUI.Label(val, text, flag ? _iconLabelStyleHC : _iconLabelStyle); } } private void DrawThreatShapeBadge(Rect iconRect, ThreatKind kind) { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_00f8: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) bool flag = false; try { flag = CfgThreatShapesEnabled != null && CfgThreatShapesEnabled.Value; } catch { flag = false; } if (!flag) { return; } float num = 12f; try { if (CfgThreatShapeSizePx != null) { num = Mathf.Clamp(CfgThreatShapeSizePx.Value, 6f, 26f); } } catch { num = 12f; } Texture2D val = null; val = (Texture2D)(kind switch { ThreatKind.Damage => _shapeX, ThreatKind.Attack => _shapeDiamond, ThreatKind.Aggro => _shapeTriangle, _ => _shapeCircle, }); if (!((Object)(object)val == (Object)null)) { Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref iconRect)).xMax - num, ((Rect)(ref iconRect)).y, num, num); if ((Object)(object)_blackTex != (Object)null) { Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.55f); GUI.DrawTexture(val2, (Texture)(object)_blackTex, (ScaleMode)0, false); GUI.color = color; } Color val3 = KindColor(kind); Color color2 = GUI.color; GUI.color = new Color(val3.r, val3.g, val3.b, 0.95f); GUI.DrawTexture(val2, (Texture)(object)val, (ScaleMode)2, true); GUI.color = color2; } } private Texture2D BuildShapeCircle(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; float num = (float)(w - 1) * 0.5f; float num2 = (float)(h - 1) * 0.5f; float num3 = (float)Mathf.Min(w, h) * 0.38f; float num4 = num3 * num3; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num5 = (float)j - num; float num6 = (float)i - num2; float num7 = num5 * num5 + num6 * num6; float num8 = ((num7 <= num4) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num8)); } } val.Apply(false, true); return val; } private Texture2D BuildShapeTriangle(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; for (int i = 0; i < h; i++) { float num = (float)i / (float)(h - 1); int num2 = (int)(num * ((float)w * 0.5f)); int num3 = w / 2; int num4 = num3 - num2; int num5 = num3 + num2; for (int j = 0; j < w; j++) { float num6 = ((j >= num4 && j <= num5) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num6)); } } val.Apply(false, true); return val; } private Texture2D BuildShapeDiamond(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; int num = w / 2; int num2 = h / 2; for (int i = 0; i < h; i++) { int num3 = Mathf.Abs(i - num2); int num4 = Mathf.Max(0, h / 2 - num3); for (int j = 0; j < w; j++) { int num5 = Mathf.Abs(j - num); float num6 = ((num5 <= num4) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num6)); } } val.Apply(false, true); return val; } private Texture2D BuildShapeX(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; int num = Mathf.Max(1, w / 10); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { bool flag = Mathf.Abs(j - i) <= num; bool flag2 = Mathf.Abs(w - 1 - j - i) <= num; float num2 = ((flag || flag2) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num2)); } } val.Apply(false, true); return val; } } [HarmonyPatch] private static class ZSFX_Play_Patch { [CompilerGenerated] private sealed class d__0 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; private Type 5__1; private MethodInfo[] 5__2; private int 5__3; private MethodInfo 5__4; private string 5__5; MethodBase IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_013f; } <>1__state = -1; 5__1 = typeof(ZSFX); 5__2 = null; try { 5__2 = 5__1.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } catch { } if (5__2 == null) { return false; } 5__3 = 0; goto IL_0160; IL_0160: if (5__3 < 5__2.Length) { 5__4 = 5__2[5__3]; if (5__4 == null || 5__4.ReturnType != typeof(void)) { goto IL_014e; } 5__5 = 5__4.Name; if (string.Equals(5__5, "Play", StringComparison.Ordinal) || string.Equals(5__5, "PlayOneShot", StringComparison.Ordinal) || string.Equals(5__5, "PlayLoop", StringComparison.Ordinal) || string.Equals(5__5, "PlayLooped", StringComparison.Ordinal)) { <>2__current = 5__4; <>1__state = 1; return true; } goto IL_013f; } return false; IL_013f: 5__4 = null; 5__5 = null; goto IL_014e; IL_014e: 5__3++; goto IL_0160; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [IteratorStateMachine(typeof(d__0))] private static IEnumerable TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(-2); } private static void Prefix(ZSFX __instance) { OnSfxPlayed(__instance); } } public const string PluginGuid = "Pix.Accessibility"; public const string PluginName = "Accessibility"; public const string PluginVersion = "0.6.0"; internal static ManualLogSource Log; internal static AccessibilityPlugin Instance; internal static string PluginFolder; private Harmony _harmony; internal static ConfigEntry CfgEnabled; internal static ConfigEntry CfgScreenShakeEnabled; internal static ConfigEntry CfgScreenShakeRadius; internal static ConfigEntry CfgScreenShakeIntensity; internal static ConfigEntry CfgRumbleEnabled; internal static ConfigEntry CfgRumbleStrength; internal static ConfigEntry CfgRumbleMinNormalized; internal static ConfigEntry CfgRumblePulseInterval; internal static ConfigEntry CfgScreenShakeEdgeEnabled; internal static ConfigEntry CfgScreenShakeEdgeProbeMeters; internal static ConfigEntry CfgScreenShakeEdgeDropMeters; internal static ConfigEntry CfgScreenShakeEdgeIntensity; internal static bool ForceSafeMode = true; internal static ConfigEntry CfgShowCallouts; internal static ConfigEntry CfgFontSize; internal static ConfigEntry CfgUiTextScale; internal static ConfigEntry CfgCenterMarkerEnabled; internal static ConfigEntry CfgCenterMarkerSizePx; internal static ConfigEntry CfgCenterMarkerThicknessPx; internal static ConfigEntry CfgCalloutSeconds; internal static ConfigEntry CfgMaxQueue; internal static ConfigEntry CfgHighContrast; internal static ConfigEntry CfgAnchor; internal static ConfigEntry CfgRingEnabled; internal static ConfigEntry CfgRingMode; internal static ConfigEntry CfgRingAutoHideSeconds; internal static ConfigEntry CfgRingBaselineOpacity; internal static ConfigEntry CfgRingSegments; internal static ConfigEntry CfgRingRadius; internal static ConfigEntry CfgRingThickness; internal static ConfigEntry CfgRingSegmentLength; internal static ConfigEntry CfgRingRadiusPx; internal static ConfigEntry CfgRingThicknessPx; internal static ConfigEntry CfgRingSegmentLengthPx; internal static ConfigEntry CfgRingBaseAlpha; internal static ConfigEntry CfgRingActiveAlpha; internal static ConfigEntry CfgRingMaxSignalAge; internal static ConfigEntry CfgRingGlow; internal static ConfigEntry CfgRingGlowOpacity; internal static ConfigEntry CfgRingCenterDot; internal static ConfigEntry CfgRingCenterDotSize; internal static ConfigEntry CfgRingCenterDotOpacity; internal static ConfigEntry CfgRingAlpha; internal static ConfigEntry CfgSrcDamageDirection; internal static ConfigEntry CfgSrcAggroTargeting; internal static ConfigEntry CfgSrcProximityRadar; internal static ConfigEntry CfgRadarMode; internal static ConfigEntry CfgSrcSoundRadar; internal static ConfigEntry CfgSoundPerPrefabCooldownSeconds; internal static ConfigEntry CfgSoundMaxDistanceMultiplier; internal static ConfigEntry CfgRadarIntervalSeconds; internal static ConfigEntry CfgRadarRadiusMeters; internal static ConfigEntry CfgRadarPerEnemyCooldownSeconds; internal static ConfigEntry CfgRadarDisableWhileBuilding; internal static ConfigEntry CfgRadarBoostDangerousMobs; internal static ConfigEntry CfgRadarDangerousExtraRadiusMult; internal static ConfigEntry CfgIconsEnabled; internal static ConfigEntry CfgIconMaxVisible; internal static ConfigEntry CfgIconBasePx; internal static ConfigEntry CfgIconNearScale; internal static ConfigEntry CfgIconFarScale; internal static ConfigEntry CfgIconRingOffsetPx; internal static ConfigEntry CfgIconOutline; internal static ConfigEntry CfgIconUseSprite; internal static ConfigEntry CfgIconCutoutEnabled; internal static ConfigEntry CfgIconCutoutBgTolerance; internal static ConfigEntry CfgSilEnabled; internal static ConfigEntry CfgSilRangeMeters; internal static ConfigEntry CfgSilRefreshSeconds; internal static ConfigEntry CfgSilShellScale; internal static ConfigEntry CfgSilDoorShellScale; internal static ConfigEntry CfgSilMaxTotalClones; internal static ConfigEntry CfgSilMaxNewClonesPerTick; internal static ConfigEntry CfgSilMaxInteractableBoundsExtent; internal static ConfigEntry CfgSilBumperEnabled; internal static ConfigEntry CfgSilBumperRange; internal static ConfigEntry CfgSilBumperRefresh; internal static ConfigEntry CfgSilBumperMaxExtent; internal static ConfigEntry CfgSilBumperAlpha; internal static ConfigEntry CfgLightAuraEnabled; internal static ConfigEntry CfgLightAuraIntensity; internal static ConfigEntry CfgLightAuraRange; internal static ConfigEntry CfgLightAuraColor; internal static ConfigEntry CfgSilIdleSleepEnabled; internal static ConfigEntry CfgSilIdleSleepSeconds; internal static ConfigEntry CfgSilIdleMoveThreshold; public static ConfigEntry CfgSilhouetteColorPreset; public static ConfigEntry CfgSilhouetteIntensity; public static ConfigEntry CfgBumperColorPreset; public static ConfigEntry CfgBumperIntensity; public static ConfigEntry CfgSilPickupsEnabled; public static ConfigEntry CfgSilPickupsColorPreset; public static ConfigEntry CfgSilPickupsIntensity; public static ConfigEntry CfgSilInteractablesEnabled; public static ConfigEntry CfgSilInteractablesColorPreset; public static ConfigEntry CfgSilInteractablesIntensity; public static ConfigEntry CfgSilCreaturesEnabled; public static ConfigEntry CfgSilCreaturesColorPreset; public static ConfigEntry CfgSilCreaturesIntensity; public static ConfigEntry CfgBumperPickupsEnabled; public static ConfigEntry CfgBumperPickupsColorPreset; public static ConfigEntry CfgBumperPickupsIntensity; public static ConfigEntry CfgBumperInteractablesEnabled; public static ConfigEntry CfgBumperInteractablesColorPreset; public static ConfigEntry CfgBumperInteractablesIntensity; public static ConfigEntry CfgBumperCreaturesEnabled; public static ConfigEntry CfgBumperCreaturesColorPreset; public static ConfigEntry CfgBumperCreaturesIntensity; public static ConfigEntry CfgHotkeyTogglePickups; public static ConfigEntry CfgHotkeyToggleInteractables; public static ConfigEntry CfgHotkeyToggleCreatures; public static ConfigEntry CfgHotkeyToggleLightAura; internal static bool RtPickupsEnabled = true; internal static bool RtInteractablesEnabled = true; internal static bool RtCreaturesEnabled = true; internal static ConfigEntry CfgSilOutlineColor; internal static ConfigEntry CfgSilBumperColor; internal static ConfigEntry CfgSilMineRockExtentCap; internal static ConfigEntry CfgSilMineRock5ExtentCap; internal static ConfigEntry CfgSilFracExtentCap; internal static ConfigEntry CfgSilStaticRockBoost; internal static ConfigEntry CfgSilStaticRockBoostIntensity; internal static ConfigEntry CfgSilBumperRockDebug; internal static ConfigEntry CfgBumperAlpha; internal static ConfigEntry CfgIconCutoutFeatherEdges; internal static ConfigEntry CfgIconBorder; internal static ConfigEntry CfgIconDebugLogs; internal static ConfigEntry CfgIconRefreshSeconds; internal static ConfigEntry CfgColorblindMode; internal static ConfigEntry CfgIconLabelsEnabled; internal static ConfigEntry CfgIconLabelHighContrast; internal static ConfigEntry CfgIconLabelFontSize; internal static ConfigEntry CfgThreatShapesEnabled; internal static ConfigEntry CfgThreatShapeSizePx; internal static AccessibilityHud _hud; internal static readonly FieldRef RightItemRef = AccessTools.FieldRefAccess("m_rightItem"); internal static Func _aiGetTarget; private static FieldInfo _zsfxMaxDistanceField; internal static bool IsSafeMode() { return true; } private void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; try { PluginFolder = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); } catch { PluginFolder = null; } BindConfig(); ResolveAiTargetGetter(); _harmony = new Harmony("Pix.Accessibility"); _harmony.PatchAll(typeof(AccessibilityPlugin).Assembly); CreateHud(); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } try { if ((Object)(object)_hud != (Object)null) { Object.Destroy((Object)(object)((Component)_hud).gameObject); } } catch { } try { LightAura.Cleanup(); } catch { } } private void BindConfig() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af8: Expected O, but got Unknown //IL_0b2b: Unknown result type (might be due to invalid IL or missing references) //IL_0b35: Expected O, but got Unknown //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b96: Expected O, but got Unknown //IL_0bc9: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Expected O, but got Unknown //IL_0c92: Unknown result type (might be due to invalid IL or missing references) //IL_0c9c: Expected O, but got Unknown //IL_0ccf: Unknown result type (might be due to invalid IL or missing references) //IL_0cd9: Expected O, but got Unknown //IL_0d38: Unknown result type (might be due to invalid IL or missing references) //IL_0d42: Expected O, but got Unknown //IL_0d75: Unknown result type (might be due to invalid IL or missing references) //IL_0d7f: Expected O, but got Unknown //IL_0dde: Unknown result type (might be due to invalid IL or missing references) //IL_0de8: Expected O, but got Unknown //IL_0e1b: Unknown result type (might be due to invalid IL or missing references) //IL_0e25: Expected O, but got Unknown //IL_0edc: Unknown result type (might be due to invalid IL or missing references) //IL_0ee6: Expected O, but got Unknown //IL_0f19: Unknown result type (might be due to invalid IL or missing references) //IL_0f23: Expected O, but got Unknown //IL_0f7a: Unknown result type (might be due to invalid IL or missing references) //IL_0f84: Expected O, but got Unknown //IL_0fb7: Unknown result type (might be due to invalid IL or missing references) //IL_0fc1: Expected O, but got Unknown //IL_1018: Unknown result type (might be due to invalid IL or missing references) //IL_1022: Expected O, but got Unknown //IL_1055: Unknown result type (might be due to invalid IL or missing references) //IL_105f: Expected O, but got Unknown //IL_107e: Unknown result type (might be due to invalid IL or missing references) //IL_10ac: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_1108: Unknown result type (might be due to invalid IL or missing references) //IL_116e: Unknown result type (might be due to invalid IL or missing references) //IL_1178: Expected O, but got Unknown //IL_11ab: Unknown result type (might be due to invalid IL or missing references) //IL_11b5: Expected O, but got Unknown //IL_12b8: Unknown result type (might be due to invalid IL or missing references) //IL_12c2: Expected O, but got Unknown //IL_12f5: Unknown result type (might be due to invalid IL or missing references) //IL_12ff: Expected O, but got Unknown //IL_1328: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) CfgEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Master enable for Accessibility."); CfgShowCallouts = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "ShowCallouts", true, "Show subtitle-style callouts."); CfgScreenShakeEnabled = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "Enabled", true, "Enable danger proximity screen shake"); CfgScreenShakeRadius = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "DangerRadius", 25f, new ConfigDescription("Radius to detect hostile mobs", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 60f), Array.Empty())); CfgScreenShakeIntensity = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "Intensity", 0.05f, new ConfigDescription("Maximum shake intensity", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.2f), Array.Empty())); CfgRumbleEnabled = ((BaseUnityPlugin)this).Config.Bind("Rumble", "Enabled", true, "Enable controller rumble paired with ScreenShake (Windows/XInput only)."); CfgRumbleStrength = ((BaseUnityPlugin)this).Config.Bind("Rumble", "Strength", 1f, new ConfigDescription("Overall strength multiplier for rumble (0.0–2.0).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); CfgRumbleMinNormalized = ((BaseUnityPlugin)this).Config.Bind("Rumble", "MinNormalized", 0.08f, new ConfigDescription("Minimum normalized shake intensity before rumble triggers (prevents constant micro-rumble).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); CfgRumblePulseInterval = ((BaseUnityPlugin)this).Config.Bind("Rumble", "PulseIntervalSeconds", 0.08f, new ConfigDescription("Minimum interval between rumble pulses (seconds).", (AcceptableValueBase)(object)new AcceptableValueRange(0.03f, 0.5f), Array.Empty())); CfgScreenShakeEdgeEnabled = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "EdgeEnabled", true, "Also shake slightly when you are near a ledge / fall risk."); CfgScreenShakeEdgeProbeMeters = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "EdgeProbeMeters", 1.15f, "How far ahead to probe for a drop when detecting ledge risk."); CfgScreenShakeEdgeDropMeters = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "EdgeDropMeters", 2.25f, "How much lower the ground ahead must be (meters) to count as a ledge risk."); CfgScreenShakeEdgeIntensity = ((BaseUnityPlugin)this).Config.Bind("ScreenShake", "EdgeIntensity", 0.02f, "Maximum shake intensity when near a ledge."); CfgFontSize = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "FontSize", 18, "Callout font size."); CfgUiTextScale = ((BaseUnityPlugin)this).Config.Bind("UI", "UiTextScale", 1f, "Global multiplier for text sizes drawn by this mod (callouts, labels)."); CfgCenterMarkerEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.CenterMarker", "Enabled", false, "Draw a simple center marker / crosshair."); CfgCenterMarkerSizePx = ((BaseUnityPlugin)this).Config.Bind("UI.CenterMarker", "SizePx", 14f, "Center marker size in pixels."); CfgCenterMarkerThicknessPx = ((BaseUnityPlugin)this).Config.Bind("UI.CenterMarker", "ThicknessPx", 2f, "Center marker line thickness in pixels."); CfgCalloutSeconds = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "CalloutSeconds", 2.5f, "How long each callout stays visible."); CfgMaxQueue = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "MaxQueue", 6, "Max callouts shown."); CfgHighContrast = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "HighContrast", true, "High-contrast callout boxes."); CfgAnchor = ((BaseUnityPlugin)this).Config.Bind("UI.Callouts", "Anchor", new Vector2(0.02f, 0.82f), "Normalized screen anchor (0..1)."); try { Vector2 value = CfgAnchor.Value; float num = Mathf.Clamp((float)Math.Round(value.x, 3, MidpointRounding.AwayFromZero), 0f, 1f); float num2 = Mathf.Clamp((float)Math.Round(value.y, 3, MidpointRounding.AwayFromZero), 0f, 1f); if (Mathf.Abs(num - value.x) > 0.0001f || Mathf.Abs(num2 - value.y) > 0.0001f) { CfgAnchor.Value = new Vector2(num, num2); ((BaseUnityPlugin)this).Config.Save(); } } catch { } CfgRingEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "Enabled", true, "Enable the threat awareness ring."); CfgRingMode = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "Mode", "Always", "Auto: only visible when threats exist. Always: baseline ring always visible."); CfgRingAutoHideSeconds = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "AutoHideSeconds", 1.75f, "In Auto mode, hide ring this long after last threat signal."); CfgRingSegments = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "Segments", 28, "Number of ring segments (higher = smoother)."); CfgRingRadius = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "RadiusPx", 165f, "Ring radius in pixels from screen center."); CfgRingThickness = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "ThicknessPx", 18f, "Ring thickness in pixels."); CfgRingSegmentLength = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "SegmentLengthPx", 42f, "How long each segment extends inward (visibility)."); CfgRingBaselineOpacity = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "BaselineOpacity", 0.12f, "In Always mode, baseline ring opacity."); CfgRingAlpha = ((BaseUnityPlugin)this).Config.Bind("ThreatRing", "RingAlpha", 0.18f, "Base opacity for the threat ring when idle (0..1)."); CfgRingRadiusPx = CfgRingRadius; CfgRingThicknessPx = CfgRingThickness; CfgRingSegmentLengthPx = CfgRingSegmentLength; CfgRingBaseAlpha = CfgRingBaselineOpacity; CfgRingActiveAlpha = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "ActiveAlpha", 0.85f, "Alpha used when threats are present (0..1). Higher = more visible when active."); CfgRingMaxSignalAge = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "MaxSignalAgeSeconds", 1.35f, "Threat signal TTL in seconds."); CfgRingGlow = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "Glow", true, "Draw a soft glow behind wedges."); CfgRingGlowOpacity = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "GlowOpacity", 0.45f, "Glow alpha multiplier (0..1)."); CfgRingCenterDot = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "CenterDot", true, "Show a center dot when ring is visible."); CfgRingCenterDotSize = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "CenterDotSizePx", 10f, "Center dot size in pixels."); CfgRingCenterDotOpacity = ((BaseUnityPlugin)this).Config.Bind("UI.Ring", "CenterDotOpacity", 0.35f, "Center dot base opacity."); CfgSrcDamageDirection = ((BaseUnityPlugin)this).Config.Bind("Signals.Damage", "Enabled", true, "Flash red wedge toward damage source when you are hit."); CfgSrcAggroTargeting = ((BaseUnityPlugin)this).Config.Bind("Signals.Aggro", "Enabled", true, "Show red warnings when enemies are targeting you (aggro)."); CfgSrcProximityRadar = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "Enabled", true, "Passive radar: pings nearby enemies periodically."); CfgRadarMode = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "Mode", "Mixed", "Earshot: only show creatures you could hear. Proximity: distance-based scans (legacy). Mixed: both earshot + proximity."); CfgSrcSoundRadar = ((BaseUnityPlugin)this).Config.Bind("Signals.Sound", "Enabled", true, "Earshot radar: show creatures when their sound plays within audible range."); CfgSoundPerPrefabCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("Signals.Sound", "PerPrefabCooldownSeconds", 0.35f, "Minimum time between sound pings for the same prefab."); CfgSoundMaxDistanceMultiplier = ((BaseUnityPlugin)this).Config.Bind("Signals.Sound", "MaxDistanceMultiplier", 1f, "Multiplier applied to ZSFX max distance to define earshot range."); CfgRadarIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "IntervalSeconds", 0.55f, "How often to scan for nearby enemies."); CfgRadarRadiusMeters = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "RadiusMeters", 55f, "Radar scan radius in meters."); CfgRadarPerEnemyCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "PerEnemyCooldownSeconds", 2.5f, "Minimum time between radar pings for the same enemy."); CfgRadarDisableWhileBuilding = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "DisableWhileBuilding", false, "Optional: disable radar while holding a hammer."); CfgRadarBoostDangerousMobs = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "BoostDangerousMobs", true, "Boost dangerous mobs (e.g., deathsquito) for stronger earlier warnings."); CfgRadarDangerousExtraRadiusMult = ((BaseUnityPlugin)this).Config.Bind("Signals.Radar", "DangerousExtraRadiusMult", 2f, "Dangerous mobs get this radius multiplier for earlier detection."); CfgIconsEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "Enabled", true, "Show creature icons on the ring."); CfgIconMaxVisible = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "MaxVisible", 6, "Max creature icons shown at once."); CfgIconBasePx = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "BaseSizePx", 38f, "Base icon size in pixels."); CfgIconNearScale = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "NearScale", 1.65f, "Icon scale when very close."); CfgIconFarScale = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "FarScale", 0.85f, "Icon scale when far."); CfgIconRingOffsetPx = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "RingOffsetPx", 24f, "How far outside the ring to place icons."); CfgIconOutline = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "Outline", false, "Draw a simple outline/backplate behind icons for contrast."); CfgIconUseSprite = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "UseSpriteIcons", true, "Preferred: use existing in-game Sprite icons (stable, fast)."); CfgIconCutoutEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "CutoutEnabled", true, "Build a true-transparent cutout Texture2D for icons (removes white/boxy backgrounds)."); CfgIconCutoutBgTolerance = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "CutoutBgTolerance", 0.12f, "Background keying tolerance (0..1) when source has no alpha."); CfgSilEnabled = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "Enabled", true, "Enable high-contrast silhouettes for creatures and interactables."); CfgSilRangeMeters = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "RangeMeters", 35f, "Silhouette scan radius (meters) for creatures and interactables."); CfgSilRefreshSeconds = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "RefreshSeconds", 0.2f, "How often silhouettes refresh (seconds). Lower = more responsive, higher = cheaper."); CfgSilShellScale = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "ShellScale", 1.035f, "Silhouette shell scale (slightly >1). Smaller = tighter outline."); CfgSilDoorShellScale = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "DoorShellScale", 1.06f, "Extra shell scale for doors/gates to reduce z-fighting during animation."); CfgSilMaxTotalClones = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "MaxTotalClones", 280, "Hard cap on total silhouette clones to keep performance stable in large bases."); CfgSilMaxNewClonesPerTick = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "MaxNewClonesPerTick", 16, "Creation budget per refresh tick for new silhouettes (prevents spikes)."); CfgSilMaxInteractableBoundsExtent = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "MaxInteractableBoundsExtent", 6f, "Skip interactables with extremely large renderer bounds (meters). Increase if big pieces like forges/large doors are not highlighted."); CfgSilIdleSleepEnabled = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Idle", "Enabled", true, "Auto-disable silhouettes/bumper after inactivity, then re-enable on movement."); CfgSilIdleSleepSeconds = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Idle", "SleepAfterSeconds", 60f, new ConfigDescription("Seconds of inactivity before highlights sleep (AFK).", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 600f), Array.Empty())); CfgSilIdleMoveThreshold = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Idle", "MoveThreshold", 0.12f, new ConfigDescription("Movement threshold to wake from AFK (helps ignore tiny physics drift or controller stick drift).", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 1f), Array.Empty())); CfgSilhouetteColorPreset = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "ColorPreset", "Custom", new ConfigDescription("Preset silhouette color", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgSilhouetteIntensity = ((BaseUnityPlugin)this).Config.Bind("Silhouettes", "ColorIntensity", 1f, new ConfigDescription("Silhouette RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgSilPickupsEnabled = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Filters", "PickupsEnabled", true, "Enable silhouettes for pickup items (ItemDrop, Pickable)."); CfgSilInteractablesEnabled = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Filters", "InteractablesEnabled", true, "Enable silhouettes for interactables (doors, stations, pieces)."); CfgSilCreaturesEnabled = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Filters", "CreaturesEnabled", true, "Enable silhouettes for creatures."); CfgSilPickupsColorPreset = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Pickups", "ColorPreset", "Inherit", new ConfigDescription("Preset color for pickup silhouettes (choose Inherit to use the main Silhouettes preset).", (AcceptableValueBase)(object)new AcceptableValueList(new string[6] { "Inherit", "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgSilPickupsIntensity = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Pickups", "ColorIntensity", 1f, new ConfigDescription("Pickup silhouette RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgSilInteractablesColorPreset = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Interactables", "ColorPreset", "Inherit", new ConfigDescription("Preset color for interactable silhouettes (choose Inherit to use the main Silhouettes preset).", (AcceptableValueBase)(object)new AcceptableValueList(new string[6] { "Inherit", "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgSilInteractablesIntensity = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Interactables", "ColorIntensity", 1f, new ConfigDescription("Interactable silhouette RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgSilCreaturesColorPreset = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Creatures", "ColorPreset", "Inherit", new ConfigDescription("Preset color for creature silhouettes (choose Inherit to use the main Silhouettes preset).", (AcceptableValueBase)(object)new AcceptableValueList(new string[6] { "Inherit", "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgSilCreaturesIntensity = ((BaseUnityPlugin)this).Config.Bind("Silhouettes.Creatures", "ColorIntensity", 1f, new ConfigDescription("Creature silhouette RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgBumperPickupsEnabled = ((BaseUnityPlugin)this).Config.Bind("Bumper.Filters", "PickupsEnabled", false, "Enable bumper for pickup items (ItemDrop, Pickable)."); CfgBumperInteractablesEnabled = ((BaseUnityPlugin)this).Config.Bind("Bumper.Filters", "InteractablesEnabled", false, "Enable bumper for interactables (doors, stations, pieces)."); CfgBumperCreaturesEnabled = ((BaseUnityPlugin)this).Config.Bind("Bumper.Filters", "CreaturesEnabled", true, "Enable bumper for creatures."); CfgBumperPickupsColorPreset = ((BaseUnityPlugin)this).Config.Bind("Bumper.Pickups", "ColorPreset", "Custom", new ConfigDescription("Preset bumper color for pickup items", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgBumperPickupsIntensity = ((BaseUnityPlugin)this).Config.Bind("Bumper.Pickups", "ColorIntensity", 1f, new ConfigDescription("Pickup bumper RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgBumperInteractablesColorPreset = ((BaseUnityPlugin)this).Config.Bind("Bumper.Interactables", "ColorPreset", "Custom", new ConfigDescription("Preset bumper color for interactables", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgBumperInteractablesIntensity = ((BaseUnityPlugin)this).Config.Bind("Bumper.Interactables", "ColorIntensity", 1f, new ConfigDescription("Interactable bumper RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgBumperCreaturesColorPreset = ((BaseUnityPlugin)this).Config.Bind("Bumper.Creatures", "ColorPreset", "Custom", new ConfigDescription("Preset bumper color for creatures", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgBumperCreaturesIntensity = ((BaseUnityPlugin)this).Config.Bind("Bumper.Creatures", "ColorIntensity", 1f, new ConfigDescription("Creature bumper RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgHotkeyTogglePickups = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "TogglePickups", new KeyboardShortcut((KeyCode)257, Array.Empty()), "Toggle pickup silhouettes/bumper."); CfgHotkeyToggleInteractables = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "ToggleInteractables", new KeyboardShortcut((KeyCode)258, Array.Empty()), "Toggle interactable silhouettes/bumper."); CfgHotkeyToggleCreatures = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "ToggleCreatures", new KeyboardShortcut((KeyCode)259, Array.Empty()), "Toggle creature silhouettes/bumper."); CfgHotkeyToggleLightAura = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "ToggleLightAura", new KeyboardShortcut((KeyCode)260, Array.Empty()), "Toggle the Light Aura accessibility light on/off."); CfgBumperColorPreset = ((BaseUnityPlugin)this).Config.Bind("Bumper", "ColorPreset", "Custom", new ConfigDescription("Preset bumper color", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Custom", "Magenta", "Cyan", "Yellow", "Red" }), Array.Empty())); CfgBumperIntensity = ((BaseUnityPlugin)this).Config.Bind("Bumper", "ColorIntensity", 1f, new ConfigDescription("Bumper RGB intensity multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 3f), Array.Empty())); CfgSilBumperEnabled = ((BaseUnityPlugin)this).Config.Bind("Bumper", "Enabled", true, "Enable close-range bumper highlight to reveal nearby obstacles and collisions."); CfgSilBumperRange = ((BaseUnityPlugin)this).Config.Bind("Bumper", "RangeMeters", 5f, "Bumper scan radius in meters."); CfgSilBumperRefresh = ((BaseUnityPlugin)this).Config.Bind("Bumper", "RefreshSeconds", 0.1f, "How often the bumper scan updates (seconds)."); CfgSilBumperMaxExtent = ((BaseUnityPlugin)this).Config.Bind("Bumper", "MaxBoundsExtent", 2.2f, "Reject very large hits to avoid overwhelming highlights (approx. half-size in meters)."); CfgSilBumperAlpha = ((BaseUnityPlugin)this).Config.Bind("Bumper", "Alpha", 0.28f, "Opacity for bumper highlight."); CfgLightAuraEnabled = ((BaseUnityPlugin)this).Config.Bind("LightAura", "Enabled", false, "Enable the Light Aura accessibility lamp (permanent 24/7 light around the player)."); CfgLightAuraIntensity = ((BaseUnityPlugin)this).Config.Bind("LightAura", "Intensity", 1.8f, new ConfigDescription("Light Aura intensity (brightness). Higher = brighter aura.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); CfgLightAuraRange = ((BaseUnityPlugin)this).Config.Bind("LightAura", "Range", 35f, new ConfigDescription("Light Aura range in meters. How far the light reaches.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 80f), Array.Empty())); CfgLightAuraColor = ((BaseUnityPlugin)this).Config.Bind("LightAura", "Color", new Color(1f, 0.95f, 0.85f, 1f), "Light Aura color (warm white by default for natural look)."); CfgBumperAlpha = CfgSilBumperAlpha; CfgIconCutoutFeatherEdges = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "CutoutFeatherEdges", true, "Soften hard alpha edges for a more polished look."); CfgIconBorder = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "Border", false, "Draw a colored border around icons (off by default for clean silhouettes)."); CfgIconDebugLogs = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "DebugLogs", false, "Extra debug logging for icon/portrait discovery."); CfgIconRefreshSeconds = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "IconRefreshSeconds", 30f, "How often (seconds) to rebuild cached creature icons/portraits to recover from wrong cached icons. 0 disables refresh."); CfgColorblindMode = ((BaseUnityPlugin)this).Config.Bind("UI.Accessibility", "ColorblindMode", "Off", "Colorblind-friendly palette for threat ring & indicators. Options: Off, Deuteranopia, Protanopia, Tritanopia."); CfgThreatShapesEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "ThreatShapes", true, "Overlay a small shape badge on each icon so threat tier is readable without color."); CfgThreatShapeSizePx = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "ThreatShapeSizePx", 12f, "Size (pixels) of the threat shape badge."); CfgIconLabelsEnabled = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "Labels", true, "Draw a short label under each icon (prefab name)."); CfgIconLabelFontSize = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "LabelFontSize", 14, "Font size for icon labels."); CfgIconLabelHighContrast = ((BaseUnityPlugin)this).Config.Bind("UI.Icons", "LabelHighContrast", true, "Draw a dark backing behind icon labels for readability."); } private static void CreateHud() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (!Application.isBatchMode) { GameObject val = new GameObject("PixAccessibility_Hud"); Object.DontDestroyOnLoad((Object)(object)val); _hud = val.AddComponent(); } } internal static void PushCallout(string text, int severity = 1) { if (CfgEnabled != null && CfgEnabled.Value && CfgShowCallouts != null && CfgShowCallouts.Value && !((Object)(object)_hud == (Object)null)) { _hud.PushCallout(text, severity); } } internal static void PushThreat(Vector3 worldPos, int severity, ThreatKind kind, string prefabName, float distance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (CfgEnabled != null && CfgEnabled.Value && CfgRingEnabled != null && CfgRingEnabled.Value && !((Object)(object)_hud == (Object)null)) { _hud.PushThreat(worldPos, severity, kind, prefabName, distance); } } internal static void OnSfxPlayed(ZSFX sfx) { //IL_02c2: 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_0173: Unknown result type (might be due to invalid IL or missing references) try { if (CfgEnabled == null || !CfgEnabled.Value || CfgRingEnabled == null || !CfgRingEnabled.Value || (Object)(object)_hud == (Object)null || CfgRadarMode == null || CfgRadarMode.Value == null) { return; } string text = CfgRadarMode.Value.Trim(); if (!text.Equals("Earshot", StringComparison.OrdinalIgnoreCase) && !text.Equals("Mixed", StringComparison.OrdinalIgnoreCase)) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || (Object)(object)sfx == (Object)null) { return; } Character componentInParent = ((Component)sfx).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.IsDead() || componentInParent == localPlayer || componentInParent is Player) { return; } string text2 = SafePrefabName(((Component)componentInParent).gameObject); if (string.IsNullOrEmpty(text2)) { return; } float num = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)sfx).transform.position); float num2 = 0f; if (_zsfxMaxDistanceField == null) { _zsfxMaxDistanceField = typeof(ZSFX).GetField("m_maxDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_zsfxMaxDistanceField != null) { try { num2 = (float)_zsfxMaxDistanceField.GetValue(sfx); } catch { num2 = 0f; } } if (num2 <= 0.01f) { num2 = 25f; } float num3 = 1f; if (CfgSoundMaxDistanceMultiplier != null) { num3 = Mathf.Clamp(CfgSoundMaxDistanceMultiplier.Value, 0.25f, 3f); } float num4 = num2 * num3; if (!(num > num4)) { int severity = (IsDangerousPrefab(text2) ? 3 : ((!IsMediumThreatPrefab(text2)) ? 1 : 2)); _hud.TryRegisterIconSource(componentInParent, text2); float cd = 0.35f; if (CfgSoundPerPrefabCooldownSeconds != null) { cd = Mathf.Clamp(CfgSoundPerPrefabCooldownSeconds.Value, 0.05f, 5f); } if (_hud.TrySoundCooldown(text2, cd)) { _hud.PushThreat(((Component)sfx).transform.position, severity, ThreatKind.Radar, text2, num); } } } catch { } } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) if (Application.isBatchMode || CfgEnabled == null || !CfgEnabled.Value) { return; } try { KeyboardShortcut value; if (CfgHotkeyTogglePickups != null) { value = CfgHotkeyTogglePickups.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { RtPickupsEnabled = !RtPickupsEnabled; try { PushCallout(RtPickupsEnabled ? "✅ Pickups highlights ON" : "⛔ Pickups highlights OFF"); } catch { } } } if (CfgHotkeyToggleInteractables != null) { value = CfgHotkeyToggleInteractables.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { RtInteractablesEnabled = !RtInteractablesEnabled; try { PushCallout(RtInteractablesEnabled ? "✅ Interactables highlights ON" : "⛔ Interactables highlights OFF"); } catch { } } } if (CfgHotkeyToggleCreatures != null) { value = CfgHotkeyToggleCreatures.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { RtCreaturesEnabled = !RtCreaturesEnabled; try { PushCallout(RtCreaturesEnabled ? "✅ Creatures highlights ON" : "⛔ Creatures highlights OFF"); } catch { } } } if (CfgHotkeyToggleLightAura != null) { value = CfgHotkeyToggleLightAura.Value; if (((KeyboardShortcut)(ref value)).IsDown() && CfgLightAuraEnabled != null) { bool flag = !CfgLightAuraEnabled.Value; CfgLightAuraEnabled.Value = flag; try { ((BaseUnityPlugin)this).Config.Save(); } catch { } try { PushCallout(flag ? "\ud83d\udca1 Light Aura ON" : "\ud83c\udf11 Light Aura OFF"); } catch { } } } } catch { } if (Input.GetKeyDown((KeyCode)290)) { PushCallout("\ud83d\udd14 Accessibility callouts working."); PushCallout("⚠\ufe0f Example: Enemy nearby", 2); PushCallout("\ud83d\udd25 Example: Burning!", 3); } if (Input.GetKeyDown((KeyCode)291)) { Player localPlayer = Player.m_localPlayer; Camera main = Camera.main; if ((Object)(object)localPlayer == (Object)null || (Object)(object)main == (Object)null) { PushCallout("⚠\ufe0f F10 test: missing Player or Camera.main", 2); return; } Vector3 position = ((Component)localPlayer).transform.position; Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { ((Vector3)(ref forward)).Normalize(); } Vector3 right = ((Component)main).transform.right; right.y = 0f; if (((Vector3)(ref right)).sqrMagnitude > 0.0001f) { ((Vector3)(ref right)).Normalize(); } float num = 14f; PushThreat(position + -right * num, 2, ThreatKind.Aggro, "TestAggro", num); PushThreat(position + right * num, 2, ThreatKind.Attack, "TestAttack", num); PushThreat(position + -forward * num, 3, ThreatKind.Damage, "TestDamage", num); PushCallout("\ud83e\udded Ring test: Left / Right / Behind"); } ScreenShake.Tick(); } private void LateUpdate() { if (!Application.isBatchMode && CfgEnabled != null && CfgEnabled.Value) { ScreenShake.Tick(); } } internal static int KindPriority(ThreatKind k) { return k switch { ThreatKind.Damage => 300, ThreatKind.Attack => 200, ThreatKind.Aggro => 150, _ => 100, }; } internal static Color KindColor(ThreatKind kind) { //IL_01c3: 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_01be: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(0.35f, 0.85f, 1f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.22f, 0.22f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.5f, 0.12f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.15f, 0.15f, 1f); ColorblindMode colorblindMode = ColorblindMode.Off; try { colorblindMode = ParseColorblindMode((CfgColorblindMode != null) ? CfgColorblindMode.Value : "Off"); } catch { } if (colorblindMode == ColorblindMode.Deuteranopia || colorblindMode == ColorblindMode.Protanopia) { ((Color)(ref val))..ctor(0.25f, 0.65f, 1f, 1f); ((Color)(ref val2))..ctor(1f, 0.85f, 0.2f, 1f); ((Color)(ref val3))..ctor(0.95f, 0.35f, 1f, 1f); ((Color)(ref val4))..ctor(1f, 1f, 1f, 1f); } else if (colorblindMode == ColorblindMode.Tritanopia) { ((Color)(ref val))..ctor(0.1f, 0.95f, 0.8f, 1f); ((Color)(ref val2))..ctor(1f, 0.45f, 0.1f, 1f); ((Color)(ref val3))..ctor(0.75f, 0.35f, 1f, 1f); ((Color)(ref val4))..ctor(1f, 1f, 1f, 1f); } return (Color)(kind switch { ThreatKind.Damage => val4, ThreatKind.Attack => val3, ThreatKind.Aggro => val2, _ => val, }); } private static ColorblindMode ParseColorblindMode(string s) { if (string.IsNullOrEmpty(s)) { return ColorblindMode.Off; } s = s.Trim(); if (string.Equals(s, "Deuteranopia", StringComparison.OrdinalIgnoreCase)) { return ColorblindMode.Deuteranopia; } if (string.Equals(s, "Protanopia", StringComparison.OrdinalIgnoreCase)) { return ColorblindMode.Protanopia; } if (string.Equals(s, "Tritanopia", StringComparison.OrdinalIgnoreCase)) { return ColorblindMode.Tritanopia; } return ColorblindMode.Off; } private static void ResolveAiTargetGetter() { try { MethodInfo i = AccessTools.Method(typeof(BaseAI), "GetTargetCreature", Type.EmptyTypes, (Type[])null); if (i != null && typeof(Character).IsAssignableFrom(i.ReturnType)) { _aiGetTarget = delegate(BaseAI ai) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown try { return (Character)i.Invoke(ai, null); } catch { return null; } }; return; } string[] array = new string[4] { "m_targetCreature", "m_target", "m_targetCharacter", "m_targetEnemy" }; for (int j = 0; j < array.Length; j++) { FieldInfo f = typeof(BaseAI).GetField(array[j], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (!(f != null) || !typeof(Character).IsAssignableFrom(f.FieldType)) { continue; } _aiGetTarget = delegate(BaseAI ai) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown try { return (Character)f.GetValue(ai); } catch { return null; } }; ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Accessibility] AI target field: BaseAI." + array[j])); } return; } _aiGetTarget = null; ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)"[Accessibility] No AI target getter found on BaseAI (aggro relies on MonsterAI.SetTarget fallback)."); } } catch (Exception ex) { _aiGetTarget = null; ManualLogSource log3 = Log; if (log3 != null) { log3.LogWarning((object)("[Accessibility] Failed resolving AI target getter: " + ex.Message)); } } } internal static string SafePrefabName(GameObject go) { try { return Utils.GetPrefabName(go); } catch { if ((Object)(object)go == (Object)null) { return ""; } string text = ((Object)go).name ?? ""; int num = text.IndexOf("(Clone)", StringComparison.OrdinalIgnoreCase); if (num >= 0) { text = text.Substring(0, num); } return text.Trim(); } } internal static bool IsDangerousPrefab(string prefab) { if (string.IsNullOrEmpty(prefab)) { return false; } string text = prefab.ToLowerInvariant(); if (text.Contains("deathsquito")) { return true; } if (text.Contains("gjall")) { return true; } if (text.Contains("seekerbrute")) { return true; } if (text.Contains("seeker")) { return true; } if (text.Contains("fulingberserker")) { return true; } if (text.Contains("troll")) { return true; } return false; } internal static bool IsMediumThreatPrefab(string prefab) { if (string.IsNullOrEmpty(prefab)) { return false; } string text = prefab.ToLowerInvariant(); if (text.Contains("greydwarfbrute")) { return true; } if (text.Contains("draugrelite")) { return true; } if (text.Contains("draugr")) { return true; } if (text.Contains("wolf")) { return true; } if (text.Contains("fuling")) { return true; } return false; } internal static float GetThreatValueForSegment(float[] segIntensity, int seg, int segs) { try { if (segIntensity == null || segIntensity.Length == 0) { return 0f; } if (segs <= 0) { segs = segIntensity.Length; } float num = ((float)seg + 0.5f) / Mathf.Max(1f, (float)segs); int num2 = Mathf.Clamp(Mathf.FloorToInt(num * (float)segIntensity.Length), 0, segIntensity.Length - 1); return Mathf.Clamp01(segIntensity[num2]); } catch { return 0f; } } internal static Color GetThreatColor(float v) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) v = Mathf.Clamp01(v); Color val = default(Color); ((Color)(ref val))..ctor(0.25f, 0.85f, 1f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.9f, 0.4f, 1f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.35f, 0.35f, 1f); if (v <= 0.5f) { return Color.Lerp(val, val2, v / 0.5f); } return Color.Lerp(val2, val3, (v - 0.5f) / 0.5f); } } internal static class LightAura { [HarmonyPatch(typeof(Player), "Update")] private static class Patch_Player_Update { private static void Postfix(Player __instance) { if (AccessibilityPlugin.CfgEnabled == null || !AccessibilityPlugin.CfgEnabled.Value) { return; } if (AccessibilityPlugin.CfgLightAuraEnabled == null || !AccessibilityPlugin.CfgLightAuraEnabled.Value) { DisableLight(); } else if (!((Object)(object)__instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { if ((Object)(object)_lightObj == (Object)null || !_lightObj.activeSelf) { EnableLight(__instance); } else if ((Object)(object)_light != (Object)null) { UpdateLightSettings(); } } } } private static GameObject _lightObj; private static Light _light; private static void EnableLight(Player player) { //IL_0079: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (!((Object)(object)player == (Object)null)) { if ((Object)(object)_lightObj == (Object)null) { _lightObj = new GameObject("PX_LightAura"); _light = _lightObj.AddComponent(); _light.type = (LightType)2; _light.shadows = (LightShadows)0; } _lightObj.transform.SetParent(((Component)player).transform, false); _lightObj.transform.localPosition = Vector3.up * 0.5f; UpdateLightSettings(); _lightObj.SetActive(true); } } private static void UpdateLightSettings() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_light == (Object)null) { return; } try { float intensity = 1.8f; if (AccessibilityPlugin.CfgLightAuraIntensity != null) { intensity = Mathf.Clamp(AccessibilityPlugin.CfgLightAuraIntensity.Value, 0.5f, 5f); } float range = 35f; if (AccessibilityPlugin.CfgLightAuraRange != null) { range = Mathf.Clamp(AccessibilityPlugin.CfgLightAuraRange.Value, 10f, 80f); } Color value = default(Color); ((Color)(ref value))..ctor(1f, 0.95f, 0.85f, 1f); if (AccessibilityPlugin.CfgLightAuraColor != null) { value = AccessibilityPlugin.CfgLightAuraColor.Value; } _light.intensity = intensity; _light.range = range; _light.color = value; } catch { } } private static void DisableLight() { if ((Object)(object)_lightObj != (Object)null) { _lightObj.SetActive(false); try { _lightObj.transform.SetParent((Transform)null, false); } catch { } } } internal static void Cleanup() { try { if ((Object)(object)_lightObj != (Object)null) { Object.Destroy((Object)(object)_lightObj); _lightObj = null; _light = null; } } catch { } } } internal static class ScreenShake { private static bool _hooked; private static bool _active; private static Vector3 _pendingOffset; private static Vector3 _appliedOffset; private static float _seed; private static Camera _targetCam; internal static void Tick() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_01e6: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) HookOnce(); if (AccessibilityPlugin.CfgScreenShakeEnabled == null || !AccessibilityPlugin.CfgScreenShakeEnabled.Value) { _active = false; _pendingOffset = Vector3.zero; ControllerRumble.StopIfActive(); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { _active = false; _pendingOffset = Vector3.zero; ControllerRumble.StopIfActive(); return; } float num = 25f; if (AccessibilityPlugin.CfgScreenShakeRadius != null) { num = Mathf.Clamp(AccessibilityPlugin.CfgScreenShakeRadius.Value, 5f, 60f); } float num2 = 0.05f; if (AccessibilityPlugin.CfgScreenShakeIntensity != null) { num2 = Mathf.Clamp(AccessibilityPlugin.CfgScreenShakeIntensity.Value, 0f, 0.2f); } float num3 = 0.02f; bool flag = false; float probeMeters = 1.15f; float dropMeters = 2.25f; try { if (AccessibilityPlugin.CfgScreenShakeEdgeEnabled != null) { flag = AccessibilityPlugin.CfgScreenShakeEdgeEnabled.Value; } } catch { flag = false; } try { if (AccessibilityPlugin.CfgScreenShakeEdgeIntensity != null) { num3 = Mathf.Clamp(AccessibilityPlugin.CfgScreenShakeEdgeIntensity.Value, 0f, 0.2f); } } catch { num3 = 0.02f; } try { if (AccessibilityPlugin.CfgScreenShakeEdgeProbeMeters != null) { probeMeters = Mathf.Clamp(AccessibilityPlugin.CfgScreenShakeEdgeProbeMeters.Value, 0.25f, 5f); } } catch { probeMeters = 1.15f; } try { if (AccessibilityPlugin.CfgScreenShakeEdgeDropMeters != null) { dropMeters = Mathf.Clamp(AccessibilityPlugin.CfgScreenShakeEdgeDropMeters.Value, 0.5f, 10f); } } catch { dropMeters = 2.25f; } if ((num <= 0.01f || num2 <= 1E-05f) && (!flag || num3 <= 1E-05f)) { _active = false; _pendingOffset = Vector3.zero; return; } if (_seed <= 1E-05f) { _seed = Random.value * 1000f + 1f; } float num4 = 0f; List allCharacters = Character.GetAllCharacters(); Vector3 position = ((Component)localPlayer).transform.position; for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val == (Object)null || val.IsDead() || (Object)(object)val == (Object)(object)localPlayer || val is Player || val.IsTamed() || (Object)(object)((Component)val).GetComponent() == (Object)null) { continue; } float num5 = Vector3.Distance(position, ((Component)val).transform.position); if (!(num5 > num)) { float num6 = 1f - num5 / num; if (num6 > num4) { num4 = num6; } } } float num7 = 0f; if (flag && num3 > 1E-05f) { try { num7 = ComputeEdgeFactor(localPlayer, probeMeters, dropMeters); } catch { num7 = 0f; } } float num8 = ((num4 > 0f && num2 > 1E-05f) ? (num4 * num2) : 0f); float num9 = ((num7 > 0f) ? (num7 * num3) : 0f); float num10 = num8 + num9; if (num10 <= 1E-05f) { _active = false; _pendingOffset = Vector3.zero; ControllerRumble.StopIfActive(); return; } float num11 = num2 + (flag ? num3 : 0f); float normalized = ((num11 > 1E-05f) ? Mathf.Clamp01(num10 / num11) : 0f); ControllerRumble.Tick(normalized); float num12 = Time.time * 10f; float num13 = (Mathf.PerlinNoise(_seed, num12) - 0.5f) * 2f; float num14 = (Mathf.PerlinNoise(num12, _seed) - 0.5f) * 2f; _pendingOffset = new Vector3(num13, num14, 0f) * num10; _active = true; } private static float ComputeEdgeFactor(Player lp, float probeMeters, float dropMeters) { //IL_00af: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_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_00ce: 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_00f7: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lp == (Object)null) { return 0f; } bool flag = false; try { flag = ((Character)lp).IsOnGround(); } catch { flag = false; } if (!flag) { return 0f; } Vector3 position = ((Component)lp).transform.position; Vector3 forward = ((Component)lp).transform.forward; Vector3 val = position + Vector3.up * 0.5f; Vector3 val2 = position + forward * probeMeters + Vector3.up * 0.5f; float num = 25f; int num2 = -1; try { num2 = -5; } catch { num2 = -1; } float y = position.y; float y2 = position.y; RaycastHit val3 = default(RaycastHit); bool flag2 = false; bool flag3 = false; try { flag2 = Physics.Raycast(val, Vector3.down, ref val3, num, num2, (QueryTriggerInteraction)1); } catch { flag2 = false; } if (flag2) { y = ((RaycastHit)(ref val3)).point.y; } try { flag3 = Physics.Raycast(val2, Vector3.down, ref val3, num, num2, (QueryTriggerInteraction)1); } catch { flag3 = false; } if (flag3) { y2 = ((RaycastHit)(ref val3)).point.y; } if (!flag3) { return 1f; } float num3 = y - y2; if (num3 <= dropMeters) { return 0f; } float num4 = Mathf.Max(0.5f, dropMeters * 0.75f); return Mathf.Clamp01((num3 - dropMeters) / num4); } private static void HookOnce() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (!_hooked) { _hooked = true; Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnPreCull)); Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnPostRender)); } } private static void OnPreCull(Camera cam) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cam == (Object)null) { return; } if ((Object)(object)_targetCam == (Object)null) { _targetCam = Camera.main; } if (!((Object)(object)_targetCam != (Object)null) || !((Object)(object)cam != (Object)(object)_targetCam)) { if (((Vector3)(ref _appliedOffset)).sqrMagnitude > 0f) { ((Component)cam).transform.position = ((Component)cam).transform.position - _appliedOffset; _appliedOffset = Vector3.zero; } if (_active) { _appliedOffset = _pendingOffset; ((Component)cam).transform.position = ((Component)cam).transform.position + _appliedOffset; } } } private static void OnPostRender(Camera cam) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) if (!((Object)(object)cam == (Object)null) && ((Vector3)(ref _appliedOffset)).sqrMagnitude > 0f) { ((Component)cam).transform.position = ((Component)cam).transform.position - _appliedOffset; _appliedOffset = Vector3.zero; } } } internal static class ControllerRumble { private struct XInputVibration { public ushort wLeftMotorSpeed; public ushort wRightMotorSpeed; } private struct XInputState { public uint dwPacketNumber; public XInputGamepad Gamepad; } private struct XInputGamepad { public ushort wButtons; public byte bLeftTrigger; public byte bRightTrigger; public short sThumbLX; public short sThumbLY; public short sThumbRX; public short sThumbRY; } private const int ERROR_SUCCESS = 0; private static bool _xinputChecked; private static bool _xinputAvailable; private static int _activeUser = -1; private static float _nextDeviceScanAt; private static bool _isRumbling; private static float _stopAt; private static float _nextPulseAt; [DllImport("XInput1_4.dll", EntryPoint = "XInputSetState")] private static extern int XInputSetState_14(int dwUserIndex, ref XInputVibration pVibration); [DllImport("XInput1_4.dll", EntryPoint = "XInputGetState")] private static extern int XInputGetState_14(int dwUserIndex, out XInputState pState); [DllImport("XInput1_3.dll", EntryPoint = "XInputSetState")] private static extern int XInputSetState_13(int dwUserIndex, ref XInputVibration pVibration); [DllImport("XInput1_3.dll", EntryPoint = "XInputGetState")] private static extern int XInputGetState_13(int dwUserIndex, out XInputState pState); [DllImport("XInput9_1_0.dll", EntryPoint = "XInputSetState")] private static extern int XInputSetState_910(int dwUserIndex, ref XInputVibration pVibration); [DllImport("XInput9_1_0.dll", EntryPoint = "XInputGetState")] private static extern int XInputGetState_910(int dwUserIndex, out XInputState pState); internal static void Tick(float normalized) { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if (AccessibilityPlugin.CfgRumbleEnabled == null || !AccessibilityPlugin.CfgRumbleEnabled.Value) { StopIfActive(); return; } RuntimePlatform platform = Application.platform; if ((int)platform != 2 && (int)platform != 7) { StopIfActive(); return; } float realtimeSinceStartup = Time.realtimeSinceStartup; EnsureXInputDevice(realtimeSinceStartup); if (!_xinputAvailable || _activeUser < 0) { StopIfActive(); return; } float num = 1f; float num2 = 0.08f; float num3 = 0.08f; try { if (AccessibilityPlugin.CfgRumbleStrength != null) { num = Mathf.Clamp(AccessibilityPlugin.CfgRumbleStrength.Value, 0f, 2f); } } catch { num = 1f; } try { if (AccessibilityPlugin.CfgRumbleMinNormalized != null) { num2 = Mathf.Clamp01(AccessibilityPlugin.CfgRumbleMinNormalized.Value); } } catch { num2 = 0.08f; } try { if (AccessibilityPlugin.CfgRumblePulseInterval != null) { num3 = Mathf.Clamp(AccessibilityPlugin.CfgRumblePulseInterval.Value, 0.03f, 0.5f); } } catch { num3 = 0.08f; } if (_isRumbling && realtimeSinceStartup >= _stopAt) { StopIfActive(); } if (!(realtimeSinceStartup < _nextPulseAt)) { float num4 = Mathf.Clamp01(normalized); if (num4 < num2) { StopIfActive(); _nextPulseAt = realtimeSinceStartup + num3; return; } float num5 = Mathf.Clamp01(num4 * 0.55f) * num; int durationMs = Mathf.Clamp((int)(40f + num4 * 120f), 40, 200); Pulse(num5, num5, durationMs); _nextPulseAt = realtimeSinceStartup + num3; } } internal static void StopIfActive() { if (!_isRumbling) { return; } try { XInputVibration vib = default(XInputVibration); if (_activeUser >= 0) { TrySetState(_activeUser, ref vib); } } catch { } _isRumbling = false; _stopAt = 0f; } private static void Pulse(float strengthL, float strengthR, int durationMs) { try { ushort wLeftMotorSpeed = (ushort)(Mathf.Clamp01(strengthL) * 65535f); ushort wRightMotorSpeed = (ushort)(Mathf.Clamp01(strengthR) * 65535f); XInputVibration vib = default(XInputVibration); vib.wLeftMotorSpeed = wLeftMotorSpeed; vib.wRightMotorSpeed = wRightMotorSpeed; if (_activeUser >= 0 && TrySetState(_activeUser, ref vib)) { _isRumbling = true; _stopAt = Time.realtimeSinceStartup + (float)durationMs / 1000f; } else { _xinputAvailable = false; _activeUser = -1; StopIfActive(); } } catch { _xinputAvailable = false; _activeUser = -1; StopIfActive(); } } private static void EnsureXInputDevice(float now) { if (now < _nextDeviceScanAt) { return; } _nextDeviceScanAt = now + 1f; if (!_xinputChecked) { _xinputChecked = true; _xinputAvailable = ProbeXInputPresence(); } if (!_xinputAvailable) { _activeUser = -1; return; } int activeUser = -1; for (int i = 0; i < 4; i++) { if (TryGetState(i)) { activeUser = i; break; } } _activeUser = activeUser; } private static bool ProbeXInputPresence() { XInputState pState; try { XInputGetState_14(0, out pState); return true; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { return true; } try { XInputGetState_13(0, out pState); return true; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { return true; } try { XInputGetState_910(0, out pState); return true; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { return true; } return false; } private static bool TryGetState(int userIndex) { return TryGetStateNoThrow(userIndex); } private static bool TryGetStateNoThrow(int userIndex) { XInputState pState; try { int num = XInputGetState_14(userIndex, out pState); return num == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } try { int num2 = XInputGetState_13(userIndex, out pState); return num2 == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } try { int num3 = XInputGetState_910(userIndex, out pState); return num3 == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } return false; } private static bool TrySetState(int userIndex, ref XInputVibration vib) { try { int num = XInputSetState_14(userIndex, ref vib); return num == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } try { int num2 = XInputSetState_13(userIndex, ref vib); return num2 == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } try { int num3 = XInputSetState_910(userIndex, ref vib); return num3 == 0; } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } catch { } return false; } } internal static class SilhouettesAccessibility { private struct CachedPromotion { public Transform Root; public float ExpiresAt; public float AddedAt; } private struct MaterialState { public bool HasColor; public Color Color; public bool HasEmission; public Color Emission; public bool EmissionKeyword; } private sealed class CloneEntry { public int Key; public GameObject Source; public GameObject Clone; public Renderer[] CloneRenderers; public Transform[] SourceRendererTransforms; public Transform[] CloneRendererTransforms; public float UnwantedSince; public float ShellScale; } private struct PendingCreate { public int Key; public GameObject Source; public Material Mat; public float UnwantedSince; public float ShellScale; } [HarmonyPatch(typeof(Player), "Update")] private static class Patch_Player_Update { private static void Postfix(Player __instance) { EnsureConfig(); float num = 0f; try { num = Time.time; } catch { num = 0f; } _createdThisTick = 0; try { if (AccessibilityPlugin.CfgSilMaxInteractableBoundsExtent != null) { MaxInteractableBoundsExtent = Mathf.Clamp(AccessibilityPlugin.CfgSilMaxInteractableBoundsExtent.Value, 1f, 25f); } } catch { } bool flag = AccessibilityPlugin.CfgEnabled != null && !AccessibilityPlugin.CfgEnabled.Value; if (AccessibilityPlugin.CfgSilEnabled != null) { Enabled = AccessibilityPlugin.CfgSilEnabled.Value; } if (flag || !Enabled) { HideAllClones(); } else { if ((Object)(object)__instance == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || (Object)(object)GameCamera.instance == (Object)null) { return; } num = Time.time; if (ShouldRunThisFrame(Player.m_localPlayer, num)) { try { TickLocal(Player.m_localPlayer); } catch (Exception ex) { TryRecoverFromTickException(ex); } } } } } private static bool Enabled = true; private static float RangeMeters = 35f; private static float RefreshSeconds = 0.2f; private static int PhysicsMask = -1; private static float ShellScale = 1.035f; private static Color SilhouetteColor = new Color(1f, 1f, 0.05f, 1f); private const float DisableCooldownSeconds = 0.13f; private static ManualLogSource _log; private static float _nextBumperAt = 0f; private static bool _idleSleeping = false; private static float _idleLastActiveAt = 0f; private static Vector3 _idleLastPos = Vector3.zero; private static float _idleNextCheckAt = 0f; private static Vector3 _bumperPlayerPos = Vector3.zero; private static float _bumperRangeNow = 3.5f; private static Material _bumperMat; private static readonly HashSet _bWanted = new HashSet(); private static readonly List _bToDisable = new List(64); private static readonly Dictionary _bumperByKey = new Dictionary(256); private static readonly Dictionary _bumperRenderRootByCollider = new Dictionary(512); private static readonly Collider[] _bOverlap = (Collider[])(object)new Collider[96]; private static readonly List _bNearest = new List(24); private static readonly Dictionary _promotionCache = new Dictionary(256); private const int PromotionCacheMax = 512; private const float PromotionCacheTtlSeconds = 2.5f; private static float _nextRockRendererScanAt = 0f; private static float _nextRockDebugAt = 0f; private static int _lastRockRendererCacheCount = 0; private static int _lastRockNearbyCount = 0; private static readonly List _rockRendererCache = new List(2048); private static readonly List _bNearestRenderers = new List(24); private static readonly Dictionary _staticRockOrig = new Dictionary(512); private static float _nextStaticRockBoostAt = 0f; private static bool _staticRockBoostWasOn = false; private static float MaxInteractableBoundsExtent = 6f; private static float _nextScanAt = 0f; private static readonly Collider[] _overlap = (Collider[])(object)new Collider[1024]; private static readonly HashSet _wanted = new HashSet(); private static readonly List _toDisable = new List(256); private static Transform _root; private static Material _mat; private static Material _matPickups; private static Material _matInteractables; private static Material _bumperMatPickups; private static Material _bumperMatInteractables; private static readonly Dictionary _clonesByKey = new Dictionary(512); private static readonly Dictionary _pendingCreates = new Dictionary(256); private static readonly List _tmpKeys = new List(512); private static readonly List _tmpTypeComps = new List(64); private static int _createdThisTick = 0; private static int _tickExceptionStreak = 0; private static float _nextTickRecoverAt = 0f; private static float _nextPruneAt = 0f; private static Color GetOutlineColor() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) try { if (AccessibilityPlugin.CfgSilOutlineColor != null) { return AccessibilityPlugin.CfgSilOutlineColor.Value; } } catch { } return SilhouetteColor; } private static Color GetBumperColor() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) try { if (AccessibilityPlugin.CfgSilBumperColor != null) { return AccessibilityPlugin.CfgSilBumperColor.Value; } } catch { } return GetOutlineColor(); } private static void PrunePromotionCacheIfNeeded(float now) { if (_promotionCache.Count <= 512) { return; } int num = 0; float num2 = float.MaxValue; foreach (KeyValuePair item in _promotionCache) { if ((Object)(object)item.Value.Root == (Object)null || item.Value.ExpiresAt <= now) { num = item.Key; num2 = float.MinValue; break; } if (item.Value.AddedAt < num2) { num2 = item.Value.AddedAt; num = item.Key; } } if (num != 0) { _promotionCache.Remove(num); } } private static void TryRecoverFromTickException(Exception ex) { _tickExceptionStreak++; float num = 0f; try { num = Time.time; } catch { num = 0f; } if (num < _nextTickRecoverAt) { return; } _nextTickRecoverAt = num + 1f; try { _tmpKeys.Clear(); foreach (KeyValuePair item in _clonesByKey) { _tmpKeys.Add(item.Key); } for (int i = 0; i < _tmpKeys.Count; i++) { int key = _tmpKeys[i]; if (!_clonesByKey.TryGetValue(key, out var value) || (value != null && !((Object)(object)value.Source == (Object)null) && !((Object)(object)value.Clone == (Object)null))) { continue; } try { if (value != null && (Object)(object)value.Clone != (Object)null) { value.Clone.SetActive(false); } } catch { } _clonesByKey.Remove(key); } } catch { } try { _tmpKeys.Clear(); foreach (KeyValuePair pendingCreate in _pendingCreates) { _tmpKeys.Add(pendingCreate.Key); } for (int j = 0; j < _tmpKeys.Count; j++) { int key2 = _tmpKeys[j]; if (_pendingCreates.TryGetValue(key2, out var value2) && (Object)(object)value2.Source == (Object)null) { _pendingCreates.Remove(key2); } } } catch { } if (_tickExceptionStreak < 10) { return; } _tickExceptionStreak = 0; try { foreach (KeyValuePair item2 in _clonesByKey) { CloneEntry value3 = item2.Value; if (value3 != null && (Object)(object)value3.Clone != (Object)null) { value3.Clone.SetActive(false); } } } catch { } try { _wanted.Clear(); } catch { } try { _pendingCreates.Clear(); } catch { } } private static void HideAllClones() { try { foreach (KeyValuePair item in _clonesByKey) { CloneEntry value = item.Value; if (value != null && (Object)(object)value.Clone != (Object)null && value.Clone.activeSelf) { value.Clone.SetActive(false); } } } catch { } try { foreach (KeyValuePair item2 in _bumperByKey) { CloneEntry value2 = item2.Value; if (value2 != null && (Object)(object)value2.Clone != (Object)null && value2.Clone.activeSelf) { value2.Clone.SetActive(false); } } } catch { } } private static void EnterIdleSleep() { if (_idleSleeping) { return; } _idleSleeping = true; try { foreach (KeyValuePair item in _clonesByKey) { CloneEntry value = item.Value; if ((Object)(object)value.Clone != (Object)null && value.Clone.activeSelf) { value.Clone.SetActive(false); } } } catch { } try { foreach (KeyValuePair item2 in _bumperByKey) { CloneEntry value2 = item2.Value; if ((Object)(object)value2.Clone != (Object)null && value2.Clone.activeSelf) { value2.Clone.SetActive(false); } } } catch { } _bWanted.Clear(); _pendingCreates.Clear(); } private static void ExitIdleSleep() { if (_idleSleeping) { _idleSleeping = false; _nextScanAt = 0f; _nextBumperAt = 0f; _createdThisTick = 0; } } private static bool ShouldRunThisFrame(Player lp, float now) { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (!GetCfgBool(AccessibilityPlugin.CfgSilIdleSleepEnabled, fallback: true)) { ExitIdleSleep(); return true; } float num = Mathf.Clamp(GetCfgFloat(AccessibilityPlugin.CfgSilIdleSleepSeconds, 60f), 10f, 600f); float num2 = Mathf.Clamp(GetCfgFloat(AccessibilityPlugin.CfgSilIdleMoveThreshold, 0.05f), 0.005f, 0.5f); float num3 = num2 * num2; if (_idleLastActiveAt <= 0f) { _idleLastActiveAt = now; _idleLastPos = ((Component)lp).transform.position; _idleSleeping = false; _idleNextCheckAt = 0f; return true; } Vector3 position = ((Component)lp).transform.position; Vector3 val = position - _idleLastPos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > num3) { _idleLastPos = position; _idleLastActiveAt = now; ExitIdleSleep(); return true; } if (_idleSleeping) { if (now < _idleNextCheckAt) { return false; } _idleNextCheckAt = now + 0.25f; return false; } if (now - _idleLastActiveAt >= num) { EnterIdleSleep(); _idleNextCheckAt = now + 0.25f; return false; } return true; } private static void PruneStaleClones(float now) { if (now < _nextPruneAt) { return; } _nextPruneAt = now + 2f; _tmpKeys.Clear(); foreach (KeyValuePair item in _clonesByKey) { CloneEntry value = item.Value; if (value == null || (Object)(object)value.Source == (Object)null) { _tmpKeys.Add(item.Key); } } for (int i = 0; i < _tmpKeys.Count; i++) { int key = _tmpKeys[i]; if (!_clonesByKey.TryGetValue(key, out var value2)) { continue; } try { if (value2 != null && (Object)(object)value2.Clone != (Object)null) { Object.Destroy((Object)(object)value2.Clone); } } catch { } _clonesByKey.Remove(key); } _tmpKeys.Clear(); foreach (KeyValuePair item2 in _bumperByKey) { CloneEntry value3 = item2.Value; if (value3 == null || (Object)(object)value3.Source == (Object)null) { _tmpKeys.Add(item2.Key); } } for (int j = 0; j < _tmpKeys.Count; j++) { int key2 = _tmpKeys[j]; if (!_bumperByKey.TryGetValue(key2, out var value4)) { continue; } try { if (value4 != null && (Object)(object)value4.Clone != (Object)null) { Object.Destroy((Object)(object)value4.Clone); } } catch { } _bumperByKey.Remove(key2); } _tmpKeys.Clear(); foreach (KeyValuePair pendingCreate in _pendingCreates) { if ((Object)(object)pendingCreate.Value.Source == (Object)null) { _tmpKeys.Add(pendingCreate.Key); } } for (int k = 0; k < _tmpKeys.Count; k++) { _pendingCreates.Remove(_tmpKeys[k]); } } private static void EnsureConfig() { } private static string GetCfgString(ConfigEntry e, string fallback) { try { return (e != null && e.Value != null) ? e.Value : fallback; } catch { return fallback; } } private static float GetCfgFloat(ConfigEntry e, float fallback) { try { return e?.Value ?? fallback; } catch { return fallback; } } private static bool GetCfgBool(ConfigEntry e, bool fallback) { try { return e?.Value ?? fallback; } catch { return fallback; } } private static Color ComputePresetColor(Color rgbaCfg, string preset, float intensity) { //IL_004c: 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_00bf: 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_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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b4: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); switch (preset) { case "Magenta": ((Color)(ref val))..ctor(1f, 0f, 1f, rgbaCfg.a); break; case "Cyan": ((Color)(ref val))..ctor(0f, 1f, 1f, rgbaCfg.a); break; case "Yellow": ((Color)(ref val))..ctor(1f, 1f, 0f, rgbaCfg.a); break; case "Red": ((Color)(ref val))..ctor(1f, 0f, 0f, rgbaCfg.a); break; default: val = rgbaCfg; break; } return new Color(val.r * intensity, val.g * intensity, val.b * intensity, val.a); } private static int ClassifyTarget(GameObject go) { if ((Object)(object)go == (Object)null) { return 0; } Transform val = null; try { val = go.transform; } catch { val = null; } int num = 0; while ((Object)(object)val != (Object)null && num++ < 8) { GameObject val2 = null; try { val2 = ((Component)val).gameObject; } catch { val2 = null; } if ((Object)(object)val2 == (Object)null) { try { val = val.parent; } catch { val = null; } continue; } try { Character component = val2.GetComponent(); if ((Object)(object)component != (Object)null && !(component is Player)) { return 3; } } catch { } try { if ((Object)(object)val2.GetComponent() != (Object)null) { return 1; } } catch { } try { if ((Object)(object)val2.GetComponent() != (Object)null) { return 1; } } catch { } try { if (val2.GetComponent() != null) { return 2; } } catch { } try { val = val.parent; } catch { val = null; } } return 0; } private static void TickLocal(Player p) { //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Unknown result type (might be due to invalid IL or missing references) //IL_0c0c: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0c57: Unknown result type (might be due to invalid IL or missing references) //IL_0c5c: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c69: Unknown result type (might be due to invalid IL or missing references) //IL_0c71: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c7e: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c8d: Unknown result type (might be due to invalid IL or missing references) //IL_0c92: Unknown result type (might be due to invalid IL or missing references) //IL_0c97: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca5: Unknown result type (might be due to invalid IL or missing references) //IL_0ca7: Unknown result type (might be due to invalid IL or missing references) //IL_0cb1: Unknown result type (might be due to invalid IL or missing references) //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Unknown result type (might be due to invalid IL or missing references) //IL_0cc1: Unknown result type (might be due to invalid IL or missing references) //IL_0cc6: Unknown result type (might be due to invalid IL or missing references) //IL_0cca: Unknown result type (might be due to invalid IL or missing references) //IL_0cd7: Unknown result type (might be due to invalid IL or missing references) //IL_0cd9: Unknown result type (might be due to invalid IL or missing references) //IL_0cdb: Unknown result type (might be due to invalid IL or missing references) //IL_0ce2: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cec: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0cfd: Unknown result type (might be due to invalid IL or missing references) //IL_0cff: Unknown result type (might be due to invalid IL or missing references) //IL_0d01: Unknown result type (might be due to invalid IL or missing references) //IL_0d08: Unknown result type (might be due to invalid IL or missing references) //IL_0d0d: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Unknown result type (might be due to invalid IL or missing references) //IL_0d23: Unknown result type (might be due to invalid IL or missing references) //IL_0d25: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d38: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0d49: Unknown result type (might be due to invalid IL or missing references) //IL_0d4b: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d57: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d7d: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Unknown result type (might be due to invalid IL or missing references) //IL_0d8c: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0da4: Unknown result type (might be due to invalid IL or missing references) //IL_0dae: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } EnsureConfig(); float num = 0f; try { num = Time.time; } catch { num = 0f; } if (AccessibilityPlugin.CfgSilEnabled != null) { Enabled = AccessibilityPlugin.CfgSilEnabled.Value; } if ((Object)(object)_root == (Object)null) { GameObject val = new GameObject("PX_Silhouettes_Root"); Object.DontDestroyOnLoad((Object)(object)val); _root = val.transform; ((Component)_root).gameObject.SetActive(true); } Color rgbaCfg = SilhouetteColor; try { if (AccessibilityPlugin.CfgSilOutlineColor != null) { rgbaCfg = AccessibilityPlugin.CfgSilOutlineColor.Value; } } catch { } string cfgString = GetCfgString(AccessibilityPlugin.CfgSilhouetteColorPreset, "Custom"); float cfgFloat = GetCfgFloat(AccessibilityPlugin.CfgSilhouetteIntensity, 1f); string cfgString2 = GetCfgString(AccessibilityPlugin.CfgSilPickupsColorPreset, "Inherit"); string preset = (string.Equals(cfgString2, "Inherit", StringComparison.OrdinalIgnoreCase) ? cfgString : cfgString2); float cfgFloat2 = GetCfgFloat(AccessibilityPlugin.CfgSilPickupsIntensity, cfgFloat); string cfgString3 = GetCfgString(AccessibilityPlugin.CfgSilInteractablesColorPreset, "Inherit"); string preset2 = (string.Equals(cfgString3, "Inherit", StringComparison.OrdinalIgnoreCase) ? cfgString : cfgString3); float cfgFloat3 = GetCfgFloat(AccessibilityPlugin.CfgSilInteractablesIntensity, cfgFloat); string cfgString4 = GetCfgString(AccessibilityPlugin.CfgSilCreaturesColorPreset, "Inherit"); string preset3 = (string.Equals(cfgString4, "Inherit", StringComparison.OrdinalIgnoreCase) ? cfgString : cfgString4); float cfgFloat4 = GetCfgFloat(AccessibilityPlugin.CfgSilCreaturesIntensity, cfgFloat); Color val2 = ComputePresetColor(rgbaCfg, preset3, cfgFloat4); Color val3 = ComputePresetColor(rgbaCfg, preset, cfgFloat2); Color val4 = ComputePresetColor(rgbaCfg, preset2, cfgFloat3); if ((Object)(object)_mat == (Object)null) { _mat = BuildSilhouetteMaterial(val2); } else { TrySetColor(_mat, "_Color", val2); TrySetColor(_mat, "_BaseColor", val2); TrySetColor(_mat, "_TintColor", val2); TrySetColor(_mat, "_EmissionColor", new Color(val2.r * 2.5f, val2.g * 2.5f, val2.b * 2.5f, 1f)); } if ((Object)(object)_matPickups == (Object)null) { _matPickups = BuildSilhouetteMaterial(val3); } else { TrySetColor(_matPickups, "_Color", val3); TrySetColor(_matPickups, "_BaseColor", val3); TrySetColor(_matPickups, "_TintColor", val3); TrySetColor(_matPickups, "_EmissionColor", new Color(val3.r * 2.5f, val3.g * 2.5f, val3.b * 2.5f, 1f)); } if ((Object)(object)_matInteractables == (Object)null) { _matInteractables = BuildSilhouetteMaterial(val4); } else { TrySetColor(_matInteractables, "_Color", val4); TrySetColor(_matInteractables, "_BaseColor", val4); TrySetColor(_matInteractables, "_TintColor", val4); TrySetColor(_matInteractables, "_EmissionColor", new Color(val4.r * 2.5f, val4.g * 2.5f, val4.b * 2.5f, 1f)); } float num2 = ((AccessibilityPlugin.CfgSilBumperAlpha != null) ? Mathf.Clamp01(AccessibilityPlugin.CfgSilBumperAlpha.Value) : 0.45f); string cfgString5 = GetCfgString(AccessibilityPlugin.CfgBumperColorPreset, "Custom"); float cfgFloat5 = GetCfgFloat(AccessibilityPlugin.CfgBumperIntensity, 1f); string cfgString6 = GetCfgString(AccessibilityPlugin.CfgBumperPickupsColorPreset, cfgString5); float cfgFloat6 = GetCfgFloat(AccessibilityPlugin.CfgBumperPickupsIntensity, cfgFloat5); string cfgString7 = GetCfgString(AccessibilityPlugin.CfgBumperInteractablesColorPreset, cfgString5); float cfgFloat7 = GetCfgFloat(AccessibilityPlugin.CfgBumperInteractablesIntensity, cfgFloat5); string cfgString8 = GetCfgString(AccessibilityPlugin.CfgBumperCreaturesColorPreset, cfgString5); float cfgFloat8 = GetCfgFloat(AccessibilityPlugin.CfgBumperCreaturesIntensity, cfgFloat5); Color val5 = ComputePresetColor(new Color((AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.r : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.g : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.b : 1f, num2), cfgString8, cfgFloat8); Color val6 = ComputePresetColor(new Color((AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.r : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.g : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.b : 1f, num2), cfgString6, cfgFloat6); Color val7 = ComputePresetColor(new Color((AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.r : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.g : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.b : 1f, num2), cfgString7, cfgFloat7); if ((Object)(object)_bumperMat == (Object)null) { _bumperMat = BuildSilhouetteMaterial(val5); } else { TrySetColor(_bumperMat, "_Color", val5); TrySetColor(_bumperMat, "_BaseColor", val5); TrySetColor(_bumperMat, "_TintColor", val5); TrySetColor(_bumperMat, "_EmissionColor", new Color(val5.r * 2.5f, val5.g * 2.5f, val5.b * 2.5f, 1f)); } if ((Object)(object)_bumperMatPickups == (Object)null) { _bumperMatPickups = BuildSilhouetteMaterial(val6); } else { TrySetColor(_bumperMatPickups, "_Color", val6); TrySetColor(_bumperMatPickups, "_BaseColor", val6); TrySetColor(_bumperMatPickups, "_TintColor", val6); TrySetColor(_bumperMatPickups, "_EmissionColor", new Color(val6.r * 2.5f, val6.g * 2.5f, val6.b * 2.5f, 1f)); } if ((Object)(object)_bumperMatInteractables == (Object)null) { _bumperMatInteractables = BuildSilhouetteMaterial(val7); } else { TrySetColor(_bumperMatInteractables, "_Color", val7); TrySetColor(_bumperMatInteractables, "_BaseColor", val7); TrySetColor(_bumperMatInteractables, "_TintColor", val7); TrySetColor(_bumperMatInteractables, "_EmissionColor", new Color(val7.r * 2.5f, val7.g * 2.5f, val7.b * 2.5f, 1f)); } num = Time.time; if (num < _nextScanAt) { return; } _nextScanAt = num + Mathf.Max(0.05f, RefreshSeconds); PruneStaleClones(num); Vector3 position = ((Component)p).transform.position; bool flag = GetCfgBool(AccessibilityPlugin.CfgSilPickupsEnabled, fallback: true) && AccessibilityPlugin.RtPickupsEnabled; bool flag2 = GetCfgBool(AccessibilityPlugin.CfgSilInteractablesEnabled, fallback: true) && AccessibilityPlugin.RtInteractablesEnabled; bool flag3 = GetCfgBool(AccessibilityPlugin.CfgSilCreaturesEnabled, fallback: true) && AccessibilityPlugin.RtCreaturesEnabled; _wanted.Clear(); try { List allCharacters = Character.GetAllCharacters(); if (allCharacters != null) { float num3 = RangeMeters * RangeMeters; for (int i = 0; i < allCharacters.Count; i++) { Character val8 = allCharacters[i]; if ((Object)(object)val8 == (Object)null || val8 is Player) { continue; } GameObject gameObject = ((Component)val8).gameObject; if (!((Object)(object)gameObject == (Object)null)) { Vector3 val9 = gameObject.transform.position - position; if (((Vector3)(ref val9)).sqrMagnitude <= num3 && flag3) { AddWanted(gameObject, _mat); } } } } } catch { } int num4 = 0; try { num4 = Physics.OverlapSphereNonAlloc(position, Mathf.Max(1f, RangeMeters), _overlap, PhysicsMask, (QueryTriggerInteraction)2); } catch { num4 = 0; } for (int j = 0; j < num4; j++) { Collider val10 = _overlap[j]; if ((Object)(object)val10 == (Object)null) { continue; } Transform transform = ((Component)val10).transform; if ((Object)(object)transform == (Object)null) { continue; } Character val11 = null; try { val11 = ((Component)transform).GetComponentInParent(); } catch { val11 = null; } if ((Object)(object)val11 != (Object)null && (Object)(object)((Component)val11).gameObject != (Object)null) { if (!(val11 is Player) && flag3) { AddWanted(((Component)val11).gameObject, _mat); } continue; } ItemDrop val12 = null; try { val12 = ((Component)transform).GetComponentInParent(); } catch { val12 = null; } if ((Object)(object)val12 != (Object)null && (Object)(object)((Component)val12).gameObject != (Object)null) { if (flag) { AddWanted(((Component)val12).gameObject, _matPickups); } continue; } Pickable val13 = null; try { val13 = ((Component)transform).GetComponentInParent(); } catch { val13 = null; } if ((Object)(object)val13 != (Object)null && (Object)(object)((Component)val13).gameObject != (Object)null) { if (flag) { AddWanted(((Component)val13).gameObject, _matPickups); } continue; } Interactable val14 = null; try { val14 = ((Component)transform).GetComponentInParent(); } catch { val14 = null; } if (val14 != null) { Component val15 = (Component)(object)((val14 is Component) ? val14 : null); if ((Object)(object)val15 != (Object)null && (Object)(object)val15.gameObject != (Object)null) { if (!IsTooBigInteractable(val15.gameObject) && flag2) { AddWanted(val15.gameObject, _matInteractables); } continue; } } CraftingStation val16 = null; try { val16 = ((Component)transform).GetComponentInParent(); } catch { val16 = null; } if ((Object)(object)val16 != (Object)null && (Object)(object)((Component)val16).gameObject != (Object)null) { if (flag2) { AddWanted(((Component)val16).gameObject, _matInteractables); } continue; } StationExtension val17 = null; try { val17 = ((Component)transform).GetComponentInParent(); } catch { val17 = null; } if ((Object)(object)val17 != (Object)null && (Object)(object)((Component)val17).gameObject != (Object)null) { if (flag2) { AddWanted(((Component)val17).gameObject, _matInteractables); } continue; } Teleport val18 = null; try { val18 = ((Component)transform).GetComponentInParent(); } catch { val18 = null; } if ((Object)(object)val18 != (Object)null && (Object)(object)((Component)val18).gameObject != (Object)null && flag2) { AddWanted(((Component)val18).gameObject, _matInteractables); } } _bWanted.Clear(); bool flag4 = AccessibilityPlugin.CfgSilBumperEnabled == null || AccessibilityPlugin.CfgSilBumperEnabled.Value; float num5 = ((AccessibilityPlugin.CfgSilBumperRefresh == null) ? 0.1f : Mathf.Max(0.05f, AccessibilityPlugin.CfgSilBumperRefresh.Value)); float num6 = ((AccessibilityPlugin.CfgSilBumperRange == null) ? 5f : Mathf.Clamp(AccessibilityPlugin.CfgSilBumperRange.Value, 1.5f, 12f)); _bumperPlayerPos = ((Component)p).transform.position; _bumperRangeNow = num6; if (flag4 && num >= _nextBumperAt) { _nextBumperAt = num + num5; Vector3 origin = ((Component)p).transform.position + Vector3.up * 1.2f; Vector3 forward = ((Component)p).transform.forward; Vector3 right = ((Component)p).transform.right; Vector3 origin2 = ((Component)p).transform.position + Vector3.up * 0.45f; TryBumperProbe(origin, forward, num6); TryBumperProbe(origin2, forward, num6); Vector3 val19 = forward + right * 0.35f; TryBumperProbe(origin, ((Vector3)(ref val19)).normalized, num6); val19 = forward - right * 0.35f; TryBumperProbe(origin, ((Vector3)(ref val19)).normalized, num6); val19 = forward + right * 0.25f; TryBumperProbe(origin2, ((Vector3)(ref val19)).normalized, num6); val19 = forward - right * 0.25f; TryBumperProbe(origin2, ((Vector3)(ref val19)).normalized, num6); val19 = forward + Vector3.down * 0.35f; TryBumperProbe(origin2, ((Vector3)(ref val19)).normalized, num6); TryBumperBubble(((Component)p).transform.position + Vector3.up * 0.75f, num6); TryBumperRendererBubble(((Component)p).transform.position + Vector3.up * 0.75f, num6); } _bToDisable.Clear(); foreach (KeyValuePair item in _bumperByKey) { if (!_bWanted.Contains(item.Key)) { _bToDisable.Add(item.Key); } } for (int k = 0; k < _bToDisable.Count; k++) { int key = _bToDisable[k]; if (_bumperByKey.TryGetValue(key, out var value) && value != null && (Object)(object)value.Clone != (Object)null) { if (value.UnwantedSince <= 0f) { value.UnwantedSince = num; } else if (num - value.UnwantedSince >= 0.13f && value.Clone.activeSelf) { value.Clone.SetActive(false); } } } foreach (int item2 in _bWanted) { if (_bumperByKey.TryGetValue(item2, out var value2) && value2 != null && !((Object)(object)value2.Source == (Object)null) && !((Object)(object)value2.Clone == (Object)null)) { value2.UnwantedSince = 0f; if (!value2.Clone.activeSelf) { value2.Clone.SetActive(true); } SyncClone(value2); } } if (_pendingCreates.Count > 0) { int num7 = 280; int num8 = 16; try { if (AccessibilityPlugin.CfgSilMaxTotalClones != null) { num7 = Mathf.Clamp(AccessibilityPlugin.CfgSilMaxTotalClones.Value, 32, 2000); } } catch { } try { if (AccessibilityPlugin.CfgSilMaxNewClonesPerTick != null) { num8 = Mathf.Clamp(AccessibilityPlugin.CfgSilMaxNewClonesPerTick.Value, 1, 200); } } catch { } _tmpKeys.Clear(); foreach (KeyValuePair pendingCreate in _pendingCreates) { _tmpKeys.Add(pendingCreate.Key); } for (int l = 0; l < _tmpKeys.Count; l++) { int num9 = _tmpKeys[l]; if (!_wanted.Contains(num9)) { _pendingCreates.Remove(num9); continue; } if (_clonesByKey.ContainsKey(num9)) { _pendingCreates.Remove(num9); continue; } if (_clonesByKey.Count >= num7 || _createdThisTick >= num8) { break; } if (!_pendingCreates.TryGetValue(num9, out var value3)) { continue; } if ((Object)(object)value3.Source == (Object)null) { _pendingCreates.Remove(num9); continue; } CloneEntry cloneEntry = CreateCloneEntry(num9, value3.Source, value3.Mat, value3.ShellScale); if (cloneEntry != null) { _createdThisTick++; _clonesByKey[num9] = cloneEntry; cloneEntry.Clone.SetActive(true); SyncClone(cloneEntry); } _pendingCreates.Remove(num9); } } _toDisable.Clear(); foreach (KeyValuePair item3 in _clonesByKey) { if (!_wanted.Contains(item3.Key)) { _toDisable.Add(item3.Key); } } for (int m = 0; m < _toDisable.Count; m++) { int key2 = _toDisable[m]; if (_clonesByKey.TryGetValue(key2, out var value4) && value4 != null && (Object)(object)value4.Clone != (Object)null) { if (value4.UnwantedSince <= 0f) { value4.UnwantedSince = num; } else if (num - value4.UnwantedSince >= 0.13f && value4.Clone.activeSelf) { value4.Clone.SetActive(false); } } } foreach (int item4 in _wanted) { if (!_clonesByKey.TryGetValue(item4, out var value5) || value5 == null || (Object)(object)value5.Source == (Object)null || (Object)(object)value5.Clone == (Object)null) { continue; } if (_bWanted.Contains(item4)) { if ((Object)(object)value5.Clone != (Object)null) { if (value5.UnwantedSince <= 0f) { value5.UnwantedSince = num; } else if (num - value5.UnwantedSince >= 0.13f && value5.Clone.activeSelf) { value5.Clone.SetActive(false); } } } else { value5.UnwantedSince = 0f; if (!value5.Clone.activeSelf) { value5.Clone.SetActive(true); } SyncClone(value5); } } TryStaticRockBoost(p); } private static float GetShellScaleFor(GameObject go) { float num = ShellScale; try { if (AccessibilityPlugin.CfgSilShellScale != null) { num = Mathf.Clamp(AccessibilityPlugin.CfgSilShellScale.Value, 1f, 2f); } } catch { } bool flag = false; try { if ((Object)(object)go != (Object)null && (Object)(object)go.GetComponentInParent() != (Object)null) { flag = true; } } catch { } if (!flag) { try { string text = (((Object)(object)go != (Object)null) ? ((Object)go).name : ""); if (!string.IsNullOrEmpty(text)) { text = text; if (text.Contains("door") || text.Contains("gate")) { flag = true; } } } catch { } } if (flag) { float num2 = 1.06f; try { if (AccessibilityPlugin.CfgSilDoorShellScale != null) { num2 = Mathf.Clamp(AccessibilityPlugin.CfgSilDoorShellScale.Value, 1f, 2f); } } catch { } if (num2 > num) { return num2; } } return num; } private static bool IsTooBigInteractable(GameObject go) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return true; } try { if ((Object)(object)go.GetComponentInParent() != (Object)null) { return false; } } catch { } try { if ((Object)(object)go.GetComponentInParent() != (Object)null) { return false; } } catch { } try { if ((Object)(object)go.GetComponentInParent() != (Object)null) { return false; } } catch { } try { if ((Object)(object)go.GetComponentInParent() != (Object)null) { return false; } } catch { } try { if ((Object)(object)go.GetComponentInParent() != (Object)null) { return false; } } catch { } Renderer[] array = null; try { array = go.GetComponentsInChildren(true); } catch { array = null; } if (array == null || array.Length == 0) { return false; } Bounds val = default(Bounds); bool flag = false; foreach (Renderer val2 in array) { if (!((Object)(object)val2 == (Object)null)) { if (!flag) { val = val2.bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2.bounds); } Vector3 extents = ((Bounds)(ref val)).extents; float magnitude = ((Vector3)(ref extents)).magnitude; if (magnitude > MaxInteractableBoundsExtent) { return true; } } } return false; } private static void TryBumperProbe(Vector3 origin, Vector3 dir, float range) { //IL_0003: 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_0014: 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_003b: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); bool flag = false; float num = 0.35f; try { flag = Physics.SphereCast(origin, num, dir, ref val, range, PhysicsMask, (QueryTriggerInteraction)1); } catch { flag = false; } if (!flag) { try { flag = Physics.Raycast(origin, dir, ref val, range, PhysicsMask, (QueryTriggerInteraction)1); } catch { flag = false; } } if (!flag) { return; } Collider collider = ((RaycastHit)(ref val)).collider; if ((Object)(object)collider == (Object)null) { return; } Transform transform = ((Component)collider).transform; if (!((Object)(object)transform == (Object)null)) { GameObject val2 = BestBumperTarget(transform, collider); if (!((Object)(object)val2 == (Object)null)) { AddBumperWanted(val2); } } } private static void TryBumperBubble(Vector3 center, float range) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) int num = 0; try { num = Physics.OverlapSphereNonAlloc(center, range, _bOverlap, PhysicsMask, (QueryTriggerInteraction)1); } catch { num = 0; } if (num <= 0) { return; } _bNearest.Clear(); for (int i = 0; i < num; i++) { Collider val = _bOverlap[i]; if ((Object)(object)val == (Object)null) { continue; } Transform transform = ((Component)val).transform; if (!((Object)(object)transform == (Object)null)) { GameObject val2 = BestBumperTarget(transform, val); if (!((Object)(object)val2 == (Object)null)) { _bNearest.Add(val2); } } } if (_bNearest.Count != 0) { Vector3 p = center; _bNearest.Sort(delegate(GameObject a, GameObject b) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = a.transform.position - p; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; val3 = b.transform.position - p; float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude; return sqrMagnitude.CompareTo(sqrMagnitude2); }); int num2 = _bNearest.Count; if (num2 > 10) { num2 = 10; } for (int j = 0; j < num2; j++) { AddBumperWanted(_bNearest[j]); } } } private static float GetBumperMaxAxisCap() { float num = ((AccessibilityPlugin.CfgSilBumperMaxExtent == null) ? 4f : Mathf.Max(0.5f, AccessibilityPlugin.CfgSilBumperMaxExtent.Value)); float num2 = num * 1.75f; if (num2 < 4.5f) { num2 = 4.5f; } if (num2 > 8f) { num2 = 8f; } return num2; } private static float GetBumperRockExtentCap() { float num = ((AccessibilityPlugin.CfgSilBumperMaxExtent == null) ? 4f : Mathf.Max(0.5f, AccessibilityPlugin.CfgSilBumperMaxExtent.Value)); float num2 = num * 2.75f; if (num2 < 6f) { num2 = 6f; } if (num2 > 12f) { num2 = 12f; } return num2; } private static float GetBumperVegetationRockExtentCap() { float num = ((AccessibilityPlugin.CfgSilBumperMaxExtent == null) ? 4f : Mathf.Max(0.5f, AccessibilityPlugin.CfgSilBumperMaxExtent.Value)); float num2 = num * 6f; if (num2 < 12f) { num2 = 12f; } if (num2 > 30f) { num2 = 30f; } return num2; } private static bool LooksLikeVegetationRockName(GameObject go) { if ((Object)(object)go == (Object)null) { return false; } string text = null; try { text = ((Object)go).name; } catch { text = null; } if (string.IsNullOrEmpty(text)) { return false; } string text2 = text.Trim(); if (text2.Length == 0) { return false; } string text3 = text2.ToLowerInvariant(); if (text3.StartsWith("rock_")) { return true; } if (text3.StartsWith("rock") && text3.Length >= 5) { char c = text3[4]; if (c >= '0' && c <= '9') { return true; } } if (text3.Contains("caverock") || text3.Contains("blackmarble")) { return true; } return false; } private static bool LooksLikeStaticRockMaterial(Renderer r) { if ((Object)(object)r == (Object)null) { return false; } Material[] array = null; try { array = r.sharedMaterials; } catch { array = null; } if (array == null || array.Length == 0) { return false; } foreach (Material val in array) { if ((Object)(object)val == (Object)null) { continue; } try { Shader shader = val.shader; if ((Object)(object)shader != (Object)null) { string name = ((Object)shader).name; if (!string.IsNullOrEmpty(name) && name.IndexOf("Custom/StaticRock", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } try { string name2 = ((Object)val).name; if (!string.IsNullOrEmpty(name2)) { if (name2.IndexOf("rock", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name2.IndexOf("stone", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name2.IndexOf("cliff", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name2.IndexOf("boulder", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name2.IndexOf("blackmarble", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } } return false; } private static bool LooksLikeRockFast(GameObject go, Renderer r, Collider col) { if (LooksLikeStaticRockMaterial(r)) { return true; } if ((Object)(object)go == (Object)null) { return false; } try { string name = ((Object)go).name; if (!string.IsNullOrEmpty(name)) { if (name.IndexOf("rock", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("stone", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("cliff", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("boulder", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("smooth_stone", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } private static bool HasBadBumperAncestors(Transform t) { if ((Object)(object)t == (Object)null) { return true; } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return true; } } catch { } return false; } private static bool IsClosePhysicalObstacle(GameObject go) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_0129: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return false; } Collider val = null; try { val = go.GetComponent(); } catch { val = null; } if ((Object)(object)val == (Object)null) { try { val = go.GetComponentInChildren(false); } catch { val = null; } } if ((Object)(object)val == (Object)null) { return false; } try { if (val is TerrainCollider) { return false; } } catch { } Vector3 bumperPlayerPos = _bumperPlayerPos; Bounds bounds; Vector3 val2; try { bounds = val.bounds; val2 = ((Bounds)(ref bounds)).ClosestPoint(bumperPlayerPos); } catch { return false; } float num; try { num = Vector3.Distance(bumperPlayerPos, val2); } catch { num = 999f; } if (num > _bumperRangeNow) { return false; } Vector3 extents; try { bounds = val.bounds; extents = ((Bounds)(ref bounds)).extents; } catch { return false; } float num2 = extents.x; if (extents.y > num2) { num2 = extents.y; } if (extents.z > num2) { num2 = extents.z; } float num3 = GetBumperMaxAxisCap(); try { Renderer val3 = null; try { val3 = go.GetComponent(); } catch { val3 = null; } if ((Object)(object)val3 == (Object)null) { try { val3 = go.GetComponentInChildren(true); } catch { val3 = null; } } if (LooksLikeStaticRockMaterial(val3)) { num3 = GetBumperRockExtentCap(); } } catch { } if (num2 > num3) { return false; } return true; } private static bool TryGetMineRockTarget(Transform t, out GameObject targetGo) { return TryGetMineRockTarget(t, null, out targetGo); } private static bool TryGetMineRockTarget(Transform t, Collider hitCol, out GameObject targetGo) { targetGo = null; Transform val = null; Transform val2 = null; try { if ((Object)(object)hitCol != (Object)null) { val = ((Component)hitCol).transform; } } catch { val = null; } try { if ((Object)(object)hitCol != (Object)null && (Object)(object)hitCol.attachedRigidbody != (Object)null) { val2 = ((Component)hitCol.attachedRigidbody).transform; } } catch { val2 = null; } for (int i = 0; i < 3; i++) { Transform val3 = (Transform)(i switch { 1 => val, 0 => t, _ => val2, }); if ((Object)(object)val3 == (Object)null) { continue; } int num = 0; while ((Object)(object)val3 != (Object)null && num < 48) { try { MineRock component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject != (Object)null) { targetGo = PreferBumperRockRoot(((Component)component).gameObject, hitCol); return true; } } catch { } try { MineRock5 component2 = ((Component)val3).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)((Component)component2).gameObject != (Object)null) { targetGo = PreferBumperRockRoot(((Component)component2).gameObject, hitCol); return true; } } catch { } try { Destructible component3 = ((Component)val3).GetComponent(); if ((Object)(object)component3 != (Object)null && (Object)(object)((Component)component3).gameObject != (Object)null) { targetGo = PreferBumperRockRoot(((Component)component3).gameObject, hitCol); return true; } } catch { } try { Component[] components = ((Component)val3).GetComponents(); if (components != null) { int num2 = components.Length; if (num2 > 16) { num2 = 16; } for (int j = 0; j < num2; j++) { Component val4 = components[j]; if ((Object)(object)val4 == (Object)null) { continue; } string text = null; try { text = ((object)val4).GetType().Name; } catch { text = null; } if (string.IsNullOrEmpty(text) || !text.StartsWith("MineRock", StringComparison.Ordinal)) { continue; } try { GameObject gameObject = val4.gameObject; if ((Object)(object)gameObject != (Object)null) { targetGo = PreferBumperRockRoot(gameObject, hitCol); return true; } } catch { } } } } catch { } try { val3 = val3.parent; } catch { val3 = null; } num++; } } return false; } private static GameObject PreferBumperRockRoot(GameObject found, Collider hitCol) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)found == (Object)null) { return null; } float foundMag = -1f; try { Renderer componentInChildren = found.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Bounds bounds = componentInChildren.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; foundMag = ((Vector3)(ref extents)).magnitude; } } catch { } try { if ((Object)(object)hitCol != (Object)null && (Object)(object)hitCol.attachedRigidbody != (Object)null) { GameObject gameObject = ((Component)hitCol.attachedRigidbody).gameObject; if ((Object)(object)gameObject != (Object)null && PromotionIsSane(gameObject) && (LooksLikeRockRoot(gameObject) || LooksLikeRockRoot(found))) { return gameObject; } } } catch { } try { LODGroup componentInParent = found.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)((Component)componentInParent).gameObject != (Object)null) { GameObject gameObject2 = ((Component)componentInParent).gameObject; if (PromotionIsSane(gameObject2) && (LooksLikeRockRoot(gameObject2) || LooksLikeRockRoot(found))) { return gameObject2; } } } catch { } try { ZNetView componentInParent2 = found.GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)((Component)componentInParent2).gameObject != (Object)null) { GameObject gameObject3 = ((Component)componentInParent2).gameObject; if (PromotionIsSane(gameObject3) && (LooksLikeRockRoot(gameObject3) || LooksLikeRockRoot(found))) { return gameObject3; } } } catch { } return found; static bool LooksLikeRockRoot(GameObject go) { if ((Object)(object)go == (Object)null) { return false; } try { if ((Object)(object)go.GetComponentInChildren() != (Object)null) { return true; } if ((Object)(object)go.GetComponentInChildren() != (Object)null) { return true; } if ((Object)(object)go.GetComponentInChildren() != (Object)null) { return true; } } catch { } try { string name = ((Object)go).name; if (!string.IsNullOrEmpty(name)) { if (name.IndexOf("MineRock", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("_frac", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("Rock_", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } bool PromotionIsSane(GameObject candidate) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)candidate == (Object)null) { return false; } if ((Object)(object)candidate == (Object)(object)found) { return true; } if (foundMag <= 0f) { return true; } float num = -1f; try { Renderer componentInChildren2 = candidate.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { Bounds bounds2 = componentInChildren2.bounds; Vector3 extents2 = ((Bounds)(ref bounds2)).extents; num = ((Vector3)(ref extents2)).magnitude; } } catch { } if (num <= 0f) { return true; } return num <= foundMag * 4f; } } private static float GetMineRockExtentCap() { float result = 30f; try { if (AccessibilityPlugin.CfgSilMineRockExtentCap != null) { result = Mathf.Clamp(AccessibilityPlugin.CfgSilMineRockExtentCap.Value, 6f, 80f); } else if (AccessibilityPlugin.CfgSilMineRock5ExtentCap != null) { result = Mathf.Clamp(AccessibilityPlugin.CfgSilMineRock5ExtentCap.Value, 6f, 80f); } } catch { } return result; } private static float GetMineRock5ExtentCap() { return GetMineRockExtentCap(); } private static GameObject BestBumperTarget(Transform t, Collider hitCol) { //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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) if ((Object)(object)t == (Object)null) { return null; } if (TryGetMineRockTarget(t, hitCol, out var targetGo)) { try { if (HasBadBumperAncestors(targetGo.transform)) { return null; } } catch { } return targetGo; } if ((Object)(object)hitCol != (Object)null) { int num = 0; try { num = ((Object)hitCol).GetInstanceID(); } catch { num = 0; } if (num != 0 && _bumperRenderRootByCollider.TryGetValue(num, out var value)) { if ((Object)(object)value != (Object)null) { return value; } _bumperRenderRootByCollider.Remove(num); } } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent() != (Object)null) { return null; } } catch { } float num2 = ((AccessibilityPlugin.CfgSilBumperMaxExtent == null) ? 4f : Mathf.Max(0.5f, AccessibilityPlugin.CfgSilBumperMaxExtent.Value)); GameObject val = null; Renderer val2 = null; float num3 = -1f; Transform val3 = t; Bounds bounds; Vector3 extents; for (int i = 0; i < 8; i++) { if (!((Object)(object)val3 != (Object)null)) { break; } if (TryGetRendererShallow(val3, out var rend, out var rendGo)) { float num4 = 999f; try { bounds = rend.bounds; extents = ((Bounds)(ref bounds)).extents; num4 = ((Vector3)(ref extents)).magnitude; } catch { num4 = 999f; } if (num4 > num3) { num3 = num4; val = rendGo; val2 = rend; } } val3 = val3.parent; } Transform val4 = null; try { val4 = t.parent; } catch { val4 = null; } if ((Object)(object)val4 != (Object)null) { int num5 = 0; try { num5 = val4.childCount; } catch { num5 = 0; } int num6 = num5; if (num6 > 24) { num6 = 24; } for (int j = 0; j < num6; j++) { Transform val5 = null; try { val5 = val4.GetChild(j); } catch { val5 = null; } if (!((Object)(object)val5 == (Object)null) && !((Object)(object)val5 == (Object)(object)t) && TryGetRendererShallow(val5, out var rend2, out var rendGo2)) { float num7 = 999f; try { bounds = rend2.bounds; extents = ((Bounds)(ref bounds)).extents; num7 = ((Vector3)(ref extents)).magnitude; } catch { num7 = 999f; } if (num7 > num3) { num3 = num7; val = rendGo2; val2 = rend2; } } } } if ((Object)(object)val == (Object)null) { GameObject val6 = null; try { val6 = ((Component)t).gameObject; } catch { val6 = null; } if ((Object)(object)val6 != (Object)null) { val = val6; } } bool flag = false; bool flag2 = false; float bumperRockExtentCap = GetBumperRockExtentCap(); bool flag3 = false; try { flag3 = IsBuildStationLike(t); } catch { flag3 = false; } float num8 = num2; if (flag3) { num8 = Mathf.Clamp(num2 * 3f, 6f, 18f); if (num8 < num2) { num8 = num2; } } if ((Object)(object)val2 != (Object)null) { try { flag2 = LooksLikeRockFast(val, val2, hitCol); } catch { flag2 = false; } float num9 = num3; flag = num9 <= (flag2 ? bumperRockExtentCap : num8); if (!flag) { try { flag = IsClosePhysicalObstacle(val); } catch { flag = false; } } } else { Collider val7 = hitCol; if ((Object)(object)val7 == (Object)null) { try { val7 = val.GetComponent(); } catch { val7 = null; } } if ((Object)(object)val7 != (Object)null) { try { flag2 = LooksLikeRockFast(val, null, val7); } catch { flag2 = false; } float num10 = 999f; try { bounds = val7.bounds; extents = ((Bounds)(ref bounds)).extents; num10 = ((Vector3)(ref extents)).magnitude; } catch { num10 = 999f; } flag = num10 <= (flag2 ? bumperRockExtentCap : num8); if (!flag) { try { flag = IsClosePhysicalObstacle(val); } catch { flag = false; } } } } if (!flag) { return null; } try { val = PromoteBumperTarget(val); } catch { } if ((Object)(object)hitCol != (Object)null) { int num11 = 0; try { num11 = ((Object)hitCol).GetInstanceID(); } catch { num11 = 0; } if (num11 != 0) { _bumperRenderRootByCollider[num11] = val; } } return val; } private static bool HasComponentNamedInParents(Transform t, string typeName) { if ((Object)(object)t == (Object)null || string.IsNullOrEmpty(typeName)) { return false; } Transform val = t; for (int i = 0; i < 10; i++) { if (!((Object)(object)val != (Object)null)) { break; } try { _tmpTypeComps.Clear(); ((Component)val).GetComponents(_tmpTypeComps); for (int j = 0; j < _tmpTypeComps.Count; j++) { Component val2 = _tmpTypeComps[j]; if (!((Object)(object)val2 == (Object)null) && ((object)val2).GetType().Name == typeName) { return true; } } } catch { } try { val = val.parent; } catch { val = null; } } return false; } private static bool HasComponentNamed(Transform t, string typeName) { if ((Object)(object)t == (Object)null || string.IsNullOrEmpty(typeName)) { return false; } try { _tmpTypeComps.Clear(); ((Component)t).GetComponents(_tmpTypeComps); for (int i = 0; i < _tmpTypeComps.Count; i++) { Component val = _tmpTypeComps[i]; if (!((Object)(object)val == (Object)null) && ((object)val).GetType().Name == typeName) { return true; } } } catch { } return false; } private static bool IsBuildStationLike(Transform t) { if ((Object)(object)t == (Object)null) { return false; } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if (HasComponentNamedInParents(t, "Kiln")) { return true; } } catch { } try { if (HasComponentNamedInParents(t, "EitrRefinery")) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if ((Object)(object)((Component)t).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { if (((Component)t).GetComponentInParent(true) != null) { return true; } } catch { } return false; } private static GameObject PromoteBumperTarget(GameObject go) { if ((Object)(object)go == (Object)null) { return null; } Transform val = null; try { val = go.transform; } catch { val = null; } if ((Object)(object)val == (Object)null) { return go; } int num = 0; try { num = ((Object)val).GetInstanceID(); } catch { num = 0; } float num2 = 0f; try { num2 = Time.time; } catch { num2 = 0f; } if (num != 0 && _promotionCache.TryGetValue(num, out var value)) { if ((Object)(object)value.Root != (Object)null && value.ExpiresAt > num2) { try { return ((Component)value.Root).gameObject; } catch { return go; } } _promotionCache.Remove(num); } Transform val2 = val; Transform val3 = val; int num3 = 0; while (num3 < 8 && (Object)(object)val3 != (Object)null) { try { if ((Object)(object)((Component)val3).GetComponent() != (Object)null) { val2 = val3; break; } if ((Object)(object)((Component)val3).GetComponent() != (Object)null) { val2 = val3; break; } if (HasComponentNamed(val3, "Kiln")) { val2 = val3; break; } if (HasComponentNamed(val3, "EitrRefinery")) { val2 = val3; break; } if ((Object)(object)((Component)val3).GetComponent() != (Object)null) { val2 = val3; break; } if ((Object)(object)((Component)val3).GetComponent() != (Object)null) { val2 = val3; break; } if ((Object)(object)((Component)val3).GetComponent() != (Object)null) { val2 = val3; break; } if (((Component)val3).GetComponent() != null) { val2 = val3; break; } goto IL_01c6; } catch { goto IL_01c6; } IL_01c6: try { val3 = val3.parent; } catch { val3 = null; } num3++; } if (num != 0) { CachedPromotion value2 = default(CachedPromotion); value2.Root = val2; value2.ExpiresAt = num2 + 2.5f; value2.AddedAt = num2; _promotionCache[num] = value2; PrunePromotionCacheIfNeeded(num2); } try { return ((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : go; } catch { return go; } } private static bool TryGetRendererShallow(Transform tr, out Renderer rend, out GameObject rendGo) { rend = null; rendGo = null; if ((Object)(object)tr == (Object)null) { return false; } try { rend = ((Component)tr).GetComponent(); } catch { rend = null; } if ((Object)(object)rend != (Object)null) { try { rendGo = ((Component)rend).gameObject; } catch { rendGo = null; } if ((Object)(object)rendGo != (Object)null) { return true; } } int num = 0; try { num = tr.childCount; } catch { num = 0; } int num2 = num; if (num2 > 24) { num2 = 24; } for (int i = 0; i < num2; i++) { Transform val = null; try { val = tr.GetChild(i); } catch { val = null; } if ((Object)(object)val == (Object)null) { continue; } try { rend = ((Component)val).GetComponent(); } catch { rend = null; } if ((Object)(object)rend != (Object)null) { try { rendGo = ((Component)rend).gameObject; } catch { rendGo = null; } if ((Object)(object)rendGo != (Object)null) { return true; } } } try { rend = ((Component)tr).GetComponentInChildren(true); } catch { rend = null; } if ((Object)(object)rend != (Object)null) { try { rendGo = ((Component)rend).gameObject; } catch { rendGo = null; } if ((Object)(object)rendGo != (Object)null) { return true; } } rend = null; rendGo = null; return false; } private static void TryBumperRendererBubble(Vector3 center, float range) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; Bounds bounds; if (time >= _nextRockRendererScanAt) { _nextRockRendererScanAt = time + 2f; _rockRendererCache.Clear(); Renderer[] array = null; try { array = Resources.FindObjectsOfTypeAll(); } catch { array = null; } if (array != null) { int num = array.Length; if (num > 6000) { num = 6000; } for (int i = 0; i < num; i++) { Renderer val = array[i]; if ((Object)(object)val == (Object)null || val is ParticleSystemRenderer || val is TrailRenderer || val is LineRenderer) { continue; } Transform val2 = null; try { val2 = ((Component)val).transform; } catch { val2 = null; } if ((Object)(object)val2 == (Object)null) { continue; } try { Scene scene = ((Component)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } } catch { } if (HasBadBumperAncestors(val2)) { continue; } bool flag = false; try { flag = LooksLikeVegetationRockName(((Component)val).gameObject) || LooksLikeStaticRockMaterial(val) || LooksLikeStaticRockComponent(val); } catch { flag = false; } if (!flag) { continue; } float num2 = 999f; try { bounds = val.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; num2 = ((Vector3)(ref extents)).magnitude; } catch { num2 = 999f; } float num3 = (LooksLikeVegetationRockName(((Component)val).gameObject) ? GetBumperVegetationRockExtentCap() : GetBumperRockExtentCap()); if (!(num2 > num3)) { _rockRendererCache.Add(val); if (_rockRendererCache.Count >= 2500) { break; } } } } } _lastRockRendererCacheCount = _rockRendererCache.Count; if (AccessibilityPlugin.CfgSilBumperRockDebug != null && AccessibilityPlugin.CfgSilBumperRockDebug.Value && time >= _nextRockDebugAt) { _nextRockDebugAt = time + 5f; try { if (_log != null) { _log.LogInfo((object)$"[Pix.Accessibility] RockRendererFallback cache={_lastRockRendererCacheCount}, nearby={_lastRockNearbyCount}, range={range:0.0}"); } else { Debug.Log((object)$"[Pix.Accessibility] RockRendererFallback cache={_lastRockRendererCacheCount}, nearby={_lastRockNearbyCount}, range={range:0.0}"); } } catch { } } if (_rockRendererCache.Count == 0) { return; } _bNearestRenderers.Clear(); Vector3 p = center; float num4 = range * range; for (int j = 0; j < _rockRendererCache.Count; j++) { Renderer val3 = _rockRendererCache[j]; if ((Object)(object)val3 == (Object)null) { continue; } Vector3 center2; try { bounds = val3.bounds; center2 = ((Bounds)(ref bounds)).center; } catch { continue; } Vector3 val4 = center2 - p; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; if (sqrMagnitude > num4) { continue; } GameObject val5 = null; try { val5 = ChooseRockRendererRoot(val3); } catch { val5 = null; } if (!((Object)(object)val5 == (Object)null)) { _bNearestRenderers.Add(val5); if (_bNearestRenderers.Count >= 24) { break; } } } _lastRockNearbyCount = _bNearestRenderers.Count; if (_bNearestRenderers.Count != 0) { _bNearestRenderers.Sort(delegate(GameObject a, GameObject b) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 val6 = a.transform.position - p; float sqrMagnitude2 = ((Vector3)(ref val6)).sqrMagnitude; val6 = b.transform.position - p; float sqrMagnitude3 = ((Vector3)(ref val6)).sqrMagnitude; return sqrMagnitude2.CompareTo(sqrMagnitude3); }); int num5 = _bNearestRenderers.Count; if (num5 > 10) { num5 = 10; } for (int k = 0; k < num5; k++) { AddBumperWanted(_bNearestRenderers[k]); } } } private static GameObject ChooseRockRendererRoot(Renderer leaf) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)leaf == (Object)null) { return null; } bool flag = false; try { if ((Object)(object)((Component)leaf).GetComponentInParent(true) != (Object)null) { flag = true; } else if ((Object)(object)((Component)leaf).GetComponentInParent(true) != (Object)null) { flag = true; } else if ((Object)(object)((Component)leaf).GetComponentInParent(true) != (Object)null) { flag = true; } } catch { flag = false; } if (!flag) { try { return ((Component)leaf).gameObject; } catch { } } Transform val = null; try { val = ((Component)leaf).transform; } catch { val = null; } if ((Object)(object)val == (Object)null) { return null; } bool flag2 = false; try { flag2 = LooksLikeVegetationRockName(((Component)leaf).gameObject); } catch { flag2 = false; } float num = (flag2 ? GetBumperVegetationRockExtentCap() : GetBumperRockExtentCap()); GameObject gameObject = ((Component)leaf).gameObject; float num2 = float.MaxValue; Transform val2 = val; for (int i = 0; i < 7; i++) { if (!((Object)(object)val2 != (Object)null)) { break; } if (HasBadBumperAncestors(val2)) { break; } Renderer[] array = null; try { array = ((Component)val2).GetComponentsInChildren(true); } catch { array = null; } if (array == null || array.Length == 0) { val2 = val2.parent; continue; } if (array.Length > 96) { val2 = val2.parent; continue; } Bounds val3 = default(Bounds); bool flag3 = false; int num3 = array.Length; if (num3 > 64) { num3 = 64; } for (int j = 0; j < num3; j++) { Renderer val4 = array[j]; if ((Object)(object)val4 == (Object)null || val4 is ParticleSystemRenderer || val4 is TrailRenderer || val4 is LineRenderer) { continue; } try { if (!flag3) { val3 = val4.bounds; flag3 = true; } else { ((Bounds)(ref val3)).Encapsulate(val4.bounds); } } catch { } } if (!flag3) { val2 = val2.parent; continue; } float num4 = 999f; try { Vector3 extents = ((Bounds)(ref val3)).extents; num4 = ((Vector3)(ref extents)).magnitude; } catch { num4 = 999f; } if (num4 > num) { val2 = val2.parent; continue; } bool flag4 = false; try { flag4 = (Object)(object)((Component)val2).GetComponent() != (Object)null; } catch { flag4 = false; } float num5 = num4 + (float)array.Length * 0.02f + (flag4 ? (-0.25f) : 0f); if (num5 < num2) { num2 = num5; gameObject = ((Component)val2).gameObject; } val2 = val2.parent; } return gameObject; } private static void AddBumperWanted(GameObject go) { //IL_006a: 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_00a4: 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_00d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null || !GetCfgBool(AccessibilityPlugin.CfgSilBumperEnabled, fallback: true)) { return; } int num = ClassifyTarget(go); if (num == 0) { if ((Object)(object)_bumperMat == (Object)null) { _bumperMat = BuildSilhouetteMaterial(ComputePresetColor(new Color((AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.r : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.g : 1f, (AccessibilityPlugin.CfgSilBumperColor != null) ? AccessibilityPlugin.CfgSilBumperColor.Value.b : 1f, 0.45f), GetCfgString(AccessibilityPlugin.CfgBumperColorPreset, "Custom"), GetCfgFloat(AccessibilityPlugin.CfgBumperIntensity, 1f))); } int instanceID = ((Object)go).GetInstanceID(); _bWanted.Add(instanceID); if (!_bumperByKey.ContainsKey(instanceID)) { float shellScale = 1.0125f; CloneEntry cloneEntry = CreateCloneEntry(instanceID, go, _bumperMat, shellScale); if (cloneEntry != null) { _bumperByKey[instanceID] = cloneEntry; cloneEntry.Clone.SetActive(true); SyncCloneTransform(cloneEntry.Source, cloneEntry.Clone); } } return; } bool flag = GetCfgBool(AccessibilityPlugin.CfgBumperPickupsEnabled, fallback: false) && AccessibilityPlugin.RtPickupsEnabled; bool flag2 = GetCfgBool(AccessibilityPlugin.CfgBumperInteractablesEnabled, fallback: false) && AccessibilityPlugin.RtInteractablesEnabled; bool flag3 = GetCfgBool(AccessibilityPlugin.CfgBumperCreaturesEnabled, fallback: true) && AccessibilityPlugin.RtCreaturesEnabled; Material bumperMat = _bumperMat; switch (num) { case 1: if (!flag) { return; } bumperMat = (((Object)(object)_bumperMatPickups != (Object)null) ? _bumperMatPickups : _bumperMat); break; case 2: if (!flag2) { return; } bumperMat = (((Object)(object)_bumperMatInteractables != (Object)null) ? _bumperMatInteractables : _bumperMat); break; case 3: if (!flag3) { return; } bumperMat = _bumperMat; break; default: return; } int instanceID2 = ((Object)go).GetInstanceID(); _bWanted.Add(instanceID2); if (!_bumperByKey.ContainsKey(instanceID2)) { float shellScale2 = 1.0125f; CloneEntry cloneEntry2 = CreateCloneEntry(instanceID2, go, bumperMat, shellScale2); if (cloneEntry2 != null) { _bumperByKey[instanceID2] = cloneEntry2; cloneEntry2.Clone.SetActive(true); SyncCloneTransform(cloneEntry2.Source, cloneEntry2.Clone); } } } private static void AddWanted(GameObject go) { AddWanted(go, _mat); } private static void AddWanted(GameObject go, Material mat) { if ((Object)(object)go == (Object)null) { return; } int instanceID = ((Object)go).GetInstanceID(); _wanted.Add(instanceID); if (_clonesByKey.TryGetValue(instanceID, out var _)) { return; } int num = 280; int num2 = 16; try { if (AccessibilityPlugin.CfgSilMaxTotalClones != null) { num = Mathf.Clamp(AccessibilityPlugin.CfgSilMaxTotalClones.Value, 32, 2000); } } catch { } try { if (AccessibilityPlugin.CfgSilMaxNewClonesPerTick != null) { num2 = Mathf.Clamp(AccessibilityPlugin.CfgSilMaxNewClonesPerTick.Value, 1, 200); } } catch { } if (_clonesByKey.Count >= num || _createdThisTick >= num2) { _pendingCreates[instanceID] = new PendingCreate { Key = instanceID, Source = go, Mat = mat, ShellScale = GetShellScaleFor(go) }; return; } float shellScaleFor = GetShellScaleFor(go); CloneEntry cloneEntry = CreateCloneEntry(instanceID, go, mat, shellScaleFor); if (cloneEntry != null) { _createdThisTick++; _clonesByKey[instanceID] = cloneEntry; cloneEntry.Clone.SetActive(true); SyncClone(cloneEntry); } } private static CloneEntry CreateCloneEntry(int key, GameObject source, Material mat, float shellScale) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_00ef: Expected O, but got Unknown if ((Object)(object)source == (Object)null) { return null; } GameObject val = new GameObject("PX_Silhouette_" + ((Object)source).name); val.transform.SetParent(_root, false); val.layer = 0; Renderer[] componentsInChildren = source.GetComponentsInChildren(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { Object.Destroy((Object)(object)val); return null; } List list = new List(componentsInChildren.Length); List list2 = new List(componentsInChildren.Length); List list3 = new List(componentsInChildren.Length); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if ((Object)(object)val2 == (Object)null || val2 is ParticleSystemRenderer || val2 is TrailRenderer || val2 is LineRenderer) { continue; } GameObject val3 = new GameObject("r_" + i); val3.transform.SetParent(val.transform, false); val3.layer = 0; try { CopyRelativeTransform(source.transform, ((Component)val2).transform, val3.transform); } catch { } try { list2.Add(((Component)val2).transform); } catch { } try { list3.Add(val3.transform); } catch { } SkinnedMeshRenderer val4 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); if ((Object)(object)val4 != (Object)null) { SkinnedMeshRenderer val5 = val3.AddComponent(); try { val5.sharedMesh = val4.sharedMesh; val5.bones = val4.bones; val5.rootBone = val4.rootBone; val5.updateWhenOffscreen = true; try { Bounds localBounds = ((Renderer)val5).localBounds; ((Bounds)(ref localBounds)).extents = ((Bounds)(ref localBounds)).extents * 3f; ((Renderer)val5).localBounds = localBounds; } catch { } ApplySilhouetteMaterials((Renderer)(object)val5, mat); list.Add((Renderer)(object)val5); } catch { try { Object.Destroy((Object)(object)val5); } catch { } try { Object.Destroy((Object)(object)val3); } catch { } } continue; } MeshRenderer val6 = (MeshRenderer)(object)((val2 is MeshRenderer) ? val2 : null); if ((Object)(object)val6 != (Object)null) { MeshFilter val7 = null; try { val7 = ((Component)val6).GetComponent(); } catch { val7 = null; } if ((Object)(object)val7 == (Object)null || (Object)(object)val7.sharedMesh == (Object)null) { Object.Destroy((Object)(object)val3); continue; } MeshFilter val8 = val3.AddComponent(); val8.sharedMesh = val7.sharedMesh; MeshRenderer val9 = val3.AddComponent(); ApplySilhouetteMaterials((Renderer)(object)val9, mat); list.Add((Renderer)(object)val9); } else { Object.Destroy((Object)(object)val3); } } if (list.Count == 0) { Object.Destroy((Object)(object)val); return null; } val.transform.localScale = Vector3.one * shellScale; return new CloneEntry { Key = key, Source = source, Clone = val, CloneRenderers = list.ToArray(), SourceRendererTransforms = list2.ToArray(), CloneRendererTransforms = list3.ToArray(), ShellScale = shellScale }; } private static void CopyRelativeTransform(Transform srcRoot, Transform src, Transform dst) { //IL_007f: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)srcRoot == (Object)null || (Object)(object)src == (Object)null || (Object)(object)dst == (Object)null) { return; } try { dst.localPosition = srcRoot.InverseTransformPoint(src.position); } catch { } try { dst.localRotation = Quaternion.Inverse(srcRoot.rotation) * src.rotation; } catch { } try { Vector3 one = Vector3.one; try { one = srcRoot.lossyScale; } catch { one = Vector3.one; } Vector3 one2 = Vector3.one; try { one2 = src.lossyScale; } catch { one2 = Vector3.one; } float num = ((Mathf.Abs(one.x) > 0.0001f) ? (one2.x / one.x) : 1f); float num2 = ((Mathf.Abs(one.y) > 0.0001f) ? (one2.y / one.y) : 1f); float num3 = ((Mathf.Abs(one.z) > 0.0001f) ? (one2.z / one.z) : 1f); dst.localScale = new Vector3(num, num2, num3); } catch { } } private static void SyncClone(CloneEntry entry) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (entry == null || (Object)(object)entry.Source == (Object)null || (Object)(object)entry.Clone == (Object)null) { return; } Transform transform = entry.Source.transform; Transform transform2 = entry.Clone.transform; transform2.position = transform.position; transform2.rotation = transform.rotation; transform2.localScale = Vector3.one * entry.ShellScale; if (entry.SourceRendererTransforms == null || entry.CloneRendererTransforms == null) { return; } int num = entry.SourceRendererTransforms.Length; if (entry.CloneRendererTransforms.Length < num) { num = entry.CloneRendererTransforms.Length; } for (int i = 0; i < num; i++) { Transform val = entry.SourceRendererTransforms[i]; Transform val2 = entry.CloneRendererTransforms[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { CopyRelativeTransform(transform, val, val2); } } } private static void SyncCloneTransform(GameObject source, GameObject clone) { //IL_002a: 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) if (!((Object)(object)source == (Object)null) && !((Object)(object)clone == (Object)null)) { Transform transform = source.transform; Transform transform2 = clone.transform; transform2.position = transform.position; transform2.rotation = transform.rotation; } } private static Material BuildSilhouetteMaterial(Color color) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_00a3: Expected O, but got Unknown Shader val = null; try { val = Shader.Find("Unlit/Color"); } catch { val = null; } if ((Object)(object)val == (Object)null) { try { val = Shader.Find("UI/Default"); } catch { val = null; } } if ((Object)(object)val == (Object)null) { try { val = Shader.Find("Sprites/Default"); } catch { val = null; } } if ((Object)(object)val == (Object)null) { try { val = Shader.Find("Standard"); } catch { val = null; } } if ((Object)(object)val == (Object)null) { val = Shader.Find("Diffuse"); } Material val2 = new Material(val); try { val2.renderQueue = 4000; } catch { } TrySetColor(val2, "_Color", color); TrySetColor(val2, "_BaseColor", color); TrySetColor(val2, "_TintColor", color); TrySetInt(val2, "_ZTest", 8); TrySetInt(val2, "_ZWrite", 0); TrySetInt(val2, "_Cull", 0); TryEnableKeyword(val2, "_EMISSION"); TrySetColor(val2, "_EmissionColor", new Color(color.r * 2.5f, color.g * 2.5f, color.b * 2.5f, 1f)); return val2; } private static void ApplySilhouetteMaterials(Renderer r, Material mat) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)r == (Object)null) { return; } Color val = SilhouetteColor; try { if (AccessibilityPlugin.CfgSilOutlineColor != null) { val = AccessibilityPlugin.CfgSilOutlineColor.Value; } } catch { } string text = "Custom"; try { if (AccessibilityPlugin.CfgSilhouetteColorPreset != null) { text = AccessibilityPlugin.CfgSilhouetteColorPreset.Value; } } catch { } Color val2 = default(Color); switch (text) { case "Magenta": ((Color)(ref val2))..ctor(1f, 0f, 1f, val.a); break; case "Cyan": ((Color)(ref val2))..ctor(0f, 1f, 1f, val.a); break; case "Yellow": ((Color)(ref val2))..ctor(1f, 1f, 0f, val.a); break; case "Red": ((Color)(ref val2))..ctor(1f, 0f, 0f, val.a); break; default: val2 = val; break; } float num = 1f; try { if (AccessibilityPlugin.CfgSilhouetteIntensity != null) { num = AccessibilityPlugin.CfgSilhouetteIntensity.Value; } } catch { } ((Color)(ref val2))..ctor(val2.r * num, val2.g * num, val2.b * num, val2.a); if ((Object)(object)_mat == (Object)null) { _mat = BuildSilhouetteMaterial(val2); } if ((Object)(object)mat == (Object)null) { mat = _mat; } try { Material[] sharedMaterials = r.sharedMaterials; int num2 = ((sharedMaterials == null || sharedMaterials.Length == 0) ? 1 : sharedMaterials.Length); Material[] array = (Material[])(object)new Material[num2]; for (int i = 0; i < num2; i++) { array[i] = mat; } r.sharedMaterials = array; } catch { try { r.sharedMaterial = mat; } catch { } } try { r.shadowCastingMode = (ShadowCastingMode)0; } catch { } try { r.receiveShadows = false; } catch { } } private static void TrySetColor(Material m, string prop, Color c) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)m != (Object)null && m.HasProperty(prop)) { m.SetColor(prop, c); } } catch { } } private static void TrySetInt(Material m, string prop, int v) { try { if ((Object)(object)m != (Object)null && m.HasProperty(prop)) { m.SetInt(prop, v); } } catch { } } private static void TryEnableKeyword(Material m, string kw) { try { if ((Object)(object)m != (Object)null) { m.EnableKeyword(kw); } } catch { } } private static void TryStaticRockBoost(Player p) { if ((Object)(object)p == (Object)null || AccessibilityPlugin.CfgSilStaticRockBoost == null || AccessibilityPlugin.CfgSilStaticRockBoostIntensity == null) { return; } bool value = AccessibilityPlugin.CfgSilStaticRockBoost.Value; float time = Time.time; if (!value) { if (_staticRockBoostWasOn) { RestoreStaticRockMaterials(); } _staticRockBoostWasOn = false; return; } _staticRockBoostWasOn = true; if (!(time < _nextStaticRockBoostAt)) { _nextStaticRockBoostAt = time + 2f; float mul = Mathf.Clamp(AccessibilityPlugin.CfgSilStaticRockBoostIntensity.Value, 1f, 8f); ApplyStaticRockBoost(mul); } } private static void ApplyStaticRockBoost(float mul) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) Material[] array = null; try { array = Resources.FindObjectsOfTypeAll(); } catch { array = null; } if (array == null || array.Length == 0) { return; } int num = array.Length; if (num > 20000) { num = 20000; } for (int i = 0; i < num; i++) { Material val = array[i]; if ((Object)(object)val == (Object)null || !IsStaticRockMaterial(val)) { continue; } if (!_staticRockOrig.ContainsKey(val)) { MaterialState value = default(MaterialState); if (val.HasProperty("_Color")) { value.HasColor = true; try { value.Color = val.GetColor("_Color"); } catch { value.Color = Color.white; } } else if (val.HasProperty("_BaseColor")) { value.HasColor = true; try { value.Color = val.GetColor("_BaseColor"); } catch { value.Color = Color.white; } } if (val.HasProperty("_EmissionColor")) { value.HasEmission = true; try { value.Emission = val.GetColor("_EmissionColor"); } catch { value.Emission = Color.black; } } try { value.EmissionKeyword = val.IsKeywordEnabled("_EMISSION"); } catch { value.EmissionKeyword = false; } _staticRockOrig[val] = value; } try { if (val.HasProperty("_Color")) { Color color = val.GetColor("_Color"); val.SetColor("_Color", new Color(Mathf.Clamp01(color.r * mul), Mathf.Clamp01(color.g * mul), Mathf.Clamp01(color.b * mul), color.a)); } else if (val.HasProperty("_BaseColor")) { Color color2 = val.GetColor("_BaseColor"); val.SetColor("_BaseColor", new Color(Mathf.Clamp01(color2.r * mul), Mathf.Clamp01(color2.g * mul), Mathf.Clamp01(color2.b * mul), color2.a)); } } catch { } try { if (!val.HasProperty("_EmissionColor")) { continue; } Color val2 = val.GetColor("_EmissionColor"); if (((Color)(ref val2)).maxColorComponent < 0.02f) { Color val3 = Color.gray; if (val.HasProperty("_Color")) { val3 = val.GetColor("_Color"); } else if (val.HasProperty("_BaseColor")) { val3 = val.GetColor("_BaseColor"); } val2 = val3 * 0.15f; } val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", val2 * mul); } catch { } } } private static void RestoreStaticRockMaterials() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair item in _staticRockOrig) { Material key = item.Key; if ((Object)(object)key == (Object)null) { continue; } MaterialState value = item.Value; try { if (value.HasColor) { if (key.HasProperty("_Color")) { key.SetColor("_Color", value.Color); } else if (key.HasProperty("_BaseColor")) { key.SetColor("_BaseColor", value.Color); } } } catch { } try { if (value.HasEmission && key.HasProperty("_EmissionColor")) { key.SetColor("_EmissionColor", value.Emission); } } catch { } try { if (value.EmissionKeyword) { key.EnableKeyword("_EMISSION"); } else { key.DisableKeyword("_EMISSION"); } } catch { } } _staticRockOrig.Clear(); } private static bool IsStaticRockMaterial(Material m) { if ((Object)(object)m == (Object)null) { return false; } try { Shader shader = m.shader; if ((Object)(object)shader != (Object)null) { string name = ((Object)shader).name; if (!string.IsNullOrEmpty(name) && name.IndexOf("Custom/StaticRock", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } try { string name2 = ((Object)m).name; if (!string.IsNullOrEmpty(name2)) { string text = name2.ToLowerInvariant(); if (text.Contains("staticrock") || text.Contains(" rock") || text.Contains("rock_") || text.Contains("_rock") || text.Contains("stone") || text.Contains("cliff") || text.Contains("blackmarble")) { return true; } } } catch { } return false; } private static bool LooksLikeStaticRockComponent(Renderer r) { if ((Object)(object)r == (Object)null) { return false; } try { if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return true; } if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return true; } } catch { } try { StaticPhysics componentInParent = ((Component)r).GetComponentInParent(true); if ((Object)(object)componentInParent == (Object)null) { return false; } if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return false; } if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return false; } if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return false; } if ((Object)(object)((Component)r).GetComponentInParent(true) != (Object)null) { return false; } return true; } catch { } return false; } }