Decompiled source of SunMirror v0.1.22

plugins/Roman.SunMirror.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using Peak.Network;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Roman.SunMirror")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.22.0")]
[assembly: AssemblyInformationalVersion("0.1.22+6167775ce0876eff6cc80f28cc6da72000280dd2")]
[assembly: AssemblyProduct("Roman.SunMirror")]
[assembly: AssemblyTitle("SunMirror")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.22.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace SunMirror
{
	internal sealed class Billboard : MonoBehaviour
	{
		public float frontOffset = 0.05f;

		public bool allowed;

		private Renderer? _r;

		private Renderer? _mirrorRend;

		private void Awake()
		{
			_r = ((Component)this).GetComponent<Renderer>();
			if ((Object)(object)((Component)this).transform.parent != (Object)null)
			{
				_mirrorRend = ((Component)((Component)this).transform.parent).GetComponent<Renderer>();
			}
		}

		private void LateUpdate()
		{
			//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_006d: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_010c: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: 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)
			Camera val = (Camera)(((Object)(object)Plugin.Instance != (Object)null) ? ((object)Plugin.Instance.ActiveCamera()) : ((object)Camera.main));
			if ((Object)(object)val == (Object)null || (Object)(object)((Component)this).transform.parent == (Object)null)
			{
				return;
			}
			Transform parent = ((Component)this).transform.parent;
			Vector3 val2;
			if (!((Object)(object)_mirrorRend != (Object)null))
			{
				val2 = parent.position;
			}
			else
			{
				Bounds bounds = _mirrorRend.bounds;
				val2 = ((Bounds)(ref bounds)).center;
			}
			Vector3 val3 = val2;
			Vector3? val4 = (((Object)(object)Plugin.Instance != (Object)null) ? Plugin.Instance.GlareAimPoint : ((Vector3?)null));
			Vector3 val6;
			if (val4.HasValue)
			{
				Vector3 val5 = val4.Value - val3;
				if (((Vector3)(ref val5)).sqrMagnitude > 0.0001f)
				{
					val5 = val4.Value - val3;
					val6 = ((Vector3)(ref val5)).normalized;
					goto IL_0126;
				}
			}
			Character localCharacter = Character.localCharacter;
			Vector3 val7 = (((Object)(object)localCharacter != (Object)null) ? ((Component)localCharacter).transform.position : ((Component)val).transform.position);
			val6 = parent.forward;
			if (Vector3.Dot(val6, val3 - val7) < 0f)
			{
				val6 = -val6;
			}
			goto IL_0126;
			IL_0126:
			Vector3 val8 = ((Component)val).transform.position - val3;
			bool flag = (Object)(object)Plugin.Instance != (Object)null && Plugin.Instance.DebugLayerHidesGlint;
			bool flag2 = allowed && !flag && Vector3.Dot(val8, val6) > 0f;
			if ((Object)(object)_r != (Object)null && _r.enabled != flag2)
			{
				_r.enabled = flag2;
			}
			if (flag2)
			{
				((Component)this).transform.position = val3 + val6 * frontOffset;
				((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)val).transform.position, ((Component)val).transform.up);
			}
		}
	}
	internal sealed class FaceCamera : MonoBehaviour
	{
		private void LateUpdate()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			Camera val = (Camera)(((Object)(object)Plugin.Instance != (Object)null) ? ((object)Plugin.Instance.ActiveCamera()) : ((object)Camera.main));
			if (!((Object)(object)val == (Object)null))
			{
				((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)val).transform.position, ((Component)val).transform.up);
			}
		}
	}
	internal sealed class StarsSpinner : MonoBehaviour
	{
		public float speed = 180f;

		public float lifetime = 5f;

		private float _t;

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.Rotate(Vector3.up, speed * Time.deltaTime, (Space)0);
			_t += Time.deltaTime;
			if (_t >= lifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	[BepInPlugin("Roman.SunMirror", "SunMirror", "0.1.22")]
	public class Plugin : BaseUnityPlugin
	{
		private sealed class BlindState
		{
			public float until;

			public float beganAt;

			public float emoteStarted;

			public bool posePinned;

			public bool forcePrev;

			public string emoteState = "";

			public CharacterMovement? mv;

			public float moveModPrev = 1f;

			public float nextWobbleAt;

			public float wobbleSide = 1f;

			public float nextEmoteAt;

			public bool emoteOnB;

			public readonly List<(Material mat, string prop, Texture? tex)> faceBackup = new List<(Material, string, Texture)>();
		}

		internal static Plugin Instance = null;

		private ConfigEntry<Key> _equipKey;

		private ConfigEntry<Key> _useKey;

		private ConfigEntry<Key> _selfTestKey;

		private ConfigEntry<Key> _thirdPersonKey;

		private ConfigEntry<Key> _giveKey;

		private bool _itemsLogged;

		private bool _lmbLogged;

		private bool _useKeyLogged;

		private float _lastSpotMissLog;

		private bool _holdingMirror;

		private int _debugLayer;

		private const int MirrorLayer = 31;

		private ConfigEntry<bool> _reskinEnabled;

		private ConfigEntry<float> _reskinScale;

		private ConfigEntry<float> _rOffX;

		private ConfigEntry<float> _rOffY;

		private ConfigEntry<float> _rOffZ;

		private ConfigEntry<float> _rYaw;

		private ConfigEntry<float> _rPitch;

		private ConfigEntry<float> _rRoll;

		private ConfigEntry<bool> _glintOn;

		private ConfigEntry<float> _glintSize;

		private ConfigEntry<float> _glintFlashMul;

		private Transform? _glintTf;

		private Vector3 _glintBaseScale = Vector3.one;

		private ConfigEntry<float> _viewLowerY;

		private ConfigEntry<float> _viewFwd;

		private ConfigEntry<float> _discTilt;

		private ConfigEntry<bool> _realMirrorOn;

		private ConfigEntry<int> _realMirrorRes;

		private ConfigEntry<int> _realMirrorEvery;

		private ConfigEntry<bool> _reflProbeOn;

		private ConfigEntry<float> _reflRefresh;

		private ConfigEntry<int> _reflRes;

		private ReflectionProbe? _probe;

		private float _probeTimer;

		private Transform? _discMesh;

		private GameObject? _cloneGo;

		private readonly List<(Item item, GameObject model)> _reskins = new List<(Item, GameObject)>();

		private ConfigEntry<float> _tpDistance;

		private ConfigEntry<float> _range;

		private ConfigEntry<float> _spotSize;

		private ConfigEntry<float> _spread;

		private ConfigEntry<float> _spotGlow;

		private ConfigEntry<float> _heightFactor;

		private ConfigEntry<float> _smooth;

		private ConfigEntry<bool> _showSprite;

		private ConfigEntry<bool> _requireSun;

		private ConfigEntry<float> _fallSeconds;

		private ConfigEntry<float> _fallShake;

		private ConfigEntry<bool> _fallAtMax;

		private ConfigEntry<bool> _applyStatuses;

		private ConfigEntry<float> _sporesAmount;

		private ConfigEntry<float> _drowsyAmount;

		private ConfigEntry<float> _glareStrength;

		private float _glareAlpha;

		private float _lastLocalHitTime = -999f;

		private Vector3 _glareSourcePos;

		private bool _glareSourceValid;

		private ConfigEntry<bool> _useEmote;

		private ConfigEntry<string> _emoteName;

		private ConfigEntry<float> _stunDelay;

		private ConfigEntry<bool> _blindOn;

		private ConfigEntry<bool> _selfTarget;

		private ConfigEntry<float> _rigAimTime;

		private ConfigEntry<float> _blindAfflictionSeconds;

		private ConfigEntry<bool> _nativeBlindOnSelf;

		private ConfigEntry<float> _spriteBright;

		private ConfigEntry<float> _ringStrength;

		private ConfigEntry<string> _blindMouth;

		private ConfigEntry<float> _poseFreezeAt;

		private ConfigEntry<float> _poseSwing;

		private ConfigEntry<float> _poseSwingSpeed;

		private ConfigEntry<float> _netSendEvery;

		private ConfigEntry<bool> _flinch;

		private ConfigEntry<bool> _debugKeys;

		private ConfigEntry<bool> _autoJoinRoom;

		private ConfigEntry<bool> _freezeNoon;

		private string? _guestUserId;

		private string _handshakeRegion = "";

		private ConfigEntry<float> _signalGrow;

		private ConfigEntry<float> _signalMax;

		private ConfigEntry<float> _signalLightBright;

		private float _spotLitSmooth;

		private int _glowStage;

		private ConfigEntry<float> _beamLinger;

		private ConfigEntry<float> _maxBlind;

		private ConfigEntry<float> _cooldown;

		private ConfigEntry<bool> _eyesOnly;

		private ConfigEntry<bool> _poseLoop;

		private ConfigEntry<float> _reactionEvery;

		private ConfigEntry<float> _chargeDrain;

		private ConfigEntry<bool> _rootVictim;

		private ConfigEntry<bool> _spiralEyesNet;

		private ConfigEntry<float> _rootRepeat;

		private ConfigEntry<float> _rootFallShake;

		private ConfigEntry<string> _blindStatusType;

		private ConfigEntry<float> _blindStatusAmount;

		private ConfigEntry<float> _lightReach;

		private ConfigEntry<bool> _useLight;

		private ConfigEntry<bool> _backPlate;

		private ConfigEntry<bool> _ownIcon;

		private ConfigEntry<string> _prefabFilter;

		private ConfigEntry<float> _prefabDumpAtStart;

		private ConfigEntry<string> _userIdSuffix;

		private ConfigEntry<bool> _autoBlind;

		private ConfigEntry<float> _autoBlindRange;

		private float _prefabDumpAt = -1f;

		private ConfigEntry<float> _backPlateGap;

		private ConfigEntry<float> _backPlateScale;

		private static Texture2D? _idleTex;

		private static Texture2D? _backTex;

		private static Texture2D? _iconTex;

		private Transform? _backPlateTf;

		private bool _iconReplaced;

		private ConfigEntry<float> _selfBlindDelay;

		private float _selfBlindAt = -1f;

		private ConfigEntry<float> _flashEmission;

		private ConfigEntry<float> _flashPulse;

		private ConfigEntry<float> _flashPulseSpeed;

		private ConfigEntry<float> _synthVolume;

		private ConfigEntry<float> _synthPitch;

		private ConfigEntry<float> _emoteFirstHold;

		private readonly Dictionary<int, (float charge, float at)> _blindCharge = new Dictionary<int, (float, float)>();

		private readonly Dictionary<int, float> _reactionAt = new Dictionary<int, float>();

		private readonly Dictionary<int, float> _rootAt = new Dictionary<int, float>();

		private readonly Dictionary<int, Vector3> _rootAnchor = new Dictionary<int, Vector3>();

		private ConfigEntry<float> _poseLoopSpeed;

		private ConfigEntry<float> _poseLoopSpan;

		private ConfigEntry<string> _mirrorItemName;

		private ConfigEntry<string> _sfxFilter;

		private ConfigEntry<float> _eyesRadius;

		private ConfigEntry<float> _flinchForce;

		private ConfigEntry<float> _wobbleForce;

		private ConfigEntry<float> _wobbleEvery;

		private ConfigEntry<float> _shakeOffForce;

		private ConfigEntry<float> _staggerForce;

		private ConfigEntry<string> _emoteB;

		private ConfigEntry<string> _blindSfx;

		private ConfigEntry<float> _emoteSwapEvery;

		private string _emoteState = "";

		private ConfigEntry<bool> _showModel;

		private ConfigEntry<float> _targetSize;

		private ConfigEntry<float> _heldScale;

		private ConfigEntry<float> _offX;

		private ConfigEntry<float> _offY;

		private ConfigEntry<float> _offZ;

		private ConfigEntry<float> _yaw;

		private ConfigEntry<float> _pitch;

		private ConfigEntry<float> _roll;

		private GameObject? _mirrorPrototype;

		private GameObject? _held;

		private GameObject? _spotQuad;

		private GameObject? _spotLightGo;

		private GameObject? _signal;

		private bool _botBlindsMe;

		private Character? _botAttacker;

		private GameObject? _botDisc;

		private Harmony? _harmony;

		private Light? _spotLight;

		private Light? _signalLight;

		private Material[]? _heldMats;

		private Camera? _tpCam;

		private bool _tpActive;

		private float _selfDemoUntil;

		private bool _emotesLogged;

		private Vector3 _spotPos;

		private bool _spotHasPos;

		private float _lastSunLog;

		private Character? _victim;

		private float _fpsAccum;

		private int _fpsFrames;

		private float _selfMs;

		private Texture2D? _reflTex;

		private Texture2D? _flareTex;

		private int _lastShiftFrame = -1;

		private Transform? _handL;

		private Transform? _handR;

		private GameObject? _testRig;

		private bool _rigAiming;

		private float _rigAim;

		private float _cloneTimer;

		private float _lastHoldLog;

		private readonly HashSet<int> _mirroredCovers = new HashSet<int>();

		private Camera? _mirrorCam;

		private RenderTexture? _mirrorRT;

		private Material? _mirrorMat;

		private int _mirrorFrame;

		private Material? _donorMat;

		private bool _donorSearched;

		private Transform? _tiltPivot;

		private static readonly Dictionary<char, string[]> Glyphs = new Dictionary<char, string[]>
		{
			['S'] = new string[7] { "01111", "10000", "10000", "01110", "00001", "00001", "11110" },
			['I'] = new string[7] { "11111", "00100", "00100", "00100", "00100", "00100", "11111" },
			['G'] = new string[7] { "01110", "10001", "10000", "10111", "10001", "10001", "01110" },
			['N'] = new string[7] { "10001", "11001", "11001", "10101", "10011", "10011", "10001" },
			['A'] = new string[7] { "01110", "10001", "10001", "11111", "10001", "10001", "10001" },
			['L'] = new string[7] { "10000", "10000", "10000", "10000", "10000", "10000", "11111" },
			['M'] = new string[7] { "10001", "11011", "10101", "10101", "10001", "10001", "10001" },
			['R'] = new string[7] { "11110", "10001", "10001", "11110", "10100", "10010", "10001" },
			['O'] = new string[7] { "01110", "10001", "10001", "10001", "10001", "10001", "01110" },
			[' '] = new string[7] { "00000", "00000", "00000", "00000", "00000", "00000", "00000" }
		};

		private bool _emotePlayed;

		private float _spotDbgAt;

		private static Texture2D? _ringTex;

		private static Texture2D? _circleTex;

		private static Texture2D? _spotTex;

		private readonly Dictionary<Character, BlindState> _blinds = new Dictionary<Character, BlindState>();

		private bool _lockLook;

		private Quaternion _lockedRot;

		private Character? _lastEmoteVictim;

		private float _lastEmoteTime = -99f;

		private ConfigEntry<float> _poseFreezeDelay;

		private ConfigEntry<float> _blindHoldSeconds;

		private readonly Dictionary<int, float> _cooldownUntil = new Dictionary<int, float>();

		private float _lastEyesLog;

		private float _netTick;

		private float _netSendAt;

		private Character? _lastNetLogged;

		private static readonly string[] OurComponentTypes = new string[2] { "SunMirrorNet", "SunMirrorDummy" };

		private const string ModPlayerProp = "SunMirror";

		private string? _markedRoom;

		private const float RootAnchorMax = 2.5f;

		private string _lastItemLogged = "";

		private readonly List<string> _sfxCandidates = new List<string>();

		private int _sfxPick = -1;

		private string _sfxFilterUsed = "\0";

		private static readonly string[] SynthPresets = new string[6] { "shing", "sparkle", "bell", "wobble", "zap", "hum" };

		private readonly Dictionary<string, SFX_Instance> _synthCache = new Dictionary<string, SFX_Instance>();

		private static SFX_Instance? _sfxCache;

		private static string _sfxCacheName = "";

		private readonly List<Character> _blindScratch = new List<Character>();

		private Character? _autoBlindLast;

		public const string Id = "Roman.SunMirror";

		internal static ManualLogSource Log { get; private set; } = null;

		internal bool DebugLayerHidesGlint
		{
			get
			{
				if (_debugLayer != 2)
				{
					return _debugLayer == 4;
				}
				return true;
			}
		}

		private bool GlowEmissionOn
		{
			get
			{
				if (_glowStage != 0)
				{
					return _glowStage == 1;
				}
				return true;
			}
		}

		private bool GlowLightsOn
		{
			get
			{
				if (_glowStage != 0)
				{
					return _glowStage == 2;
				}
				return true;
			}
		}

		internal Vector3? GlareAimPoint
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if (!_spotHasPos)
				{
					return null;
				}
				return _spotPos;
			}
		}

		private static string RoomHandshakeFile => Path.Combine(Path.GetTempPath(), "sunmirror_room.txt");

		public static string Name => "SunMirror";

		public static string Version => "0.1.22";

		private float ViewFactor()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			Camera main = Camera.main;
			if (!_glareSourceValid || (Object)(object)main == (Object)null)
			{
				return 1f;
			}
			Vector3 val = _glareSourcePos - ((Component)main).transform.position;
			if (((Vector3)(ref val)).sqrMagnitude < 1E-06f)
			{
				return 1f;
			}
			float num = Vector3.Dot(((Component)main).transform.forward, ((Vector3)(ref val)).normalized);
			return Mathf.Clamp01(Mathf.InverseLerp(0.8f, 0.96f, num));
		}

		private void Awake()
		{
			//IL_1245: Unknown result type (might be due to invalid IL or missing references)
			//IL_1258: Unknown result type (might be due to invalid IL or missing references)
			//IL_126b: Unknown result type (might be due to invalid IL or missing references)
			//IL_11b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c2: Expected O, but got Unknown
			//IL_11c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cc: Expected O, but got Unknown
			//IL_11d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11dc: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			_equipKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "EquipKey", (Key)21, "Взять/убрать зеркало.");
			_useKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "UseKey", (Key)20, "Держать — светить зайчиком.");
			_selfTestKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "SelfTestKey", (Key)22, "DEBUG: эмоут+падение на себе.");
			_thirdPersonKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "ThirdPersonKey", (Key)17, "DEBUG: вид со стороны (посмотреть на себя).");
			_giveKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "GiveBinocularsKey", (Key)16, "DEBUG: выдать бинокль в руку (тест рескина).");
			_tpDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "ThirdPersonDistance", 2.8f, "Дистанция камеры со стороны.");
			_range = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "Range", 150f, "Дальность (метры).");
			_spotSize = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "Size", 0.5f, "Базовый диаметр пятна (вблизи).");
			_spread = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SpreadPerMeter", 0.009f, "Прибавка к диаметру на метр (рассеяние). 0.009 — настоящая расходимость солнечного зайчика: угловой размер Солнца 0,53 градуса даёт ~9 мм на метр. На 60 м пятно около метра.");
			_spotGlow = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "Glow", 14f, "Яркость прожектора.");
			_selfBlindDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "SelfBlindDelaySeconds", 8f, "Через сколько секунд после F2 ослепить тебя самого. Нужно, чтобы успеть залезть на скалу и посмотреть, что ослепление и падение делают с тем, кто висит на стене.");
			_useLight = ((BaseUnityPlugin)this).Config.Bind<bool>("Spot", "UseLight", true, "Подсвечивать место попадания настоящим источником света. Выключить, если на соседних поверхностях заметно мерцание.");
			_heightFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "HeightFactor", 2f, "Высота источника = размер×это (больше = мягче край).");
			_lightReach = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "LightReachBeyond", 0.3f, "На сколько метров прожектор светит за поверхность попадания. Больше — мягче край пятна, но начинает подсвечивать то, что стоит за целью.");
			_smooth = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SmoothSpeed", 22f, "Сглаживание хода пятна (больше = резче/быстрее).");
			_showSprite = ((BaseUnityPlugin)this).Config.Bind<bool>("Spot", "ShowSprite", true, "Яркий спрайт в центре пятна.");
			_spriteBright = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SpriteBrightness", 2.4f, "Яркость зайчика. Больше 1 — уходит в пересвет и ловит блум; на ярком песке меньше 1.5 не читается.");
			_ringStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "ContrastRing", 0f, "ОПЫТНОЕ, по умолчанию выключено. Тёмный ободок вокруг зайчика: аддитивное пятно на ярком песке не читается, ободок затемняет фон по краю и возвращает контраст. Включать значением 0.3-0.6.");
			_requireSun = ((BaseUnityPlugin)this).Config.Bind<bool>("Spot", "RequireSunlight", true, "Светить только когда солнце падает на игрока (день и не в тени).");
			_fallSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "FallSeconds", 1.6f, "Секунд рэгдолла.");
			_fallShake = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "FallShake", 10f, "Тряска экрана у падающей жертвы. Единицы — как у самой игры: приземление зовёт 5, срыв на стене 10, лава 5, удары по интерфейсу до 30. Старое значение 0.6 было в разы ниже самой слабой штатной тряски, и его просто не чувствовалось. У игрока с настройкой «меньше тряски» значение делится на 2 и обрезается до 3, так что выше 6 ставить бессмысленно.");
			_fallAtMax = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "FallAtMaxBlind", true, "Ронять цель, когда накопится MaxBlindSeconds ослепления. Падение летит штатным RPC игры, поэтому валит и тех, у кого мода нет. Выключить, если в лобби это лишнее.");
			_applyStatuses = ((BaseUnityPlugin)this).Config.Bind<bool>("Effect", "ApplyStatuses", false, "Spores/Drowsy (на незнакомцах может не сработать).");
			_sporesAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "SporesAmount", 0.5f, "Кол-во Spores.");
			_drowsyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "DrowsyAmount", 0.4f, "Кол-во Drowsy.");
			_glareStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "GlareStrength", 0.75f, "Сила засвета экрана, когда светят в тебя (0..1).");
			_useEmote = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "UseEmote", true, "Эмоут-реакция перед станом.");
			_emoteName = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "EmoteName", "Defeat", "Имя эмоута ослепления. Берите английский ключ из списка по клавише N (Defeat, Nono, Wave...), а НЕ локализованную подпись: локализованная зависит от языка игры и у английского игрока не сопоставится.");
			_stunDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "StunDelaySeconds", 5f, "Секунд светить в глаза до падения (эмоут+звёздочки всё это время).");
			_blindHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "BlindHoldSeconds", 6f, "Сколько держится ослепление после попадания зайчика в глаза.");
			_poseFreezeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseFreezeDelay", 0.55f, "Через сколько секунд после начала эмоута заморозить позу (руки у глаз).");
			_rigAimTime = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "RigAimSeconds", 1f, "Сколько зеркало-стенд наводит зайчика до ослепления.");
			_debugKeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DebugKeys", false, "Отладочные клавиши: F1-F12, B C H J K L M N O P U V Y, 0, запятая и точка, скобки/-/= и нумпад (наклон диска). По умолчанию выключены: обычному игроку они не нужны.");
			_freezeNoon = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "FreezeNoon", false, "Держать игровое время на полудне. Для отладки и съёмки: иначе солнце садится посреди работы и зайчик перестаёт работать.");
			_autoJoinRoom = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "AutoJoinHandshakeRoom", false, "Отладка на одной машине: при запуске сам войти в комнату, имя которой хост положил в sunmirror_room.txt (клавиша F7). Ставится только на втором клиенте.");
			if (_autoJoinRoom.Value)
			{
				((MonoBehaviour)this).StartCoroutine(AutoJoinLoop());
			}
			_selfTarget = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "SelfTarget", false, "Луч всегда бьёт в тебя — тест эффекта без второго игрока (клавиша J). Сбрасывается при каждом запуске: это тумблер на один заход, а не настройка.");
			if (_selfTarget.Value)
			{
				_selfTarget.Value = false;
				((BaseUnityPlugin)this).Config.Save();
				Log.LogWarning((object)"Debug/SelfTarget был включён в конфиге — выключил. Иначе зайчик слепил бы тебя самого, а не цель. Включается клавишей J на один заход.");
			}
			_blindOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "BlindStars", true, "Ослепление со звёздочками над головой (Affliction_Blind).");
			_blindAfflictionSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "BlindAfflictionSeconds", 0.6f, "Мин. длительность нативного Affliction_Blind за одно обновление (сетевое, видно всем). Это же задаёт, насколько эффект переживает уход луча у игроков без мода.");
			_spiralEyesNet = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "SpiralEyesForEveryone", true, "Показывать спиральные глаза и игрокам БЕЗ мода, родным методом игры. Рот так передать нельзя — у него сетевого пути нет, он остаётся только у владельцев мода.");
			_rootVictim = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "RootVictim", true, "Обездвиживать ослеплённого штатным механизмом игры (RPCA_Stick): крепление к миру, тело остаётся жёстким, поза и мимика видны. Работает у игрока БЕЗ мода, урона не наносит, на стене не срывает. Игра снимает крепление сама через 4 секунды. Падение (RPCA_Fall) здесь намеренно не используется: оно обнуляет контроль над телом, и тогда вся поза пропадает — остаётся мгновенно обмякший человек.");
			_rootRepeat = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "RootRepeatSeconds", 0.5f, "Как часто обновлять крепление, пока луч держится на глазах. 0 — один раз. Обновление нужно из-за самой игры: jumpAction подписан на JumpStickEffect, и каждый прыжок приближает освобождение на 0.5–1.5 с при пороге 4 с. Новое крепление счётчик обнуляет, поэтому при 0.5 с напрыгать побег не выходит.");
			_rootFallShake = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "RootFallShake", 5f, "Сила тряски камеры у жертвы. 0 — без тряски. Шлётся лично ей: тряска в игре идёт через синглтон GamefeelHandler, и общим вызовом затрясло бы всё лобби.");
			_blindStatusType = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "BlindStatusType", "Drowsy", "Какое состояние игры навешивать ослеплённому: Injury, Hunger, Cold, Poison, Crab, Curse, Drowsy, Weight, Hot, Thorns, Spores, Web, Arrow, Petrify, FlyTrap. Drowsy выбран по умолчанию как самый безобидный: он сам стекает со временем. Spores опасен — при 0.5 начинается превращение в зомби.");
			_blindStatusAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "BlindStatusAmount", 0f, "Сколько состояния добавлять в НАЧАЛЕ каждого ослепления. 0 — не добавлять. Это единственный известный способ дать игроку БЕЗ мода экранный эффект, звук и частицы: RPCA_Stick несёт состояние пятым аргументом и зовёт AddStatus с fromRPC: true на клиенте жертвы, а тот сам рисует эффект, потому что персонаж жертвы для её клиента локальный. По умолчанию выключено: состояния в PEAK наносят настоящий урон и копятся, так что величину подбирать с малого.");
			_chargeDrain = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "BlindChargeDrain", 0.5f, "Как быстро стекает накопленное ослепление, когда луч ушёл с глаз (доля от реального времени). 1.0 — стекает ровно столько же, сколько копилось; 0 — не стекает вовсе, цель запоминает всё.");
			_synthVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "SynthVolume", 0.55f, "Громкость своего (синтезированного) звука.");
			_synthPitch = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "SynthPitch", 1f, "Высота своего звука. 0.8 — ниже и глуше, 1.3 — выше и звонче.");
			_reactionEvery = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "ReactionEverySeconds", 1.2f, "Как часто повторять удар головой и звук при непрерывном ослеплении. Защита от «пулемёта» при поводке луча по лицу.");
			_netSendEvery = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "NetSendEverySeconds", 0.25f, "Как часто слать ослепление по сети, пока луч на цели (каждый кадр — флуд).");
			_flinch = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "VanillaFlinch", true, "Отдёргивание головы при попадании. Единственное, что физически чувствует игрок БЕЗ мода: сетевой метод самой игры.");
			_flashEmission = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "FlashEmission", 2.2f, "Яркость свечения зеркала во время свечения зайчиком. Выше 3 начинает раскачивать автоэкспозицию игры, и вся сцена заметно пульсирует.");
			_flashPulse = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "FlashPulseAmount", 0.06f, "Насколько свечение зеркала пульсирует (доля от яркости). Было 0.3 — именно это и давало мерцание всей сцены. 0 — ровное свечение.");
			_flashPulseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "FlashPulseSpeed", 12f, "Скорость пульсации свечения. 12 даёт период около полусекунды.");
			_signalGrow = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SignalGrowPerMeter", 0.02f, "Насколько вспышка на зеркале растёт с каждым метром — чтобы её было видно издалека.");
			_signalMax = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SignalMaxSize", 3.5f, "Потолок размера вспышки. Без него на дальней дистанции зеркало заслоняет пол-экрана.");
			_signalLightBright = ((BaseUnityPlugin)this).Config.Bind<float>("Spot", "SignalLightBrightness", 0f, "Точечный свет у вспышки на зеркале. 0 — выключен, и это правильное значение. Он светил во все стороны на восемь метров, и было видно, как зеркало подсвечивает землю и стены рядом с тобой: второй источник света там, где должен быть только зайчик. Включать, только если зеркало нужно видно издалека ценой этой засветки.");
			_maxBlind = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "MaxBlindSeconds", 4f, "Потолок накопленного ослепления: после него цель роняет и наступает пауза. Совпадает с 4 секундами, через которые игра сама снимает удержание, — иначе между освобождением и падением образуется разрыв.");
			_beamLinger = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "BeamLingerSeconds", 0.4f, "Сколько ослепление держится после ухода луча с глаз. Держит эффект между сетевыми посылками, поэтому должно быть больше NetSendEverySeconds (0.25).");
			_cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "CooldownSeconds", 4f, "Пауза, в течение которой ту же цель ослепить нельзя. Защита от удержания в цикле.");
			_eyesOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "EyesOnly", true, "Слепить только при попадании в голову. Выключить — слепит попадание в любую часть тела, как было в 0.1.3.");
			_eyesRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "EyesRadius", 0.45f, "Радиус вокруг головы (в метрах), в котором попадание считается попаданием в глаза. Прямое попадание в коллайдер головы засчитывается всегда, независимо от радиуса. Меньше 0.25 — попасть почти невозможно, больше 0.6 — ловит плечи и грудь.");
			_flinchForce = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "VanillaFlinchForce", 14f, "Сила отдёргивания головы. Больше 30 валит персонажа — нам нужно вздрагивание, а не нокдаун.");
			_staggerForce = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "StaggerForce", 9f, "Толчок всего тела в момент попадания — жертву качает назад. 0 — выключить. Больше 20 валит с ног.");
			_wobbleForce = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "WobbleForce", 7f, "Сила покачивания, пока держится ослепление. Жертва топчется и шатается, прикрывая лицо. 0 — стоять столбом.");
			_wobbleEvery = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "WobbleEverySeconds", 0.35f, "Как часто толкать при покачивании. Меньше — суетливее.");
			_shakeOffForce = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "ShakeOffForce", 11f, "Встряс в момент, когда луч ушёл — чтобы конец эффекта тоже читался. 0 — выключить.");
			_emoteB = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "BlindEmoteB", "A_Scout_Emote_Nono", "Второй эмоут, с которым чередуется основной: жертва то закрывается руками, то отмахивается. Пусто — держать одну позу, как раньше. Список имён печатает клавиша N.");
			_emoteSwapEvery = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "EmoteSwapSeconds", 1.1f, "Как часто чередовать позу со вторым эмоутом. 0 — не чередовать, держать только первую позу.");
			_emoteFirstHold = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "EmoteFirstHoldSeconds", 1.5f, "Сколько держать первую позу (руки к глазам), прежде чем начать чередование со вторым эмоутом. Это и задаёт порядок: сначала закрылся, потом отмахивается.");
			_blindSfx = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "BlindSfxName", "synth:bell", "Звук при попадании в глаза. Пусто — без звука. Свои варианты: synth:bell, synth:shing, synth:sparkle, synth:wobble, synth:zap, synth:hum. Можно подставить и звук игры — список печатает клавиша N.");
			_nativeBlindOnSelf = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "NativeBlindOnSelf", false, "Вешать нативное ослепление игры (с экранной пеленой) на СЕБЯ. Для тестов обычно false — слепит только звезда.");
			_blindMouth = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "BlindMouthName", "", "Рот ослеплённого: имя варианта из Customization.mouths (список печатает клавиша N). Пусто — рот не менять.");
			_poseFreezeAt = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseFreezeAt", 0.35f, "Кадр клипа эмоута (0..1), на котором держим позу. Подбор в игре: F9 раньше, F10 позже.");
			_poseSwing = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseSwing", 0.07f, "Насколько водить кадр позы туда-обратно вокруг PoseFreezeAt. 0 — застывшая поза, как было. Это и даёт движение рук у лица.");
			_poseSwingSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseSwingSpeed", 4.5f, "Скорость этого покачивания позы.");
			_poseLoop = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote", "PoseLoop", true, "Проигрывать эмоут по кругу всё время ослепления. Выключить — держать один кадр (PoseFreezeAt), как было в 0.1.3.");
			_poseLoopSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseLoopSpeed", 0.6f, "Скорость прокрутки эмоута по кругу. Больше — быстрее жмурится.");
			_poseLoopSpan = ((BaseUnityPlugin)this).Config.Bind<float>("Emote", "PoseLoopSpan", 0.3f, "Какую долю клипа гонять по кругу, начиная с PoseFreezeAt. Весь клип (1.0) опускает руки в конце — поэтому берём только участок, где руки у лица.");
			_mirrorItemName = ((BaseUnityPlugin)this).Config.Bind<string>("Model", "MirrorItemName", "Frisbee", "Английское имя предмета-зеркала (Item.UIData.itemName). Зайчик работает только когда этот предмет реально в руках.");
			_sfxFilter = ((BaseUnityPlugin)this).Config.Bind<string>("Emote", "SfxAuditionFilter", "sunspray|badgepopup|amulet|jingle|ping|petrify|curse|morale|banana|airhorn|uhhh|scoutshonor", "Подбор звука: клавиша . проигрывает следующего кандидата, , повторяет текущего. Несколько подстрок через '|', кандидаты идут в этом порядке. Понравившееся имя вписать в BlindSfxName.");
			_showModel = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "ShowModel", true, "Показывать модель зеркала в руке.");
			_backPlate = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "BackPlate", true, "Непрозрачная задняя крышка с надписью SIGNAL MIRROR. Без неё изнанка зеркала тоже отражает, потому что у меша один материальный слот.");
			_backPlateGap = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "BackPlateGap", 0.006f, "Зазор между зеркальной плоскостью и задней крышкой (метры). Мало — крышка проступает сквозь зеркало, много — виден торец.");
			_backPlateScale = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "BackPlateScale", 0.92f, "Размер крышки относительно диска. Меньше 1, чтобы по краю оставался ободок самого зеркала.");
			_autoBlind = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "AutoBlindNearest", false, "Непрерывно ослеплять ближайшего, как будто держишь луч. Для клиента, за которым никто не сидит: он работает мишенью-обидчиком, пока ты играешь на другом.");
			_autoBlindRange = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "AutoBlindRange", 30f, "Дальность автоослепления в метрах.");
			_userIdSuffix = ((BaseUnityPlugin)this).Config.Bind<string>("Debug", "PhotonUserIdSuffix", "", "Приписка к идентификатору Photon, например -sm2. Нужна только когда на одной машине запущены два клиента под одним аккаунтом Steam. Пусто — обычная игра, ничего не меняется.");
			UserIdSuffixPatch.Suffix = _userIdSuffix.Value ?? "";
			if (UserIdSuffixPatch.Suffix.Length > 0)
			{
				Log.LogWarning((object)("Идентификатор Photon получит приписку '" + UserIdSuffixPatch.Suffix + "' — это режим двух клиентов на одной машине."));
			}
			_prefabDumpAtStart = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "PrefabDumpSecondsAfterStart", 0f, "Через сколько секунд после запуска вывести список префабов самому, без клавиши G. 0 — не выводить.");
			if (_prefabDumpAtStart.Value > 0f)
			{
				_prefabDumpAt = Time.realtimeSinceStartup + _prefabDumpAtStart.Value;
			}
			_prefabFilter = ((BaseUnityPlugin)this).Config.Bind<string>("Debug", "PrefabDumpFilter", "vfx", "Подстрока для списка префабов по клавише G. Пусто — вывести все (их тысячи). Несколько подстрок через '|'.");
			_ownIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "ReplaceInventoryIcon", true, "Подменять иконку предмета в инвентаре: иначе зеркало показывается в слоте как обычная тарелочка.");
			_targetSize = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "BaseSize", 0.3f, "Габарит модели (метры).");
			_heldScale = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldScale", 1f, "Множитель масштаба.");
			_offX = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldOffsetX", 0.18f, "Смещение: вправо.");
			_offY = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldOffsetY", -0.12f, "Смещение: вниз.");
			_offZ = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldOffsetZ", 0.45f, "Смещение: вперёд.");
			_yaw = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldYaw", 0f, "Поворот Y.");
			_pitch = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldPitch", 0f, "Поворот X.");
			_roll = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "HeldRoll", 0f, "Поворот Z.");
			_reskinEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Reskin", "Enabled", true, "Превращать бинокль в зеркало (рескин).");
			_reskinScale = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "Scale", 0.22f, "Габарит модели зеркала на бинокле (метры).");
			_rOffX = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "OffsetX", 0f, "Смещение модели: вправо.");
			_rOffY = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "OffsetY", 0f, "Смещение модели: вверх.");
			_rOffZ = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "OffsetZ", 0f, "Смещение модели: вперёд.");
			_rYaw = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "Yaw", 0f, "Поворот Y.");
			_rPitch = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "Pitch", 0f, "Поворот X.");
			_rRoll = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "Roll", 0f, "Поворот Z.");
			_glintOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Reskin", "Glint", true, "Солнечный блик-вспышка на зеркале.");
			_glintSize = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "GlintSize", 0.5f, "Размер блика в покое (метры).");
			_glintFlashMul = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "GlintFlashMultiplier", 5f, "Во сколько раз блик раздувается при наводке на тиммейта (вспышка ослепления).");
			_viewLowerY = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "ViewLowerY", 0.45f, "Опустить хват (руки+зеркало) в 1-м лице вниз, метры.");
			_viewFwd = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "ViewForward", 0.1f, "Сдвинуть хват вперёд в 1-м лице, метры.");
			_discTilt = ((BaseUnityPlugin)this).Config.Bind<float>("Reskin", "DiscTilt", 65f, "Наклон тарелочки, чтобы зеркальная сторона смотрела вперёд (градусы).");
			_realMirrorOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Reflection", "RealMirror", true, "Настоящее зеркало шейдером игры GD/Mirror (камера в текстуру). Дороже всего.");
			_realMirrorRes = ((BaseUnityPlugin)this).Config.Bind<int>("Reflection", "RealMirrorResolution", 256, "Разрешение текстуры отражения (64..512). Меньше = дешевле.");
			_realMirrorEvery = ((BaseUnityPlugin)this).Config.Bind<int>("Reflection", "RealMirrorEveryNthFrame", 2, "Обновлять отражение раз в N кадров. Больше = дешевле.");
			_reflProbeOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Reflection", "Enabled", false, "Отражение окружения через кубическую карту. ДОРОГО, может лагать.");
			_reflRefresh = ((BaseUnityPlugin)this).Config.Bind<float>("Reflection", "RefreshSeconds", 1.5f, "Как часто пересниматькубическую карту. Больше = дешевле.");
			_reflRes = ((BaseUnityPlugin)this).Config.Bind<int>("Reflection", "Resolution", 128, "Разрешение кубической карты (64/128/256). Меньше = дешевле.");
			_viewLowerY.Value = Mathf.Clamp(_viewLowerY.Value, 0f, 0.8f);
			_viewFwd.Value = Mathf.Clamp(_viewFwd.Value, -0.5f, 0.5f);
			Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamPreCull));
			try
			{
				_harmony = new Harmony("Roman.SunMirror");
				_harmony.PatchAll();
				Log.LogInfo((object)"Harmony: патч идентификатора Photon установлен.");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Harmony patch failed: " + ex.GetType().Name + ": " + ex.Message));
			}
			Log.LogInfo((object)$"Plugin {Name} loaded. Equip={_equipKey.Value}, Use(hold)={_useKey.Value}, SelfTest={_selfTestKey.Value}");
		}

		private void OnDestroy()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			try
			{
				Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamPreCull));
				RestoreAllBlinds();
				EmergencyUnstick();
				Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsSortMode)0);
				foreach (Transform val in array)
				{
					if ((Object)(object)val == (Object)null || !((Object)val).name.StartsWith("SunMirror"))
					{
						continue;
					}
					if (((Object)val).name == "SunMirrorTilt")
					{
						for (int num = val.childCount - 1; num >= 0; num--)
						{
							val.GetChild(num).SetParent(val.parent, true);
						}
					}
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				DestroyOurComponents();
				_reskins.Clear();
				_mirroredCovers.Clear();
				if ((Object)(object)_mirrorMat != (Object)null)
				{
					Object.Destroy((Object)(object)_mirrorMat);
					_mirrorMat = null;
				}
				if ((Object)(object)_flareTex != (Object)null)
				{
					Object.Destroy((Object)(object)_flareTex);
					_flareTex = null;
				}
				if ((Object)(object)_reflTex != (Object)null)
				{
					Object.Destroy((Object)(object)_reflTex);
					_reflTex = null;
				}
				_donorMat = null;
				_donorSearched = false;
				_discMesh = null;
				_tiltPivot = null;
				_glintTf = null;
				GameObject[] array2 = (GameObject[])(object)new GameObject[6] { _mirrorPrototype, _held, _spotQuad, _spotLightGo, _signal, _botDisc };
				foreach (GameObject val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null)
					{
						Object.Destroy((Object)(object)val2);
					}
				}
				if ((Object)(object)_tpCam != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)_tpCam).gameObject);
				}
				if ((Object)(object)_probe != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)_probe).gameObject);
					_probe = null;
				}
				if ((Object)(object)_mirrorCam != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)_mirrorCam).gameObject);
					_mirrorCam = null;
				}
				if ((Object)(object)_mirrorRT != (Object)null)
				{
					_mirrorRT.Release();
					Object.Destroy((Object)(object)_mirrorRT);
					_mirrorRT = null;
				}
				if ((Object)(object)_testRig != (Object)null)
				{
					Object.Destroy((Object)(object)_testRig);
					_testRig = null;
				}
				_mirrorPrototype = (_held = (_spotQuad = (_spotLightGo = (_signal = (_botDisc = null)))));
				_botBlindsMe = false;
				_botAttacker = null;
				_tpCam = null;
				_heldMats = null;
				_cloneGo = null;
				Harmony? harmony = _harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
				_harmony = null;
				Log.LogInfo((object)"SunMirror unloaded cleanly.");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("OnDestroy: " + ex.GetType().Name + ": " + ex.Message));
			}
		}

		private void Update()
		{
			MarkSelfModded();
			if (_prefabDumpAt > 0f && Time.realtimeSinceStartup >= _prefabDumpAt)
			{
				_prefabDumpAt = -1f;
				Log.LogWarning((object)"[AUTO] Вывожу список префабов (Debug/PrefabDumpSecondsAfterStart).");
				try
				{
					DumpPrefabs();
				}
				catch (Exception ex)
				{
					Log.LogWarning((object)("[AUTO] Дамп упал: " + ex.GetType().Name + ": " + ex.Message));
				}
			}
			bool value = _debugKeys.Value;
			long num = 0L;
			if (value)
			{
				_fpsAccum += Time.unscaledDeltaTime;
				_fpsFrames++;
				num = Stopwatch.GetTimestamp();
			}
			Keyboard current = Keyboard.current;
			if (current != null)
			{
				if (_debugKeys.Value)
				{
					HandleDebugKeys(current);
				}
				UpdateTestRig();
				UpdateReflectionProbe();
				UpdateRealMirror();
				ApplyDiscTilt();
				EnsureNetReceivers();
				ReskinAllBinoculars();
				SyncReskins();
				float num2 = ViewFactor();
				float num3 = ((Time.time - _lastLocalHitTime < 0.15f) ? (Mathf.Clamp01(_glareStrength.Value) * num2) : 0f);
				_glareAlpha = Mathf.MoveTowards(_glareAlpha, num3, Time.deltaTime * ((num3 > _glareAlpha) ? 9f : 7f));
				if (value)
				{
					_selfMs += (float)(Stopwatch.GetTimestamp() - num) * 1000f / (float)Stopwatch.Frequency;
				}
			}
		}

		internal Texture2D GetFakeReflectionTex()
		{
			//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_0032: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_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_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_00f5: 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_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_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_reflTex != (Object)null)
			{
				return _reflTex;
			}
			int num = 128;
			int num2 = 128;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.55f, 0.74f, 0.96f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.97f, 0.99f, 1f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(0.52f, 0.53f, 0.58f);
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(0.24f, 0.25f, 0.3f);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)(num2 - 1);
				Color val6 = Color.Lerp(val3, val2, Mathf.InverseLerp(0.52f, 1f, num3));
				Color val7 = Color.Lerp(val5, val4, Mathf.InverseLerp(0f, 0.52f, num3));
				float num4 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.45f, 0.59f, num3));
				Color val8 = Color.Lerp(val7, val6, num4);
				for (int j = 0; j < num; j++)
				{
					float num5 = (float)j / (float)(num - 1);
					float num6 = num5 - 0.34f;
					float num7 = num3 - 0.72f;
					float num8 = Mathf.Exp(0f - (num6 * num6 * 26f + num7 * num7 * 90f));
					float num9 = ((num3 < 0.52f) ? (Mathf.Exp((0f - num6) * num6 * 90f) * Mathf.Exp((0f - (0.52f - num3)) * 7f) * 0.45f) : 0f);
					val.SetPixel(j, i, Color.Lerp(val8, Color.white, Mathf.Clamp01(num8 + num9)));
				}
			}
			val.Apply();
			_reflTex = val;
			return val;
		}

		internal Texture2D GetFlareTex()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_flareTex != (Object)null)
			{
				return _flareTex;
			}
			int num = 256;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false, false);
			float num2 = (float)num / 2f;
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = ((float)j - num2) / num2;
					float num4 = ((float)i - num2) / num2;
					float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
					float num6 = Mathf.Exp((0f - num5) * num5 * 140f);
					float num7 = Mathf.Atan2(num4, num3);
					float num8 = Mathf.Pow(Mathf.Abs(Mathf.Cos(num7 * 2f)), 120f) + Mathf.Pow(Mathf.Abs(Mathf.Cos((num7 - 0.7854f) * 2f)), 160f) * 0.65f;
					num8 *= Mathf.Exp((0f - num5) * 1.6f);
					float num9 = Mathf.Clamp01(num6 + num8);
					num9 *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.92f, 1f, num5));
					array[i * num + j] = new Color(1f, 1f, 1f, num9);
				}
			}
			val.SetPixels(array);
			val.Apply(false, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			_flareTex = val;
			return val;
		}

		private void HandleDebugKeys(Keyboard kb)
		{
			//IL_0007: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			if (((ButtonControl)kb[_selfTestKey.Value]).wasPressedThisFrame)
			{
				SelfRagdollTest();
			}
			if (((ButtonControl)kb[_thirdPersonKey.Value]).wasPressedThisFrame)
			{
				ToggleThirdPerson();
			}
			if (((ButtonControl)kb[_giveKey.Value]).wasPressedThisFrame)
			{
				GiveBinoculars();
			}
			if (((ButtonControl)kb[(Key)28]).wasPressedThisFrame)
			{
				ScanShinyMaterials();
				DumpMouths();
				DumpSfx();
				_emotesLogged = false;
				LogEmotesOnce();
				ProbeNetwork();
			}
			if (((ButtonControl)kb[(Key)35]).wasPressedThisFrame)
			{
				EmergencyUnstick();
			}
			if (((ButtonControl)kb[(Key)30]).wasPressedThisFrame)
			{
				DebugBoardFlight();
			}
			if (((ButtonControl)kb[(Key)27]).wasPressedThisFrame)
			{
				DebugNoon();
			}
			if (((ButtonControl)kb[(Key)94]).wasPressedThisFrame)
			{
				DumpPrefabs();
			}
			if (((ButtonControl)kb[(Key)36]).wasPressedThisFrame)
			{
				DebugCycleGlow();
			}
			if (((ButtonControl)kb[(Key)39]).wasPressedThisFrame)
			{
				DebugBotBlindsMe();
			}
			if (((ButtonControl)kb[(Key)95]).wasPressedThisFrame)
			{
				_selfBlindAt = Time.time + Mathf.Max(0f, _selfBlindDelay.Value);
				Log.LogWarning((object)$"[F2] Ослеплю тебя через {_selfBlindDelay.Value:0.0} с — лезь на скалу.");
			}
			if (((ButtonControl)kb[(Key)8]).wasPressedThisFrame)
			{
				AuditionSfx(next: true);
			}
			if (((ButtonControl)kb[(Key)7]).wasPressedThisFrame)
			{
				AuditionSfx(next: false);
			}
			if (((ButtonControl)kb[(Key)104]).wasPressedThisFrame)
			{
				DebugSpawnBot();
			}
			if (((ButtonControl)kb[(Key)105]).wasPressedThisFrame)
			{
				DebugKillVictim();
			}
			if (((ButtonControl)kb[(Key)99]).wasPressedThisFrame)
			{
				DebugJoinTestRoom();
			}
			if (((ButtonControl)kb[(Key)98]).wasPressedThisFrame)
			{
				DebugLobbyLink();
			}
			if (((ButtonControl)kb[(Key)100]).wasPressedThisFrame)
			{
				DebugRoomHandshake();
			}
			if (((ButtonControl)kb[(Key)97]).wasPressedThisFrame)
			{
				SetupTestBench();
			}
			if (((ButtonControl)kb[(Key)96]).wasPressedThisFrame)
			{
				DebugBlindNearest();
			}
			bool wasPressedThisFrame = ((ButtonControl)kb[(Key)102]).wasPressedThisFrame;
			bool wasPressedThisFrame2 = ((ButtonControl)kb[(Key)103]).wasPressedThisFrame;
			if (wasPressedThisFrame || wasPressedThisFrame2)
			{
				_poseFreezeAt.Value = Mathf.Clamp01(_poseFreezeAt.Value + (wasPressedThisFrame2 ? 0.05f : (-0.05f)));
				((BaseUnityPlugin)this).Config.Save();
				Log.LogWarning((object)$"PoseFreezeAt = {_poseFreezeAt.Value:0.00} (кадр клипа эмоута)");
			}
			if (((ButtonControl)kb[(Key)29]).wasPressedThisFrame || ((ButtonControl)kb[(Key)101]).wasPressedThisFrame || ((ButtonControl)kb[(Key)84]).wasPressedThisFrame || ((ButtonControl)kb[(Key)50]).wasPressedThisFrame)
			{
				_debugLayer = (_debugLayer + 1) % 5;
				string[] array = new string[5] { "все слои включены", "БЕЗ экранной звезды", "БЕЗ блика на зеркале", "БЕЗ прожектора", "ВСЕ мои эффекты выключены" };
				Log.LogWarning((object)$"[O] Режим {_debugLayer}: {array[_debugLayer]}");
				if (_debugLayer >= 3)
				{
					HideSpot();
				}
			}
			if (((ButtonControl)kb[(Key)25]).wasPressedThisFrame)
			{
				ToggleTestRig();
			}
			if (((ButtonControl)kb[(Key)26]).wasPressedThisFrame)
			{
				_rigAiming = !_rigAiming;
				_rigAim = 0f;
				if (!_rigAiming)
				{
					RestoreAllBlinds();
				}
				Log.LogInfo((object)$"Стенд наводит зайчика: {_rigAiming}");
			}
			if (((ButtonControl)kb[(Key)24]).wasPressedThisFrame)
			{
				_selfTarget.Value = !_selfTarget.Value;
				((BaseUnityPlugin)this).Config.Save();
				Log.LogInfo((object)$"SelfTarget = {_selfTarget.Value} (луч бьёт в себя — тест без второго игрока)");
			}
			bool flag = ((ButtonControl)kb[(Key)11]).wasPressedThisFrame || ((ButtonControl)kb[(Key)13]).wasPressedThisFrame || ((ButtonControl)kb[(Key)88]).wasPressedThisFrame;
			bool flag2 = ((ButtonControl)kb[(Key)12]).wasPressedThisFrame || ((ButtonControl)kb[(Key)14]).wasPressedThisFrame || ((ButtonControl)kb[(Key)90]).wasPressedThisFrame;
			if (flag || flag2)
			{
				ConfigEntry<float> discTilt = _discTilt;
				discTilt.Value += (flag2 ? 5f : (-5f));
				((BaseUnityPlugin)this).Config.Save();
				Log.LogInfo((object)$"DiscTilt = {_discTilt.Value:0}");
			}
		}

		private void OnGUI()
		{
			//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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (_tpActive || _debugLayer == 1 || _debugLayer == 4 || _glareAlpha <= 0.01f)
			{
				return;
			}
			Color color = GUI.color;
			int width = Screen.width;
			int height = Screen.height;
			float num = (float)width * 0.5f;
			float num2 = (float)height * 0.5f;
			Camera main = Camera.main;
			if (_glareSourceValid && (Object)(object)main != (Object)null)
			{
				Vector3 val = main.WorldToScreenPoint(_glareSourcePos);
				if (val.z <= 0f)
				{
					GUI.color = color;
					return;
				}
				num = val.x;
				num2 = (float)height - val.y;
			}
			float num3 = (float)Mathf.Max(width, height) * 1.6f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(num - num3 / 2f, num2 - num3 / 2f, num3, num3);
			GUI.color = new Color(1f, 1f, 0.96f, Mathf.Clamp01(_glareAlpha));
			GUI.DrawTexture(val2, (Texture)(object)GetFlareTex(), (ScaleMode)0, true);
			GUI.DrawTexture(val2, (Texture)(object)GetFlareTex(), (ScaleMode)0, true);
			GUI.color = color;
		}

		private void LateUpdate()
		{
			//IL_0068: 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_010a: 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 (_freezeNoon.Value)
			{
				DayNightManager instance = DayNightManager.instance;
				if ((Object)(object)instance != (Object)null)
				{
					instance.timeOfDay = 12f;
				}
			}
			Keyboard current = Keyboard.current;
			Mouse current2 = Mouse.current;
			bool flag = current2 != null && current2.leftButton.isPressed;
			bool flag2 = ((Object)(object)_held != (Object)null || _holdingMirror) && current != null && ((ButtonControl)current[_useKey.Value]).isPressed;
			bool flag3 = (_holdingMirror && flag) || flag2;
			if (flag && !_lmbLogged)
			{
				_lmbLogged = true;
				Log.LogInfo((object)$"LMB press: holdingMirror={_holdingMirror} active={flag3}");
			}
			if (!flag)
			{
				_lmbLogged = false;
			}
			bool flag4 = current != null && ((ButtonControl)current[_useKey.Value]).isPressed;
			if (flag4 && !_useKeyLogged)
			{
				_useKeyLogged = true;
				Log.LogInfo((object)(string.Format("{0} press: held={1} ", _useKey.Value, ((Object)(object)_held != (Object)null) ? ((Object)_held).name : "НЕТ") + $"holdingMirror={_holdingMirror} active={flag3}"));
			}
			if (!flag4)
			{
				_useKeyLogged = false;
			}
			if (flag3)
			{
				UpdateSpot();
			}
			else
			{
				HideSpot();
				ClearTarget();
				_spotHasPos = false;
			}
			Character localCharacter = Character.localCharacter;
			bool flag5 = Time.time < _selfDemoUntil && (Object)(object)localCharacter != (Object)null;
			bool flag6 = (flag3 && (Object)(object)localCharacter != (Object)null && _spotHasPos) || flag5;
			if (flag6 && (Object)(object)localCharacter != (Object)null)
			{
				ShowSignal(localCharacter, (_spotHasPos && !flag5) ? new Vector3?(_spotPos) : ((Vector3?)null));
				if (flag5)
				{
					_lastLocalHitTime = Time.time;
				}
			}
			else
			{
				HideSignal();
			}
			SetMirrorFlash(flag6);
			TickSelfBlindTimer(localCharacter);
			TickAutoBlind(localCharacter);
			TickBotBlindsMe(localCharacter);
			UpdateThirdPerson(localCharacter);
			LowerViewmodel();
			TickBlind();
		}

		private void LowerViewmodel()
		{
		}

		private void OnCamPreCull(Camera cam)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cam == (Object)null || (Object)(object)cam != (Object)(object)Camera.main || _lastShiftFrame == Time.frameCount)
			{
				return;
			}
			_lastShiftFrame = Time.frameCount;
			if (_lockLook)
			{
				((Component)cam).transform.rotation = _lockedRot;
			}
			if ((Object)(object)_cloneGo == (Object)null)
			{
				return;
			}
			ApplyDiscTilt();
			Transform transform = ((Component)cam).transform;
			Vector3 val = -transform.up * _viewLowerY.Value + transform.forward * _viewFwd.Value;
			if (!(((Vector3)(ref val)).sqrMagnitude < 1E-08f))
			{
				Transform transform2 = _cloneGo.transform;
				transform2.position += val;
				if ((Object)(object)_handL != (Object)null)
				{
					Transform? handL = _handL;
					handL.position += val;
				}
				if ((Object)(object)_handR != (Object)null)
				{
					Transform? handR = _handR;
					handR.position += val;
				}
			}
		}

		internal Camera? ActiveCamera()
		{
			if (!_tpActive || !((Object)(object)_tpCam != (Object)null))
			{
				return Camera.main;
			}
			return _tpCam;
		}

		private void ToggleTestRig()
		{
			//IL_00ac: 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_00c6: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			if ((Object)(object)_testRig != (Object)null)
			{
				Object.Destroy((Object)(object)_testRig);
				_testRig = null;
				RestoreAllBlinds();
				Log.LogInfo((object)"Тестовый стенд убран.");
				return;
			}
			Character localCharacter = Character.localCharacter;
			Camera main = Camera.main;
			if ((Object)(object)localCharacter == (Object)null || (Object)(object)main == (Object)null)
			{
				Log.LogWarning((object)"Стенд: нет игрока или камеры.");
				return;
			}
			_testRig = GameObject.CreatePrimitive((PrimitiveType)2);
			((Object)_testRig).name = "SunMirrorTestRig";
			Collider component = _testRig.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			_testRig.transform.position = ((Component)main).transform.position + ((Component)main).transform.forward * 4f;
			_testRig.transform.localScale = new Vector3(0.6f, 0.02f, 0.6f);
			Renderer component2 = _testRig.GetComponent<Renderer>();
			Shader val = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Standard");
			if ((Object)(object)val != (Object)null)
			{
				component2.material = new Material(val)
				{
					color = new Color(0.55f, 0.58f, 0.62f)
				};
			}
			Object.DontDestroyOnLoad((Object)(object)_testRig);
			Log.LogInfo((object)"Тестовый стенд поставлен: отойди и посмотри на него — он светит тебе в глаза.");
		}

		private void UpdateTestRig()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005b: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0097: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_012c: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if ((Object)(object)_testRig == (Object)null)
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			Camera main = Camera.main;
			Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : (((Component)localCharacter).transform.position + Vector3.up * 1.4f));
			Vector3 val2 = val - _testRig.transform.position;
			if (((Vector3)(ref val2)).sqrMagnitude > 1E-06f)
			{
				_testRig.transform.rotation = Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val2)).normalized);
			}
			_glareSourcePos = _testRig.transform.position;
			_glareSourceValid = true;
			if (!_rigAiming)
			{
				_rigAim = 0f;
				HideSpot();
				return;
			}
			_rigAim = Mathf.MoveTowards(_rigAim, 1f, Time.deltaTime / Mathf.Max(0.1f, _rigAimTime.Value));
			Vector3 position = ((Component)localCharacter).transform.position;
			Vector3 val3 = position + Vector3.up * 1.55f;
			Vector3 val4 = Vector3.Lerp(position, val3, _rigAim);
			Vector3 val5 = _testRig.transform.position - val4;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			if (_rigAim < 1f)
			{
				if (_debugLayer < 3)
				{
					ShowSpot(val4 + normalized * 0.25f, normalized, 0.7f);
				}
				else
				{
					HideSpot();
				}
			}
			else
			{
				HideSpot();
				SendBlind(localCharacter, _blindHoldSeconds.Value);
				_lastLocalHitTime = Time.time;
			}
		}

		private void GiveBinoculars()
		{
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				Log.LogWarning((object)"GiveBinoculars: localCharacter == null");
				return;
			}
			LogItemsOnce();
			string[] array = new string[1] { "Frisbee" };
			CharacterItems val = ((localCharacter.refs != null) ? localCharacter.refs.items : null);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogWarning((object)"GiveBinoculars: refs.items == null");
				return;
			}
			string[] array2 = array;
			foreach (string text in array2)
			{
				try
				{
					val.SpawnItemInHand(text);
					Log.LogInfo((object)("GiveBinoculars: SpawnItemInHand(\"" + text + "\") вызван без ошибки."));
					return;
				}
				catch (Exception ex)
				{
					Log.LogWarning((object)("GiveBinoculars: '" + text + "' -> " + ex.GetType().Name + ": " + ex.Message));
				}
			}
			Log.LogWarning((object)"GiveBinoculars: ни одно имя не подошло — смотри список предметов в логе выше.");
		}

		private void LogItemsOnce()
		{
			if (_itemsLogged)
			{
				return;
			}
			_itemsLogged = true;
			try
			{
				Item[] array = Resources.FindObjectsOfTypeAll<Item>();
				Log.LogInfo((object)$"=== SunMirror: найдено предметов (Item) = {array.Length} ===");
				Item[] array2 = array;
				foreach (Item val in array2)
				{
					if (!((Object)(object)val == (Object)null))
					{
						Log.LogInfo((object)$"  item name='{((Object)val).name}' id={val.itemID}");
					}
				}
				Log.LogInfo((object)"=== конец списка предметов ===");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("LogItemsOnce: " + ex.GetType().Name + ": " + ex.Message));
			}
		}

		private void ReskinAllBinoculars()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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)
			_cloneTimer -= Time.deltaTime;
			if (_cloneTimer > 0f)
			{
				return;
			}
			_cloneTimer = 0.5f;
			if (!_reskinEnabled.Value)
			{
				_holdingMirror = false;
				_cloneGo = null;
				return;
			}
			Camera main = Camera.main;
			GameObject val = null;
			float num = float.MaxValue;
			int num2 = 0;
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (!((Scene)(ref sceneAt)).isLoaded)
				{
					continue;
				}
				GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
				foreach (GameObject val2 in rootGameObjects)
				{
					if ((Object)(object)val2 == (Object)null || !val2.activeInHierarchy || !((Object)val2).name.StartsWith("Frisbee"))
					{
						continue;
					}
					num2++;
					if ((Object)(object)main == (Object)null)
					{
						val = val2;
						continue;
					}
					float num3 = Vector3.Distance(val2.transform.position, ((Component)main).transform.position);
					if (num3 < num)
					{
						num = num3;
						val = val2;
					}
				}
			}
			if ((Object)(object)val != (Object)(object)_cloneGo)
			{
				_handL = (_handR = null);
				_discMesh = null;
				_tiltPivot = null;
				if ((Object)(object)val != (Object)null)
				{
					Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true);
					foreach (Transform val3 in componentsInChildren)
					{
						string text = ((Object)val3).name.ToLowerInvariant();
						if ((Object)(object)_handL == (Object)null && text == "hand_l")
						{
							_handL = val3;
						}
						if ((Object)(object)_handR == (Object)null && text == "hand_r")
						{
							_handR = val3;
						}
					}
				}
			}
			_cloneGo = val;
			if ((Object)(object)_discMesh != (Object)null)
			{
				EnsureBackPlate(_discMesh);
			}
			ReplaceInventoryIcon();
			_holdingMirror = IsMirrorInHands();
			if ((Object)(object)val != (Object)null)
			{
				MakeCoverMirrored(val.transform);
			}
			if (Time.time - _lastHoldLog > 3f)
			{
				_lastHoldLog = Time.time;
				Log.LogInfo((object)(string.Format("held: {0} (кандидатов: {1}) ", ((Object)(object)val != (Object)null) ? $"'{((Object)val).name}' d={num:0.00}" : "нет", num2) + "handL=" + (((Object)(object)_handL != (Object)null) ? ((Object)_handL).name : "NULL") + " handR=" + (((Object)(object)_handR != (Object)null) ? ((Object)_handR).name : "NULL")));
			}
		}

		private bool TrySetupRealMirror(Renderer r)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			if (!_realMirrorOn.Value)
			{
				return false;
			}
			Shader val = Shader.Find("GD/Mirror");
			if ((Object)(object)val == (Object)null)
			{
				Log.LogWarning((object)"Шейдер GD/Mirror не найден.");
				return false;
			}
			_mirrorMat = new Material(val);
			int num = Mathf.Clamp(_realMirrorRes.Value, 32, 512);
			_mirrorRT = new RenderTexture(num, num, 16)
			{
				name = "SunMirrorRT",
				filterMode = (FilterMode)1,
				useMipMap = false,
				antiAliasing = 1
			};
			if (_mirrorMat.HasProperty("_MainTex"))
			{
				_mirrorMat.SetTexture("_MainTex", (Texture)(object)_mirrorRT);
			}
			if (_mirrorMat.HasProperty("_TextureSample0"))
			{
				_mirrorMat.SetTexture("_TextureSample0", (Texture)(object)_mirrorRT);
			}
			GameObject val2 = new GameObject("SunMirrorCam");
			Object.DontDestroyOnLoad((Object)(object)val2);
			_mirrorCam = val2.AddComponent<Camera>();
			_mirrorCam.targetTexture = _mirrorRT;
			((Behaviour)_mirrorCam).enabled = false;
			_mirrorCam.cullingMask = int.MaxValue;
			_mirrorCam.fieldOfView = 90f;
			_mirrorCam.nearClipPlane = 0.05f;
			_mirrorCam.farClipPlane = 45f;
			_mirrorCam.allowHDR = false;
			_mirrorCam.allowMSAA = false;
			_mirrorCam.useOcclusionCulling = true;
			int num2 = r.sharedMaterials.Length;
			if (num2 > 1)
			{
				Material[] materials = r.materials;
				materials[0] = _mirrorMat;
				r.materials = materials;
				Log.LogInfo((object)$"Зеркало только на первом слоте из {num2}.");
			}
			else
			{
				r.material = _mirrorMat;
			}
			Log.LogInfo((object)$"Настоящее зеркало включено: GD/Mirror, RT {num}x{num}, слотов материала={num2}.");
			return true;
		}

		private void UpdateRealMirror()
		{
			//IL_016a: 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_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_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_mirrorCam == (Object)null || (Object)(object)_discMesh == (Object)null)
			{
				return;
			}
			if (!_holdingMirror)
			{
				if ((Object)(object)_mirrorMat != (Object)null && _mirrorMat.HasProperty("_MainTex") && (Object)(object)_mirrorMat.GetTexture("_MainTex") != (Object)(object)IdleTex())
				{
					_mirrorMat.SetTexture("_MainTex", (Texture)(object)IdleTex());
					if (_mirrorMat.HasProperty("_TextureSample0"))
					{
						_mirrorMat.SetTexture("_TextureSample0", (Texture)(object)IdleTex());
					}
					Log.LogInfo((object)"Зеркало не в руках — показываем статичный металл вместо пустой текстуры отражения.");
				}
				return;
			}
			if ((Object)(object)_mirrorMat != (Object)null && (Object)(object)_mirrorRT != (Object)null && _mirrorMat.HasProperty("_MainTex") && (Object)(object)_mirrorMat.GetTexture("_MainTex") != (Object)(object)_mirrorRT)
			{
				_mirrorMat.SetTexture("_MainTex", (Texture)(object)_mirrorRT);
				if (_mirrorMat.HasProperty("_TextureSample0"))
				{
					_mirrorMat.SetTexture("_TextureSample0", (Texture)(object)_mirrorRT);
				}
			}
			_mirrorFrame++;
			if (_mirrorFrame % Mathf.Max(1, _realMirrorEvery.Value) == 0)
			{
				Transform discMesh = _discMesh;
				Vector3 val = discMesh.forward;
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter != (Object)null && Vector3.Dot(val, discMesh.position - ((Component)localCharacter).transform.position) < 0f)
				{
					val = -val;
				}
				((Component)_mirrorCam).transform.position = discMesh.position + val * 0.05f;
				((Component)_mirrorCam).transform.rotation = Quaternion.LookRotation(val, Vector3.up);
				_mirrorCam.Render();
			}
		}

		private Material? FindDonorMaterial()
		{
			if ((Object)(object)_donorMat != (Object)null || _donorSearched)
			{
				return _donorMat;
			}
			string[] array = new string[3] { "m_chrome", "Plane Glass Solid", "Plane Glass" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				Material[] array3 = Resources.FindObjectsOfTypeAll<Material>();
				foreach (Material val in array3)
				{
					if (!((Object)(object)val == (Object)null) && !(((Object)val).name != text))
					{
						_donorMat = val;
						Log.LogInfo((object)("Донор материала найден: '" + ((Object)val).name + "' (shader " + ((Object)val.shader).name + ")."));
						return _donorMat;
					}
				}
			}
			_donorSearched = true;
			Log.LogWarning((object)"Донор материала не найден — применяю числовой рецепт хрома.");
			return null;
		}

		private void MakeCoverMirrored(Transform root)
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true);
			Color val3 = default(Color);
			foreach (Renderer val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null || val is ParticleSystemRenderer || ((Object)val).name.ToLowerInvariant().Contains("hand") || ((Object)val).name.StartsWith("SunMirror"))
				{
					continue;
				}
				int instanceID = ((Object)val).GetInstanceID();
				if (_mirroredCovers.Contains(instanceID))
				{
					continue;
				}
				_mirroredCovers.Add(instanceID);
				if ((Object)(object)_discMesh == (Object)null && TrySetupRealMirror(val))
				{
					_discMesh = ((Component)val).transform;
					_tiltPivot = EnsureTiltPivot(((Component)val).transform);
					AddGlint(((Component)val).transform);
					continue;
				}
				Material val2 = FindDonorMaterial();
				if ((Object)(object)val2 != (Object)null)
				{
					val.material = new Material(val2);
				}
				Material material = val.material;
				Log.LogInfo((object)("MIRROR: '" + ((Object)val).name + "' mat='" + ((Object)material).name + "' shader='" + ((Object)material.shader).name + "'"));
				((Color)(ref val3))..ctor(1f, 1f, 1f, 1f);
				if (material.HasProperty("_BaseTexture"))
				{
					material.SetTexture("_BaseTexture", (Texture)null);
				}
				if (material.HasProperty("_BaseTexAmount"))
				{
					material.SetFloat("_BaseTexAmount", 1f);
				}
				if (material.HasProperty("_Texture1"))
				{
					material.SetTexture("_Texture1", (Texture)null);
				}
				if (material.HasProperty("_Texture2"))
				{
					material.SetTexture("_Texture2", (Texture)null);
				}
				if (material.HasProperty("_Texture3"))
				{
					material.SetTexture("_Texture3", (Texture)null);
				}
				if (material.HasProperty("_BaseColor"))
				{
					material.SetColor("_BaseColor", Color.white);
				}
				if (material.HasProperty("_Tint"))
				{
					material.SetColor("_Tint", new Color(0.62f, 0.64f, 0.68f, 1f));
				}
				if (material.HasProperty("_Color1"))
				{
					material.SetColor("_Color1", new Color(0.55f, 0.55f, 0.55f, 0.57f));
				}
				if (material.HasProperty("_Smooth1"))
				{
					material.SetFloat("_Smooth1", 1f);
				}
				if (material.HasProperty("_Triplanar1On"))
				{
					material.SetFloat("_Triplanar1On", 1f);
				}
				if (material.HasProperty("_HueStr1"))
				{
					material.SetFloat("_HueStr1", 0f);
				}
				if (material.HasProperty("_HueStr2"))
				{
					material.SetFloat("_HueStr2", 0f);
				}
				if (material.HasProperty("_HueShifts1"))
				{
					material.SetVector("_HueShifts1", Vector4.zero);
				}
				if (material.HasProperty("_Mask1"))
				{
					material.SetFloat("_Mask1", 0f);
				}
				if (material.HasProperty("_Triplanar2On"))
				{
					material.SetFloat("_Triplanar2On", 0f);
				}
				if (material.HasProperty("_Triplanar3On"))
				{
					material.SetFloat("_Triplanar3On", 0f);
				}
				if (material.HasProperty("_TopDown2On"))
				{
					material.SetFloat("_TopDown2On", 0f);
				}
				if (material.HasProperty("_Texture1"))
				{
					material.SetTexture("_Texture1", (Texture)(object)GetFakeReflectionTex());
				}
				if (material.HasProperty("_Triplanar1On"))
				{
					material.SetFloat("_Triplanar1On", 1f);
				}
				if (material.HasProperty("_TopDown1On"))
				{
					material.SetFloat("_TopDown1On", 1f);
				}
				if (material.HasProperty("_UV1"))
				{
					material.SetFloat("_UV1", 0f);
				}
				if (material.HasProperty("_ViewDirBlend"))
				{
					material.SetFloat("_ViewDirBlend", 1f);
				}
				if (material.HasProperty("_BaseMetallic"))
				{
					material.SetFloat("_BaseMetallic", 1f);
				}
				if (material.HasProperty("_BaseSmooth"))
				{
					material.SetFloat("_BaseSmooth", 1f);
				}
				if (material.HasProperty("_Smooth1"))
				{
					material.SetFloat("_Smooth1", 1f);
				}
				if (material.HasProperty("_Smooth2"))
				{
					material.SetFloat("_Smooth2", 1f);
				}
				if (material.HasProperty("_Smooth3"))
				{
					material.SetFloat("_Smooth3", 1f);
				}
				if (material.HasProperty("_AddSpecular"))
				{
					material.SetFloat("_AddSpecular", 0f);
				}
				if (material.HasProperty("_SpecularPower"))
				{
					material.SetFloat("_SpecularPower", 1f);
				}
				if (material.HasProperty("_NoShadowSpec"))
				{
					material.SetFloat("_NoShadowSpec", 0f);
				}
				if (material.HasProperty("_ViewDirBlend"))
				{
					material.SetFloat("_ViewDirBlend", 0f);
				}
				if ((Object)(object)_discMesh == (Object)null)
				{
					_discMesh = ((Component)val).transform;
					_tiltPivot = EnsureTiltPivot(((Component)val).transform);
					AddGlint(((Component)val).transform);
				}
			}
		}

		private void UpdateReflectionProbe()
		{
			//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_0146: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (!_reflProbeOn.Value)
			{
				if ((Object)(object)_probe != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)_probe).game