Decompiled source of MySix AccessibilityShield v0.1.0

MySix.AccessibilityShield.dll

Decompiled 12 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MySix.Core;
using Splatform;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyMetadata("MySix.Players", "optional")]
[assembly: InternalsVisibleTo("MySix.TestHarness")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace MySix
{
	internal static class ModVersion
	{
		public const string Value = "0.1.0";
	}
}
namespace MySix.AccessibilityShield
{
	internal static class Access
	{
		public enum Verdict
		{
			NotInWorld,
			NotHere,
			NotAllowed,
			Allowed
		}

		private const string SteamPrefix = "Steam_";

		public static Verdict Now(Player player)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			if ((Object)(object)player == (Object)null || (Object)(object)player != (Object)(object)Player.m_localPlayer || ShieldPlugin.AllowedPlayers == null)
			{
				return Verdict.NotInWorld;
			}
			if ((int)CorePlugin.Role == 0 || (int)CorePlugin.Role == 1)
			{
				return Verdict.NotInWorld;
			}
			if (CorePlugin.IsRemoteClient && !((SettingBase)ShieldPlugin.AllowedPlayers).IsRemote)
			{
				return Verdict.NotHere;
			}
			if (!Matches(ShieldPlugin.AllowedPlayers.Value, player.GetPlayerName(), LocalId()))
			{
				return Verdict.NotAllowed;
			}
			return Verdict.Allowed;
		}

		public static bool Matches(string list, string name, string id)
		{
			name = (name ?? "").Trim();
			id = (id ?? "").Trim();
			string[] array = (list ?? "").Split(',', ';', '\n', '\r');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim().Trim('"', '\'').Trim();
				if (text.Length != 0 && !(text == "-") && !text.Equals("none", StringComparison.OrdinalIgnoreCase))
				{
					if (name.Length > 0 && text.Equals(name, StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
					if (id.Length > 0 && text.Equals(id, StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
					if (id.StartsWith("Steam_", StringComparison.OrdinalIgnoreCase) && id.Length > "Steam_".Length && text.Equals(id.Substring("Steam_".Length), StringComparison.Ordinal))
					{
						return true;
					}
				}
			}
			return false;
		}

		private static string LocalId()
		{
			try
			{
				return ((Object)(object)Game.instance != (Object)null) ? ((object)Unsafe.As<PlatformUserID, PlatformUserID>(ref UserInfo.GetLocalUser().UserId)/*cast due to .constrained prefix*/).ToString() : "";
			}
			catch (Exception)
			{
				return "";
			}
		}
	}
	internal static class Bolts
	{
		private const string RpcStrike = "AccessibilityShield_Strike";

		private static ZRoutedRpc _registeredOn;

		internal static int Received { get; private set; }

		private static bool Graphics => (int)SystemInfo.graphicsDeviceType != 4;

		public static void RegisterIfNeeded()
		{
			ZRoutedRpc instance = ZRoutedRpc.instance;
			if (instance != null && instance != _registeredOn)
			{
				instance.Register<ZPackage>("AccessibilityShield_Strike", (Action<long, ZPackage>)OnStrike);
				_registeredOn = instance;
			}
		}

		public static void Broadcast(Vector3 from, Vector3 to)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (ZRoutedRpc.instance != null)
			{
				ZPackage val = new ZPackage();
				val.Write(from);
				val.Write(to);
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "AccessibilityShield_Strike", new object[1] { val });
			}
		}

		private static void OnStrike(long sender, ZPackage pkg)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (pkg != null)
			{
				Vector3 val = pkg.ReadVector3();
				Vector3 to = pkg.ReadVector3();
				Received++;
				if (Graphics)
				{
					Draw(val, to);
				}
			}
		}

		public static void Draw(Vector3 from, Vector3 to)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Bubble.Additive == (Object)null || !FlashBudget.TryFlash())
			{
				return;
			}
			bool crackles = Bubble.Crackles;
			Vector3 val = to - from;
			if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f))
			{
				Vector3 val2 = from + ((Vector3)(ref val)).normalized * Mathf.Min(1.1f, ((Vector3)(ref val)).magnitude * 0.5f);
				GameObject val3 = new GameObject("MySix_shield_bolt");
				val3.transform.position = val2;
				val3.AddComponent<Bolt>().Set(val2, to, crackles);
				if (crackles)
				{
					Borrowed.Play(to);
				}
			}
		}
	}
	internal class Bolt : MonoBehaviour
	{
		private const int Points = 10;

		private const float Life = 0.25f;

		private LineRenderer _line;

		private Light _light;

		private Vector3 _from;

		private Vector3 _to;

		private float _born;

		private bool _crackle;

		public void Set(Vector3 from, Vector3 to, bool crackle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			_from = from;
			_to = to;
			_crackle = crackle;
			_born = Time.time;
			_line = ((Component)this).gameObject.AddComponent<LineRenderer>();
			_line.useWorldSpace = true;
			_line.positionCount = 10;
			((Renderer)_line).sharedMaterial = Bubble.Additive;
			_line.numCapVertices = 2;
			LineRenderer line = _line;
			Color startColor = (_line.endColor = Bubble.BoltColour);
			line.startColor = startColor;
			_line.startWidth = (crackle ? 0.09f : 0.03f);
			_line.endWidth = (crackle ? 0.04f : 0.02f);
			if (crackle)
			{
				GameObject val = new GameObject("MySix_shield_bolt_light");
				val.transform.SetParent(((Component)this).transform, false);
				val.transform.position = to;
				_light = val.AddComponent<Light>();
				_light.type = (LightType)2;
				_light.color = Bubble.Blue;
				_light.range = 3f;
				_light.intensity = 0f;
			}
			Jag();
		}

		private void Update()
		{
			float num = Time.time - _born;
			if (num >= 0.25f || (Object)(object)_line == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Jag();
			if ((Object)(object)_light != (Object)null)
			{
				_light.intensity = 1.5f * ((num < 0.07f) ? (num / 0.07f) : (1f - (num - 0.07f) / 0.18f));
			}
		}

		private void Jag()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = _to - _from;
			Vector3 val2 = Vector3.Cross(((Vector3)(ref val)).normalized, Vector3.up);
			if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
			{
				val2 = Vector3.right;
			}
			float num = (_crackle ? 0.18f : 0.05f);
			for (int i = 0; i < 10; i++)
			{
				float num2 = (float)i / 9f;
				bool flag = i == 0 || i == 9;
				Vector3 val3 = Vector3.Lerp(_from, _to, num2);
				_line.SetPosition(i, flag ? val3 : (val3 + val2 * Random.Range(0f - num, num) + Vector3.up * Random.Range(0f - num, num)));
			}
		}
	}
	internal static class FlashBudget
	{
		public const int Most = 3;

		public const float Window = 1f;

		private static readonly Queue<float> Recent = new Queue<float>();

		public static bool TryFlash()
		{
			return TryFlash(Time.realtimeSinceStartup);
		}

		internal static bool TryFlash(float now)
		{
			while (Recent.Count > 0 && now - Recent.Peek() >= 1f)
			{
				Recent.Dequeue();
			}
			if (Recent.Count >= 3)
			{
				return false;
			}
			Recent.Enqueue(now);
			return true;
		}

		internal static int InWindow(float now)
		{
			int num = 0;
			foreach (float item in Recent)
			{
				if (now - item < 1f)
				{
					num++;
				}
			}
			return num;
		}

		internal static void ResetForTest()
		{
			Recent.Clear();
		}
	}
	internal static class Borrowed
	{
		private static readonly string[] Candidates = new string[3] { "fx_chainlightning_hit", "fx_lightningweapon_hit", "sfx_weapons_lightning_impact" };

		private static GameObject _prefab;

		private static bool _looked;

		internal static GameObject Prefab
		{
			get
			{
				if (!_looked && (Object)(object)ZNetScene.instance != (Object)null)
				{
					_looked = true;
					string[] candidates = Candidates;
					foreach (string text in candidates)
					{
						if ((Object)(object)(_prefab = ZNetScene.instance.GetPrefab(text)) != (Object)null)
						{
							break;
						}
					}
				}
				return _prefab;
			}
		}

		public static void Play(Vector3 at)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = Prefab;
			if (!((Object)(object)prefab == (Object)null))
			{
				ZNetView.m_forceDisableInit = true;
				GameObject val;
				try
				{
					val = Object.Instantiate<GameObject>(prefab, at, Quaternion.identity);
				}
				finally
				{
					ZNetView.m_forceDisableInit = false;
				}
				CamShaker[] componentsInChildren = val.GetComponentsInChildren<CamShaker>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
				}
				Light[] componentsInChildren2 = val.GetComponentsInChildren<Light>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					((Behaviour)componentsInChildren2[i]).enabled = false;
				}
				val.AddComponent<GoesWhenCalm>();
				Object.Destroy((Object)(object)val, 4f);
			}
		}
	}
	internal class GoesWhenCalm : MonoBehaviour
	{
		private void Update()
		{
			if (!Bubble.Crackles)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal class Bubble : MonoBehaviour
	{
		public const float Radius = 1.1f;

		public static readonly Color Blue = new Color(0.25f, 0.55f, 1f);

		public static readonly Color RimBlue = new Color(0.1f, 0.4f, 0.9f, 1f);

		public static readonly Color RimInner = new Color(0.1f, 0.7f, 0.83f, 1f);

		public static readonly Color RimNightBlue = new Color(0.1f, 0.4f, 0.9f, 1f);

		public static readonly Color RimNightInner = new Color(0.1f, 0.45f, 0.88f, 1f);

		public const float RimPower = 2.45f;

		public const float RimMost = 1f;

		public const float RimLeast = 0f;

		public const float NearClear = 1.8f;

		public const float NearGone = 1.25f;

		public const float NearLeast = 0.15f;

		public static readonly Color RimFilter = new Color(0.12f, 0.3f, 1f);

		public const float RimFilterMost = 1f;

		public const float RimFilterPower = 2.35f;

		public const bool RimFilterAbsorbs = true;

		public static readonly Color GlassTint = new Color(0.6f, 0.8f, 1f, 0.01f);

		public static readonly Color RimlessTint = new Color(0.1f, 0.4f, 2f, 0.25f);

		internal const float RimlessGloss = 0.25f;

		private const float GlassGloss = 0.9f;

		private const float GlassMetal = 1f;

		public static readonly Color BoltColour = new Color(0.7f, 0.85f, 1f);

		public const float MostLight = 1.5f;

		private const float LightRange = 3f;

		private const int Arcs = 3;

		private const int Points = 8;

		private static Material _additive;

		private static bool _lookedForAdditive;

		internal static bool NoStaffForTest;

		internal static bool NoAlphaBlendedForTest;

		internal static bool NoParticlesForTest;

		internal static bool NoFilterForTest;

		private Player _player;

		private ZNetView _nview;

		private GameObject _body;

		private LineRenderer[] _arcs;

		private float[] _until;

		private Vector3[][] _shape;

		private Light _glow;

		private ParticleSystem[] _sparks = (ParticleSystem[])(object)new ParticleSystem[0];

		private bool? _calm;

		private float _nextLook;

		private float _nextArc;

		private float _glowFrom;

		private float _glowUntil;

		private bool _shown;

		internal const string WaveSpeed = "_WaveVel";

		private static readonly Dictionary<string, Material> Glasses = new Dictionary<string, Material>();

		public static bool Crackles
		{
			get
			{
				if (ShieldPlugin.Crackle == null || ShieldPlugin.Crackle.Value)
				{
					return !Settings.ReduceFlashingLights;
				}
				return false;
			}
		}

		public static Material Additive
		{
			get
			{
				//IL_002f: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				if ((Object)(object)_additive == (Object)null && !_lookedForAdditive)
				{
					_lookedForAdditive = true;
					Shader val = FindShader("Legacy Shaders/Particles/Additive");
					if ((Object)(object)val != (Object)null)
					{
						_additive = new Material(val)
						{
							mainTexture = (Texture)(object)Texture2D.whiteTexture,
							name = "MySix_shield_additive"
						};
					}
				}
				return _additive;
			}
		}

		internal bool Shown => _shown;

		internal GameObject Body => _body;

		internal int ArcsAlive
		{
			get
			{
				if (_arcs != null)
				{
					return _arcs.Count((LineRenderer a) => (Object)(object)a != (Object)null && ((Renderer)a).enabled);
				}
				return 0;
			}
		}

		internal static int ArcsDrawn { get; private set; }

		internal static Shader FindShader(string name)
		{
			return Shader.Find(name) ?? ((IEnumerable<Shader>)Resources.FindObjectsOfTypeAll<Shader>()).FirstOrDefault((Func<Shader, bool>)((Shader s) => ((Object)s).name == name));
		}

		private void Awake()
		{
			_player = ((Component)this).GetComponent<Player>();
			_nview = ((Component)this).GetComponent<ZNetView>();
		}

		private void Update()
		{
			float time = Time.time;
			if (time >= _nextLook)
			{
				_nextLook = time + 0.2f;
				bool flag = ShouldShow();
				if (flag != _shown)
				{
					Show(flag);
				}
			}
			if (_shown)
			{
				Crackle(time);
			}
		}

		private bool ShouldShow()
		{
			if ((Object)(object)_player == (Object)null || (Object)(object)_nview == (Object)null || !_nview.IsValid() || ((Character)_player).IsDead())
			{
				return false;
			}
			if (_player == Player.m_localPlayer)
			{
				return Shield.Up;
			}
			return _nview.GetZDO().GetBool(Shield.UpKey, false);
		}

		private void Show(bool show)
		{
			_shown = show;
			if (show && (Object)(object)_body == (Object)null)
			{
				Build();
			}
			if ((Object)(object)_body != (Object)null)
			{
				_body.SetActive(show);
			}
			_calm = null;
			if (show)
			{
				return;
			}
			if (_arcs != null)
			{
				LineRenderer[] arcs = _arcs;
				for (int i = 0; i < arcs.Length; i++)
				{
					((Renderer)arcs[i]).enabled = false;
				}
			}
			if ((Object)(object)_glow != (Object)null)
			{
				_glow.intensity = 0f;
			}
		}

		internal void RebuildForTest()
		{
			if ((Object)(object)_body != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)_body);
			}
			_body = null;
			_arcs = null;
			_glow = null;
			bool shown = _shown;
			_shown = false;
			if (shown)
			{
				Show(show: true);
			}
		}

		private void Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0185: Expected O, but got Unknown
			//IL_01ba: 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_014c: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			_body = new GameObject("MySix_shield_bubble");
			_body.transform.SetParent(((Component)this).transform, false);
			_body.transform.position = ((Character)_player).GetCenterPoint();
			Shader drawnIn = Rim.DrawnIn;
			bool flag = (Object)(object)Rim.Make(_body.transform, drawnIn) != (Object)null;
			if (flag)
			{
				Shine.Make(_body.transform, drawnIn);
			}
			CopyStaffBubble(_body.transform, flag ? GlassTint : RimlessTint, flag ? 0.9f : 0.25f, !flag);
			_sparks = _body.GetComponentsInChildren<ParticleSystem>(true);
			if ((Object)(object)Additive != (Object)null && !NoParticlesForTest)
			{
				_arcs = (LineRenderer[])(object)new LineRenderer[3];
				_until = new float[3];
				_shape = new Vector3[3][];
				for (int i = 0; i < 3; i++)
				{
					GameObject val = new GameObject("MySix_shield_arc");
					val.transform.SetParent(_body.transform, false);
					LineRenderer val2 = val.AddComponent<LineRenderer>();
					val2.useWorldSpace = false;
					val2.positionCount = 8;
					((Renderer)val2).sharedMaterial = Additive;
					val2.numCapVertices = 2;
					Color startColor = (val2.endColor = BoltColour);
					val2.startColor = startColor;
					((Renderer)val2).enabled = false;
					_arcs[i] = val2;
				}
			}
			GameObject val3 = new GameObject("MySix_shield_glow");
			val3.transform.SetParent(_body.transform, false);
			_glow = val3.AddComponent<Light>();
			_glow.type = (LightType)2;
			_glow.color = Blue;
			_glow.range = 3f;
			_glow.intensity = 0f;
		}

		private static bool CopyStaffBubble(Transform into, Color glass, float gloss, bool showGlass)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = (NoStaffForTest ? null : StaffBubble());
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			ZNetView.m_forceDisableInit = true;
			GameObject val2;
			try
			{
				val2 = Object.Instantiate<GameObject>(val, into, false);
			}
			finally
			{
				ZNetView.m_forceDisableInit = false;
			}
			((Object)val2).name = "MySix_shield_body";
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.identity;
			ZSyncTransform[] componentsInChildren = val2.GetComponentsInChildren<ZSyncTransform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			TimedDestruction[] componentsInChildren2 = val2.GetComponentsInChildren<TimedDestruction>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
			}
			CamShaker[] componentsInChildren3 = val2.GetComponentsInChildren<CamShaker>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren3[i]);
			}
			Collider[] componentsInChildren4 = val2.GetComponentsInChildren<Collider>(true);
			for (int i = 0; i < componentsInChildren4.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
			}
			Rigidbody[] componentsInChildren5 = val2.GetComponentsInChildren<Rigidbody>(true);
			for (int i = 0; i < componentsInChildren5.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren5[i]);
			}
			ZSFX[] componentsInChildren6 = val2.GetComponentsInChildren<ZSFX>(true);
			for (int i = 0; i < componentsInChildren6.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren6[i]);
			}
			AudioSource[] componentsInChildren7 = val2.GetComponentsInChildren<AudioSource>(true);
			for (int i = 0; i < componentsInChildren7.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren7[i]);
			}
			LightFlicker[] componentsInChildren8 = val2.GetComponentsInChildren<LightFlicker>(true);
			for (int i = 0; i < componentsInChildren8.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren8[i]);
			}
			Light[] componentsInChildren9 = val2.GetComponentsInChildren<Light>(true);
			for (int i = 0; i < componentsInChildren9.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren9[i]);
			}
			MeshFilter val3 = (from f in val2.GetComponentsInChildren<MeshFilter>(true)
				where (Object)(object)f.sharedMesh != (Object)null && (Object)(object)((Component)f).GetComponent<MeshRenderer>() != (Object)null
				select f).OrderByDescending(Across).FirstOrDefault();
			if ((Object)(object)val3 != (Object)null && Across(val3) > 0.05f)
			{
				Transform transform = val2.transform;
				transform.localScale *= 2.2f / Across(val3);
				Transform transform2 = val2.transform;
				Vector3 position = transform2.position;
				Vector3 position2 = into.position;
				Transform transform3 = ((Component)val3).transform;
				Bounds bounds = val3.sharedMesh.bounds;
				transform2.position = position + (position2 - transform3.TransformPoint(((Bounds)(ref bounds)).center));
			}
			Tint(val2, glass, gloss, showGlass);
			return true;
		}

		internal static float Across(MeshFilter f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = f.sharedMesh.bounds;
			Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)f).transform.lossyScale);
			return Mathf.Max(val.x, Mathf.Max(val.y, val.z));
		}

		internal static GameObject StaffBubble()
		{
			if ((Object)(object)ObjectDB.instance == (Object)null)
			{
				return null;
			}
			return Drawn(StaffShield()) ?? ObjectDB.instance.m_StatusEffects.OfType<SE_Shield>().Select(Drawn).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => (Object)(object)p != (Object)null));
		}

		internal static SE_Shield StaffShield()
		{
			GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab("StaffShield") : null);
			ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null);
			if ((Object)(object)val2 == (Object)null)
			{
				return null;
			}
			SharedData shared = val2.m_itemData.m_shared;
			GameObject val3 = ((shared.m_attack != null) ? shared.m_attack.m_attackProjectile : null);
			if ((Object)(object)val3 != (Object)null)
			{
				Aoe[] componentsInChildren = val3.GetComponentsInChildren<Aoe>(true);
				foreach (Aoe val4 in componentsInChildren)
				{
					if (!string.IsNullOrEmpty(val4.m_statusEffect))
					{
						StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(val4.m_statusEffect));
						SE_Shield val5 = (SE_Shield)(object)((statusEffect is SE_Shield) ? statusEffect : null);
						if (val5 != null)
						{
							return val5;
						}
					}
				}
			}
			StatusEffect attackStatusEffect = shared.m_attackStatusEffect;
			return (SE_Shield)(object)((attackStatusEffect is SE_Shield) ? attackStatusEffect : null);
		}

		private static GameObject Drawn(SE_Shield shield)
		{
			if ((Object)(object)shield == (Object)null)
			{
				return null;
			}
			EffectData[] effectPrefabs = ((StatusEffect)shield).m_startEffects.m_effectPrefabs;
			foreach (EffectData val in effectPrefabs)
			{
				if (val != null && val.m_enabled && (Object)(object)val.m_prefab != (Object)null && val.m_prefab.GetComponentsInChildren<Renderer>(true).Any())
				{
					return val.m_prefab;
				}
			}
			return null;
		}

		private static Material GlassFor(Material staff, Color colour, float gloss)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			string key = $"{((Object)staff).GetInstanceID()} {colour} {gloss}";
			if (!Glasses.TryGetValue(key, out var value) || (Object)(object)value == (Object)null)
			{
				value = new Material(staff)
				{
					name = "MySix_shield_glass"
				};
				string[] array = new string[2] { "_Color", "_TintColor" };
				foreach (string text in array)
				{
					if (value.HasProperty(text))
					{
						value.SetColor(text, colour);
					}
				}
				if (value.HasProperty("_EmissionColor"))
				{
					value.SetColor("_EmissionColor", Blue * 0.6f);
				}
				if (value.HasProperty("_Metallic"))
				{
					value.SetFloat("_Metallic", 1f);
				}
				if (value.HasProperty("_Glossiness"))
				{
					value.SetFloat("_Glossiness", gloss);
				}
				if (value.HasProperty("_RefractionIntensity"))
				{
					value.SetFloat("_RefractionIntensity", 0f);
				}
				if (value.HasProperty("_WaveVel"))
				{
					value.SetFloat("_WaveVel", 0f);
				}
				Glasses[key] = value;
			}
			return value;
		}

		private static void Tint(GameObject copy, Color glassColour, float glassGloss, bool showGlass)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			MaterialPropertyBlock val = new MaterialPropertyBlock();
			Renderer[] componentsInChildren = copy.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				Material sharedMaterial = val2.sharedMaterial;
				if ((Object)(object)sharedMaterial == (Object)null)
				{
					continue;
				}
				if (!(val2 is ParticleSystemRenderer))
				{
					val2.enabled = showGlass;
					val2.sharedMaterial = GlassFor(sharedMaterial, glassColour, glassGloss);
					continue;
				}
				val2.GetPropertyBlock(val);
				string[] array = new string[2] { "_Color", "_TintColor" };
				foreach (string text in array)
				{
					if (sharedMaterial.HasProperty(text))
					{
						val.SetColor(text, new Color(Blue.r, Blue.g, Blue.b, sharedMaterial.GetColor(text).a));
					}
				}
				if (sharedMaterial.HasProperty("_EmissionColor"))
				{
					val.SetColor("_EmissionColor", Blue * 0.6f);
				}
				if (sharedMaterial.HasProperty("_RefractionIntensity"))
				{
					val.SetFloat("_RefractionIntensity", 0f);
				}
				if (sharedMaterial.HasProperty("_WaveVel"))
				{
					val.SetFloat("_WaveVel", 0f);
				}
				val2.SetPropertyBlock(val);
				val.Clear();
			}
			ParticleSystem[] componentsInChildren2 = copy.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem obj in componentsInChildren2)
			{
				MainModule main = obj.main;
				float r = Blue.r;
				float g = Blue.g;
				float b = Blue.b;
				MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(r, g, b, ((MinMaxGradient)(ref startColor)).color.a));
				ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = false;
			}
		}

		private void Crackle(float now)
		{
			bool crackles = Crackles;
			if (_calm != !crackles)
			{
				Calm(!crackles);
			}
			if (_arcs == null || !crackles)
			{
				if (_arcs != null)
				{
					LineRenderer[] arcs = _arcs;
					for (int i = 0; i < arcs.Length; i++)
					{
						((Renderer)arcs[i]).enabled = false;
					}
				}
				if ((Object)(object)_glow != (Object)null)
				{
					_glow.intensity = 0f;
				}
				return;
			}
			if (now >= _nextArc)
			{
				_nextArc = now + Random.Range(0.35f, 1.2f);
				if (FlashBudget.TryFlash())
				{
					Arc(now);
				}
			}
			for (int j = 0; j < 3; j++)
			{
				if (((Renderer)_arcs[j]).enabled)
				{
					if (now >= _until[j])
					{
						((Renderer)_arcs[j]).enabled = false;
					}
					else
					{
						Jag(_arcs[j], _shape[j]);
					}
				}
			}
			if ((Object)(object)_glow != (Object)null)
			{
				float num = Mathf.Clamp((_glowUntil - _glowFrom) * 0.4f, 0.06f, 0.1f);
				_glow.intensity = ((now >= _glowUntil || now < _glowFrom) ? 0f : ((now - _glowFrom < num) ? (1.5f * (now - _glowFrom) / num) : (1.5f * (_glowUntil - now) / Mathf.Max(0.01f, _glowUntil - _glowFrom - num))));
			}
		}

		private void Calm(bool calm)
		{
			_calm = calm;
			ParticleSystem[] sparks = _sparks;
			foreach (ParticleSystem val in sparks)
			{
				if ((Object)(object)val != (Object)null)
				{
					if (calm)
					{
						val.Stop(true, (ParticleSystemStopBehavior)0);
					}
					else if (!val.isPlaying)
					{
						val.Play(true);
					}
				}
			}
		}

		private void Arc(float now)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < 3; i++)
			{
				if (!((Renderer)_arcs[i]).enabled)
				{
					num = i;
					break;
				}
			}
			Vector3 val = Random.onUnitSphere * 1.1f;
			Vector3 val2 = Vector3.Slerp(val, Random.onUnitSphere * 1.1f, Random.Range(0.15f, 0.35f));
			Vector3[] array = (Vector3[])(object)new Vector3[8];
			for (int j = 0; j < 8; j++)
			{
				float num2 = (float)j / 7f;
				int num3 = j;
				Vector3 val3 = Vector3.Slerp(val, val2, num2);
				array[num3] = ((Vector3)(ref val3)).normalized * (1.13f + 0.08f * Mathf.Sin(num2 * (float)Math.PI));
			}
			_shape[num] = array;
			LineRenderer obj = _arcs[num];
			float num4 = (obj.startWidth = Random.Range(0.025f, 0.05f));
			obj.endWidth = num4 * 0.4f;
			Jag(obj, array);
			((Renderer)obj).enabled = true;
			ArcsDrawn++;
			float num6 = Random.Range(0.07f, 0.25f);
			_until[num] = now + num6;
			if ((Object)(object)_glow != (Object)null)
			{
				((Component)_glow).transform.localPosition = (val + val2) * 0.5f;
				_glowFrom = now;
				_glowUntil = now + Mathf.Max(num6, 0.16f);
			}
		}

		private static void Jag(LineRenderer line, Vector3[] path)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			for (int i = 0; i < path.Length; i++)
			{
				bool flag = i == 0 || i == path.Length - 1;
				line.SetPosition(i, flag ? path[i] : (path[i] + Random.insideUnitSphere * 0.04f));
			}
		}
	}
	internal class Rim : MonoBehaviour
	{
		private static Vector3[] _shape;

		private static int[] _triangles;

		private static readonly Dictionary<Shader, Material> Materials = new Dictionary<Shader, Material>();

		private static Shader _alphaBlended;

		private static bool _lookedForAlphaBlended;

		private static Material _filter;

		private static bool _lookedForFilter;

		private Mesh _mesh;

		private Mesh _filterMesh;

		private Color32[] _colours;

		private Color32[] _filtered;

		private readonly float[] _fresnel = new float[256];

		private readonly Color[] _day = (Color[])(object)new Color[256];

		private readonly Color[] _night = (Color[])(object)new Color[256];

		private readonly Color[] _through = (Color[])(object)new Color[256];

		private readonly Color32[] _tone = (Color32[])(object)new Color32[256];

		private Vector3 _eye = new Vector3(float.NaN, 0f, 0f);

		private Vector3 _forward;

		private float _light = -1f;

		private float _level = -1f;

		private float _near = 1f;

		private float _fog = -1f;

		internal const float FilterScale = 3f;

		private bool _fogBlind;

		private float _nearLeast = 0.15f;

		private Vector2 _clip = new Vector2(0.3f, 1000f);

		internal bool FogBlindForTest
		{
			get
			{
				return _fogBlind;
			}
			set
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				_fogBlind = value;
				_eye = new Vector3(float.NaN, 0f, 0f);
			}
		}

		internal float Power { get; private set; }

		internal float Most { get; private set; }

		internal float Least { get; private set; }

		internal float Light => _light;

		internal float Level => _level;

		internal float Near => _near;

		internal float NearClearAt { get; private set; } = 1.8f;

		internal float NearGoneAt { get; private set; } = 1.25f;

		internal float NearLeastAt
		{
			get
			{
				return _nearLeast;
			}
			set
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				_nearLeast = value;
				_eye = new Vector3(float.NaN, 0f, 0f);
			}
		}

		internal Color Outer { get; private set; }

		internal Color Inner { get; private set; }

		internal Color NightOuter { get; private set; }

		internal Color NightInner { get; private set; }

		internal Color Colour => Outer;

		internal Color Filter { get; private set; }

		internal float FilterMost { get; private set; }

		internal float FilterPower { get; private set; }

		internal bool Filtering => (Object)(object)_filterMesh != (Object)null;

		private static bool Linear => (int)QualitySettings.activeColorSpace == 1;

		internal static Shader DrawnIn
		{
			get
			{
				if (!_lookedForAlphaBlended)
				{
					_lookedForAlphaBlended = true;
					_alphaBlended = Bubble.FindShader("Legacy Shaders/Particles/Alpha Blended");
				}
				if (Bubble.NoParticlesForTest)
				{
					return null;
				}
				if ((Object)(object)_alphaBlended != (Object)null && !Bubble.NoAlphaBlendedForTest)
				{
					return _alphaBlended;
				}
				if (!((Object)(object)Bubble.Additive != (Object)null))
				{
					return null;
				}
				return Bubble.Additive.shader;
			}
		}

		internal static Material FilterMaterial
		{
			get
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Expected O, but got Unknown
				//IL_0097: 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)
				if ((Object)(object)_filter == (Object)null && !_lookedForFilter)
				{
					_lookedForFilter = true;
					Shader val = Bubble.FindShader("Particles/Standard Unlit2") ?? Bubble.FindShader("Particles/Standard Unlit");
					if ((Object)(object)val != (Object)null)
					{
						_filter = new Material(val)
						{
							mainTexture = (Texture)(object)Texture2D.whiteTexture,
							name = "MySix_shield_filter"
						};
						Color val2 = default(Color);
						((Color)(ref val2))..ctor(3f, 3f, 3f, 1f);
						_filter.SetColor("_Color", Linear ? ((Color)(ref val2)).gamma : val2);
						_filter.SetFloat("_SrcBlend", 2f);
						_filter.SetFloat("_DstBlend", 0f);
						_filter.SetFloat("_ZWrite", 0f);
						_filter.SetFloat("_Cull", 2f);
						_filter.renderQueue = 2999;
					}
				}
				if (!Bubble.NoFilterForTest && !Bubble.NoParticlesForTest)
				{
					return _filter;
				}
				return null;
			}
		}

		internal bool Absorbing { get; private set; }

		internal void FillFilterForTest(Color32 colour)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!((Object)(object)_filterMesh == (Object)null))
			{
				for (int i = 0; i < _filtered.Length; i++)
				{
					_filtered[i] = colour;
				}
				_filterMesh.colors32 = _filtered;
				_eye = new Vector3(float.NaN, 0f, 0f);
			}
		}

		internal static Color TintFor(Color drawn)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Color val;
			if (!Linear)
			{
				val = drawn * 0.5f;
			}
			else
			{
				Color val2 = ((Color)(ref drawn)).linear * 0.5f;
				val = ((Color)(ref val2)).gamma;
			}
			Color result = val;
			result.a = 0.5f;
			return result;
		}

		internal static Color Drawn(Color tint)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Color val;
			if (!Linear)
			{
				val = tint * 2f;
			}
			else
			{
				Color val2 = ((Color)(ref tint)).linear * 2f;
				val = ((Color)(ref val2)).gamma;
			}
			Color result = val;
			result.a = 1f;
			return result;
		}

		internal static Rim Make(Transform into, Shader shader)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_0189: 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)
			Material val = For(shader);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			GameObject val2 = new GameObject("MySix_shield_rim");
			val2.transform.SetParent(into, false);
			MeshFilter val3 = val2.AddComponent<MeshFilter>();
			MeshRenderer obj = val2.AddComponent<MeshRenderer>();
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			((Renderer)obj).lightProbeUsage = (LightProbeUsage)0;
			((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)0;
			((Renderer)obj).sharedMaterial = val;
			Rim rim = val2.AddComponent<Rim>();
			Shape();
			rim._mesh = new Mesh
			{
				name = "MySix_shield_rim"
			};
			rim._mesh.MarkDynamic();
			rim._mesh.vertices = _shape;
			rim._mesh.normals = _shape;
			rim._mesh.triangles = _triangles;
			rim._colours = Enumerable.Repeat<Color32>(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0), _shape.Length).ToArray();
			rim._mesh.colors32 = rim._colours;
			val3.sharedMesh = rim._mesh;
			Material filterMaterial = FilterMaterial;
			if ((Object)(object)filterMaterial != (Object)null)
			{
				GameObject val4 = new GameObject("MySix_shield_filter");
				val4.transform.SetParent(val2.transform, false);
				rim._filterMesh = new Mesh
				{
					name = "MySix_shield_filter"
				};
				rim._filterMesh.MarkDynamic();
				rim._filterMesh.vertices = _shape;
				rim._filterMesh.triangles = _triangles;
				byte b = (byte)Mathf.RoundToInt(85f);
				rim._filtered = Enumerable.Repeat<Color32>(new Color32(b, b, b, byte.MaxValue), _shape.Length).ToArray();
				rim._filterMesh.colors32 = rim._filtered;
				val4.AddComponent<MeshFilter>().sharedMesh = rim._filterMesh;
				MeshRenderer obj2 = val4.AddComponent<MeshRenderer>();
				((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)obj2).receiveShadows = false;
				((Renderer)obj2).lightProbeUsage = (LightProbeUsage)0;
				((Renderer)obj2).reflectionProbeUsage = (ReflectionProbeUsage)0;
				((Renderer)obj2).sharedMaterial = filterMaterial;
			}
			rim.Inner = Bubble.RimInner;
			rim.Outer = Bubble.RimBlue;
			rim.NightInner = Bubble.RimNightInner;
			rim.NightOuter = Bubble.RimNightBlue;
			rim.Filter = Bubble.RimFilter;
			rim.FilterMost = 1f;
			rim.FilterPower = 2.35f;
			rim.Absorbing = true;
			rim.Set(2.45f, 1f, 0f);
			Transform transform = val2.transform;
			transform.localScale *= 2.2220001f / Bubble.Across(val3);
			return rim;
		}

		internal static Material For(Shader shader)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shader == (Object)null)
			{
				return null;
			}
			if (!Materials.TryGetValue(shader, out var value) || (Object)(object)value == (Object)null)
			{
				value = new Material(shader)
				{
					mainTexture = (Texture)(object)Texture2D.whiteTexture,
					name = "MySix_shield_rim"
				};
				value.SetColor("_TintColor", TintFor(Color.white));
				Materials[shader] = value;
			}
			return value;
		}

		internal void Set(float power, float most, float least)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			Power = power;
			Most = most;
			Least = least;
			for (int i = 0; i < _fresnel.Length; i++)
			{
				_fresnel[i] = Mathf.Pow(1f - (float)i / 255f, power);
			}
			Tone(Inner, Outer, NightInner, NightOuter);
			Through(Filter, FilterMost, FilterPower, Absorbing);
		}

		internal void Through(Color filter, float most, float power, bool absorbing = false)
		{
			//IL_0001: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Filter = filter;
			FilterMost = most;
			FilterPower = power;
			Absorbing = absorbing;
			for (int i = 0; i < _through.Length; i++)
			{
				float num = Mathf.Clamp01(Mathf.Pow(1f - (float)i / 255f, power) * most);
				_through[i] = (Color)(absorbing ? new Color(Mathf.Pow(filter.r, num), Mathf.Pow(filter.g, num), Mathf.Pow(filter.b, num)) : Color.Lerp(Color.white, filter, num));
			}
			_eye = new Vector3(float.NaN, 0f, 0f);
		}

		internal void Tone(Color inner, Color outer, Color nightInner, Color nightOuter)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004d: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Inner = inner;
			Outer = outer;
			NightInner = nightInner;
			NightOuter = nightOuter;
			Color val = (Linear ? ((Color)(ref inner)).linear : inner);
			Color val2 = (Linear ? ((Color)(ref outer)).linear : outer);
			Color val3 = (Linear ? ((Color)(ref nightInner)).linear : nightInner);
			Color val4 = (Linear ? ((Color)(ref nightOuter)).linear : nightOuter);
			for (int i = 0; i < _tone.Length; i++)
			{
				_day[i] = Color.Lerp(val, val2, Mathf.Sqrt(_fresnel[i]));
				_night[i] = Color.Lerp(val3, val4, Mathf.Sqrt(_fresnel[i]));
			}
			_level = -1f;
			_eye = new Vector3(float.NaN, 0f, 0f);
		}

		private void OnWillRenderObject()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Camera current = Camera.current;
			if ((Object)(object)current != (Object)null)
			{
				_clip = new Vector2(current.nearClipPlane, current.farClipPlane);
				Paint(((Component)this).transform.InverseTransformPoint(((Component)current).transform.position), ((Component)this).transform.InverseTransformDirection(((Component)current).transform.forward), SceneLight.Level, SceneLight.Strength);
			}
		}

		internal void Paint(Vector3 eye, Vector3 forward, float level, float strength)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: 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_012c: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Invalid comparison between Unknown and I4
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Invalid comparison between Unknown and I4
			float num = ((!RenderSettings.fog || _filtered == null || _fogBlind) ? 0f : ((float)RenderSettings.fogMode + RenderSettings.fogDensity + RenderSettings.fogStartDistance * 0.001f + RenderSettings.fogEndDistance * 0.0001f + RenderSettings.fogColor.r * 0.01f + RenderSettings.fogColor.g * 0.001f + RenderSettings.fogColor.b * 0.0001f + _clip.x * 0.1f));
			Vector3 val = eye - _eye;
			if (((Vector3)(ref val)).sqrMagnitude < 1E-06f && Mathf.Abs(level - _level) < 0.002f && Mathf.Abs(strength - _light) < 0.002f && num == _fog)
			{
				if (num == 0f)
				{
					return;
				}
				val = forward - _forward;
				if (((Vector3)(ref val)).sqrMagnitude < 1E-06f)
				{
					return;
				}
			}
			if (Mathf.Abs(level - _level) >= 0.002f)
			{
				for (int i = 0; i < _tone.Length; i++)
				{
					Color val2 = Color.Lerp(_night[i], _day[i], level);
					_tone[i] = new Color32((byte)(val2.r * 255f + 0.5f), (byte)(val2.g * 255f + 0.5f), (byte)(val2.b * 255f + 0.5f), (byte)0);
				}
			}
			_eye = eye;
			_forward = forward;
			_level = level;
			_light = strength;
			_fog = num;
			float num2 = Mathf.Clamp01((((Vector3)(ref eye)).magnitude * 1.01f - NearGoneAt) / Mathf.Max(0.001f, NearClearAt - NearGoneAt));
			num2 = (_near = Mathf.Lerp(NearLeastAt, 1f, num2 * num2 * (3f - 2f * num2)));
			float num3 = Most * strength * num2 * 255f;
			float num4 = Least * num2 * 255f + 0.5f;
			Color val3;
			if (!Linear)
			{
				val3 = RenderSettings.fogColor;
			}
			else
			{
				Color fogColor = RenderSettings.fogColor;
				val3 = ((Color)(ref fogColor)).linear;
			}
			Color val4 = val3;
			float x = ((Component)this).transform.lossyScale.x;
			float fogDensity = RenderSettings.fogDensity;
			float fogStartDistance = RenderSettings.fogStartDistance;
			float fogEndDistance = RenderSettings.fogEndDistance;
			FogMode fogMode = RenderSettings.fogMode;
			float num5 = _clip.y / Mathf.Max(0.001f, _clip.y - _clip.x);
			for (int j = 0; j < _shape.Length; j++)
			{
				Vector3 val5 = _shape[j];
				float num6 = eye.x - val5.x;
				float num7 = eye.y - val5.y;
				float num8 = eye.z - val5.z;
				float num9 = (val5.x * num6 + val5.y * num7 + val5.z * num8) / Mathf.Max(1E-05f, Mathf.Sqrt(num6 * num6 + num7 * num7 + num8 * num8));
				int num10 = (int)(Mathf.Clamp01(num9) * 255f);
				Color32 val6 = _tone[num10];
				val6.a = (byte)((!(num9 < 0f)) ? ((byte)Mathf.Min(255f, num4 + num3 * _fresnel[num10])) : 0);
				_colours[j] = val6;
				if (_filtered != null && !(num9 < -0.25f))
				{
					Color val7 = ((num9 < 0f) ? Color.white : _through[num10]);
					float num11 = 1f + (val7.r - 1f) * num2;
					float num12 = 1f + (val7.g - 1f) * num2;
					float num13 = 1f + (val7.b - 1f) * num2;
					float num14 = 1f;
					if (num != 0f)
					{
						float num15 = Mathf.Max(0f, (0f - (num6 * forward.x + num7 * forward.y + num8 * forward.z)) * x - _clip.x) * num5;
						num14 = (((int)fogMode == 2) ? Mathf.Exp((0f - fogDensity) * num15) : (((int)fogMode == 3) ? Mathf.Exp((0f - fogDensity * num15) * (fogDensity * num15)) : Mathf.Clamp01((fogEndDistance - num15) / Mathf.Max(0.001f, fogEndDistance - fogStartDistance))));
						num14 = Mathf.Max(num14, 0.001f);
					}
					float num16 = 1f - num14;
					float num17 = 85f / num14;
					_filtered[j] = new Color32((byte)Mathf.Clamp((num11 - num16 * val4.r) * num17 + 0.5f, 0f, 255f), (byte)Mathf.Clamp((num12 - num16 * val4.g) * num17 + 0.5f, 0f, 255f), (byte)Mathf.Clamp((num13 - num16 * val4.b) * num17 + 0.5f, 0f, 255f), byte.MaxValue);
				}
			}
			_mesh.colors32 = _colours;
			if ((Object)(object)_filterMesh != (Object)null)
			{
				_filterMesh.colors32 = _filtered;
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_mesh != (Object)null)
			{
				Object.Destroy((Object)(object)_mesh);
			}
			if ((Object)(object)_filterMesh != (Object)null)
			{
				Object.Destroy((Object)(object)_filterMesh);
			}
		}

		private static void Shape()
		{
			//IL_0032: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (_shape != null)
			{
				return;
			}
			float num = (1f + Mathf.Sqrt(5f)) / 2f;
			List<Vector3> points = new List<Vector3>
			{
				new Vector3(-1f, num, 0f),
				new Vector3(1f, num, 0f),
				new Vector3(-1f, 0f - num, 0f),
				new Vector3(1f, 0f - num, 0f),
				new Vector3(0f, -1f, num),
				new Vector3(0f, 1f, num),
				new Vector3(0f, -1f, 0f - num),
				new Vector3(0f, 1f, 0f - num),
				new Vector3(num, 0f, -1f),
				new Vector3(num, 0f, 1f),
				new Vector3(0f - num, 0f, -1f),
				new Vector3(0f - num, 0f, 1f)
			}.Select((Vector3 p) => ((Vector3)(ref p)).normalized).ToList();
			List<int> list = new List<int>
			{
				0, 11, 5, 0, 5, 1, 0, 1, 7, 0,
				7, 10, 0, 10, 11, 1, 5, 9, 5, 11,
				4, 11, 10, 2, 10, 7, 6, 7, 1, 8,
				3, 9, 4, 3, 4, 2, 3, 2, 6, 3,
				6, 8, 3, 8, 9, 4, 9, 5, 2, 4,
				11, 6, 2, 10, 8, 6, 7, 9, 8, 1
			};
			for (int num2 = 0; num2 < 3; num2++)
			{
				Dictionary<long, int> halves = new Dictionary<long, int>();
				List<int> list2 = new List<int>(list.Count * 4);
				for (int num3 = 0; num3 < list.Count; num3 += 3)
				{
					int num4 = list[num3];
					int num5 = list[num3 + 1];
					int num6 = list[num3 + 2];
					int num7 = Half(num4, num5);
					int num8 = Half(num5, num6);
					int num9 = Half(num6, num4);
					list2.AddRange(new int[12]
					{
						num4, num7, num9, num5, num8, num7, num6, num9, num8, num7,
						num8, num9
					});
				}
				list = list2;
				int Half(int a, int b)
				{
					//IL_0040: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					long key = ((a < b) ? (((long)a << 32) | (uint)b) : (((long)b << 32) | (uint)a));
					if (!halves.TryGetValue(key, out var value))
					{
						value = points.Count;
						List<Vector3> list3 = points;
						Vector3 val = (points[a] + points[b]) * 0.5f;
						list3.Add(((Vector3)(ref val)).normalized);
						halves[key] = value;
					}
					return value;
				}
			}
			_shape = points.ToArray();
			_triangles = list.ToArray();
		}
	}
	internal class Shine : MonoBehaviour
	{
		internal static readonly Vector2 SkyAt = new Vector2(-0.48f, 0.7f);

		internal const float SkyHalfLength = 0.38f;

		internal const float SkyHalfThickness = 0.12f;

		internal static readonly Vector2 GlintAt = new Vector2(-0.52f, 0.51f);

		internal const float GlintCore = 0.02f;

		internal const float GlintHalo = 0.045f;

		internal const float HaloShare = 0.3f;

		internal const float SkyShare = 0.3f;

		internal static readonly Color DayColour = new Color(0.85f, 0.94f, 1f);

		internal static readonly Color NightColour = new Color(0.36f, 0.59f, 0.88f);

		internal const float DayPeak = 0.75f;

		internal const float NightPeak = 0.45f;

		internal const float Behind = 1f;

		internal const float Gone = 1.25f;

		internal const float Clear = 1.6f;

		private const int Size = 256;

		private static Texture2D _picture;

		private static readonly Dictionary<Shader, Material> Materials = new Dictionary<Shader, Material>();

		private Mesh _mesh;

		private readonly Vector3[] _corners = (Vector3[])(object)new Vector3[4];

		private readonly Color32[] _colours = (Color32[])(object)new Color32[4];

		private Vector3 _eye = new Vector3(float.NaN, 0f, 0f);

		private Vector3 _up;

		private float _level = -1f;

		private float _strength;

		private float _depth = 1f;

		internal float Light => _level;

		internal float Strength => _strength;

		internal float Depth
		{
			get
			{
				return _depth;
			}
			set
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				_depth = value;
				_eye = new Vector3(float.NaN, 0f, 0f);
			}
		}

		private static Bounds Reach => new Bounds(Vector3.zero, Vector3.one * 1.1f * 8f);

		internal static Texture2D Picture
		{
			get
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_picture == (Object)null)
				{
					_picture = Paint(SkyAt, 0.38f, 0.12f, 0.3f, GlintAt, 0.02f, 0.045f, 0.3f);
				}
				return _picture;
			}
		}

		internal static Shine Make(Transform into, Shader shader)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00a8: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			Material val = For(shader);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			GameObject val2 = new GameObject("MySix_shield_shine");
			val2.transform.SetParent(into, false);
			MeshFilter val3 = val2.AddComponent<MeshFilter>();
			MeshRenderer obj = val2.AddComponent<MeshRenderer>();
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			((Renderer)obj).lightProbeUsage = (LightProbeUsage)0;
			((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)0;
			((Renderer)obj).sharedMaterial = val;
			Shine shine = val2.AddComponent<Shine>();
			shine._mesh = new Mesh
			{
				name = "MySix_shield_shine"
			};
			shine._mesh.MarkDynamic();
			shine._mesh.vertices = shine._corners;
			shine._mesh.uv = (Vector2[])(object)new Vector2[4]
			{
				new Vector2(0f, 0f),
				new Vector2(1f, 0f),
				new Vector2(0f, 1f),
				new Vector2(1f, 1f)
			};
			shine._mesh.colors32 = shine._colours;
			shine._mesh.triangles = new int[6] { 0, 2, 1, 2, 3, 1 };
			shine._mesh.bounds = Reach;
			val3.sharedMesh = shine._mesh;
			return shine;
		}

		internal static Material For(Shader shader)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shader == (Object)null)
			{
				return null;
			}
			if (!Materials.TryGetValue(shader, out var value) || (Object)(object)value == (Object)null)
			{
				value = new Material(shader)
				{
					mainTexture = (Texture)(object)Picture,
					name = "MySix_shield_shine"
				};
				value.SetColor("_TintColor", Rim.TintFor(Color.white));
				value.renderQueue = shader.renderQueue + 1;
				Materials[shader] = value;
			}
			return value;
		}

		internal static Texture2D Paint(Vector2 skyAt, float skyHalfLength, float skyHalfThickness, float skyShare, Vector2 glintAt, float glintCore, float glintHalo, float haloShare)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f6: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, true, true)
			{
				name = "MySix_shield_shine",
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)2
			};
			Color32[] array = (Color32[])(object)new Color32[65536];
			float num = Mathf.Atan2(skyAt.y, skyAt.x) * 57.29578f;
			float magnitude = ((Vector2)(ref skyAt)).magnitude;
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num2 = ((float)j + 0.5f) / 256f * 2f - 1f;
					float num3 = ((float)i + 0.5f) / 256f * 2f - 1f;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					float x = Mathf.DeltaAngle(num, Mathf.Atan2(num3, num2) * 57.29578f) * ((float)Math.PI / 180f) * magnitude / skyHalfLength;
					float num5 = skyShare * Bump(x) * Bump((num4 - magnitude) / skyHalfThickness);
					Vector2 val2 = new Vector2(num2, num3) - glintAt;
					float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude;
					float num6 = Mathf.Exp((0f - sqrMagnitude) / (glintCore * glintCore)) + haloShare * Mathf.Exp((0f - sqrMagnitude) / (glintHalo * glintHalo));
					float num7 = ((num4 >= 1f) ? 0f : Mathf.Clamp01(num5 + num6));
					array[i * 256 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num7 * 255f + 0.5f));
				}
			}
			val.SetPixels32(array);
			val.Apply(true, true);
			return val;
		}

		private static float Bump(float x)
		{
			if (!(x <= -1f) && !(x >= 1f))
			{
				return (1f - x * x) * (1f - x * x);
			}
			return 0f;
		}

		private void OnWillRenderObject()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Camera current = Camera.current;
			if ((Object)(object)current != (Object)null)
			{
				Paint(((Component)current).transform.position, ((Component)current).transform.up, SceneLight.Level);
			}
		}

		internal void Paint(Vector3 eye, Vector3 up, float level)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.InverseTransformPoint(eye);
			Vector3 val2 = val - _eye;
			if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
			{
				val2 = up - _up;
				if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f && Mathf.Abs(level - _level) < 0.002f)
				{
					return;
				}
			}
			_eye = val;
			_up = up;
			_level = level;
			Vector3 position = ((Component)this).transform.position;
			Vector3 val3 = eye - position;
			float num = 1.1f;
			float magnitude = ((Vector3)(ref val3)).magnitude;
			float num2 = magnitude / num;
			float num3 = Mathf.Clamp01((num2 - 1.25f) / 0.35000002f);
			num3 = num3 * num3 * (3f - 2f * num3);
			Vector3 val4 = val3 / Mathf.Max(magnitude, 0.0001f);
			Vector3 val5 = Vector3.Cross(up, -val4);
			if (num3 <= 0f || ((Vector3)(ref val5)).sqrMagnitude < 1E-06f)
			{
				_strength = 0f;
				for (int i = 0; i < 4; i++)
				{
					_corners[i] = Vector3.zero;
					_colours[i].a = 0;
				}
			}
			else
			{
				((Vector3)(ref val5)).Normalize();
				Vector3 val6 = Vector3.Cross(-val4, val5);
				float num4 = num * Mathf.Sqrt(1f - 1f / (num2 * num2)) * (magnitude + Depth * num) / (magnitude - num / num2);
				Vector3 val7 = position - val4 * (Depth * num);
				for (int j = 0; j < 4; j++)
				{
					_corners[j] = ((Component)this).transform.InverseTransformPoint(val7 + val5 * (((j & 1) == 0) ? (0f - num4) : num4) + val6 * (((j & 2) == 0) ? (0f - num4) : num4));
				}
				Color val8 = Color.Lerp(NightColour, DayColour, level);
				_strength = Mathf.Lerp(0.45f, 0.75f, level) * num3;
				Color32 val9 = default(Color32);
				((Color32)(ref val9))..ctor((byte)(val8.r * 255f + 0.5f), (byte)(val8.g * 255f + 0.5f), (byte)(val8.b * 255f + 0.5f), (byte)(_strength * 255f + 0.5f));
				for (int k = 0; k < 4; k++)
				{
					_colours[k] = val9;
				}
			}
			_mesh.vertices = _corners;
			_mesh.colors32 = _colours;
			_mesh.bounds = Reach;
		}

		private void OnDestroy()
		{
			if ((Object)(object)_mesh != (Object)null)
			{
				Object.Destroy((Object)(object)_mesh);
			}
		}
	}
	internal static class SceneLight
	{
		public const float Floor = 0.35f;

		public const float PerSecond = 0.35f;

		public const float Dark = 0.15f;

		public const float Bright = 0.5f;

		public const float SunShare = 0.25f;

		public const float Idle = 0.5f;

		private static int _frame = -1;

		private static float _level = -1f;

		private static float _followed;

		internal static float ForTest = float.NaN;

		internal static float Level
		{
			get
			{
				Follow();
				return _level;
			}
		}

		internal static float Strength => Mathf.Lerp(0.35f, 1f, Level);

		internal static float Target
		{
			get
			{
				if (!float.IsNaN(ForTest))
				{
					return Mathf.Clamp01(ForTest);
				}
				float ambient;
				float sun;
				return Measure(out ambient, out sun);
			}
		}

		internal static void Settle()
		{
			_level = Target;
			_frame = Time.frameCount;
			_followed = Time.unscaledTime;
		}

		internal static float Measure(out float ambient, out float sun)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			ambient = Luminance(RenderSettings.ambientLight);
			Light sun2 = RenderSettings.sun;
			sun = (((Object)(object)sun2 != (Object)null && ((Behaviour)sun2).isActiveAndEnabled) ? (Luminance(sun2.color) * sun2.intensity) : 0f);
			float num = Mathf.Max(ambient + 0.25f * sun, 0.0001f);
			return Mathf.Clamp01(Mathf.InverseLerp(Mathf.Log(0.15f), Mathf.Log(0.5f), Mathf.Log(num)));
		}

		private static float Luminance(Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if ((int)QualitySettings.activeColorSpace == 1)
			{
				c = ((Color)(ref c)).linear;
			}
			return 0.2126f * c.r + 0.7152f * c.g + 0.0722f * c.b;
		}

		private static void Follow()
		{
			if (_frame != Time.frameCount)
			{
				_frame = Time.frameCount;
				float target = Target;
				float unscaledTime = Time.unscaledTime;
				_level = ((_level < 0f || unscaledTime - _followed > 0.5f) ? target : Mathf.MoveTowards(_level, target, 0.35f * Mathf.Min(Time.unscaledDeltaTime, 0.1f)));
				_followed = unscaledTime;
			}
		}
	}
	[HarmonyPatch(typeof(Player), "Awake")]
	internal static class BubbleOnPlayers
	{
		private static bool Graphics => (int)SystemInfo.graphicsDeviceType != 4;

		private static void Postfix(Player __instance)
		{
			if (Graphics && (Object)(object)((Component)__instance).GetComponent<Bubble>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<Bubble>();
			}
		}
	}
	[HarmonyPatch(typeof(Character), "RPC_Damage")]
	internal static class NoHits
	{
		[HarmonyPriority(800)]
		private static bool Prefix(Character __instance, HitData __1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (!Shield.Protects(__instance))
			{
				return true;
			}
			if (__1 != null)
			{
				if ((int)__1.m_hitType == 10)
				{
					Rescue.Home((Player)__instance);
				}
				else
				{
					Retaliation.OnHit((Player)__instance, __1);
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Character), "ApplyDamage")]
	internal static class NoTicks
	{
		[HarmonyPriority(800)]
		private static bool Prefix(Character __instance)
		{
			return !Shield.Protects(__instance);
		}
	}
	[HarmonyPatch(typeof(Character), "RPC_Stagger")]
	internal static class NoStagger
	{
		[HarmonyPriority(800)]
		private static bool Prefix(Character __instance)
		{
			return !Shield.Protects(__instance);
		}
	}
	[HarmonyPatch(typeof(Character), "ApplyPushback", new Type[]
	{
		typeof(Vector3),
		typeof(float)
	})]
	internal static class NoPush
	{
		[HarmonyPriority(800)]
		private static bool Prefix(Character __instance)
		{
			return !Shield.Protects(__instance);
		}
	}
	[HarmonyPatch(typeof(Character), "UpdateHeatDamage")]
	internal static class NoHeat
	{
		[HarmonyPriority(800)]
		private static bool Prefix(Character __instance)
		{
			return !Shield.Protects(__instance);
		}
	}
	[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[]
	{
		typeof(StatusEffect),
		typeof(bool),
		typeof(int),
		typeof(float),
		typeof(short)
	})]
	internal static class NoHarmfulEffects
	{
		[HarmonyPriority(800)]
		private static bool Prefix(StatusEffect __0, Character ___m_character, ref StatusEffect __result)
		{
			if ((Object)(object)__0 == (Object)null || !Shield.Protects(___m_character) || Array.IndexOf(Shield.Harmful, __0.NameHash()) < 0)
			{
				return true;
			}
			__result = null;
			return false;
		}
	}
	[HarmonyPatch(typeof(Aoe), "OnHit")]
	internal static class NoLaunch
	{
		[HarmonyPriority(800)]
		private static void Prefix(Aoe __instance, Collider __0, ref bool __state)
		{
			__state = false;
			if (Shield.Up && __instance.m_launchCharacters && !((Object)(object)__0 == (Object)null))
			{
				GameObject val = Projectile.FindHitObject(__0);
				if (!((Object)(object)val == (Object)null) && Shield.Protects(val.GetComponent<Character>()))
				{
					__instance.m_launchCharacters = false;
					__state = true;
				}
			}
		}

		private static Exception Finalizer(Aoe __instance, bool __state, Exception __exception)
		{
			if (__state)
			{
				__instance.m_launchCharacters = true;
			}
			return __exception;
		}
	}
	internal static class Rescue
	{
		public static void Home(Player player)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (((Character)player).IsTeleporting())
			{
				return;
			}
			PlayerProfile val = (((Object)(object)Game.instance != (Object)null) ? Game.instance.GetPlayerProfile() : null);
			if (val != null)
			{
				Vector3 val2 = (val.HaveCustomSpawnPoint() ? val.GetCustomSpawnPoint() : val.GetHomePoint());
				if (((Character)player).TeleportTo(val2 + Vector3.up, ((Component)player).transform.rotation, true))
				{
					((Character)player).Message((MessageType)2, "$mysix_shield_home", 0, (Sprite)null, false);
				}
			}
		}
	}
	internal static class Retaliation
	{
		internal const float Cooldown = 0.75f;

		internal const float Push = 20f;

		private static readonly Dictionary<ZDOID, float> LastStruck = new Dictionary<ZDOID, float>();

		internal static int Sent { get; private set; }

		public static void OnHit(Player player, HitData hit)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			Character attacker = hit.GetAttacker();
			if (!Strikable((Character)(object)player, attacker))
			{
				return;
			}
			float now = Time.time;
			ZDOID zDOID = attacker.GetZDOID();
			if (LastStruck.TryGetValue(zDOID, out var value) && now - value < 0.75f)
			{
				return;
			}
			LastStruck[zDOID] = now;
			if (LastStruck.Count > 64)
			{
				foreach (ZDOID item in (from kv in LastStruck
					where now - kv.Value > 0.75f
					select kv.Key).ToList())
				{
					LastStruck.Remove(item);
				}
			}
			int percent = ((ShieldPlugin.LightningPercent != null) ? ShieldPlugin.LightningPercent.Value : 10);
			attacker.Damage(Strike(attacker, ((Component)player).transform.position, -hit.m_dir, percent, (Character)(object)player));
			Sent++;
			Bolts.Broadcast(((Character)player).GetCenterPoint(), attacker.GetCenterPoint());
		}

		internal static bool Strikable(Character him, Character attacker)
		{
			if ((Object)(object)attacker != (Object)null && (Object)(object)attacker != (Object)(object)him && !attacker.IsPlayer() && !attacker.IsTamed() && !attacker.IsDead())
			{
				return BaseAI.IsEnemy(attacker, him);
			}
			return false;
		}

		internal static float LightningFor(float maxHealth, int percent)
		{
			return maxHealth * (float)Mathf.Clamp(percent, 0, 100) / 100f;
		}

		internal static HitData Strike(Character target, Vector3 from, Vector3 fallback, int percent, Character by)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0061: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 dir = ((Component)target).transform.position - from;
			dir.y = 0f;
			if (((Vector3)(ref dir)).sqrMagnitude > 0.01f)
			{
				((Vector3)(ref dir)).Normalize();
			}
			else
			{
				dir = fallback;
				dir.y = 0f;
				dir = ((((Vector3)(ref dir)).sqrMagnitude > 0.01f) ? ((Vector3)(ref dir)).normalized : (((Component)target).transform.forward * -1f));
			}
			HitData val = new HitData
			{
				m_point = target.GetCenterPoint(),
				m_dir = dir,
				m_pushForce = 20f,
				m_staggerMultiplier = 100f,
				m_blockable = false,
				m_dodgeable = false,
				m_ranged = true,
				m_backstabBonus = 1f,
				m_hitType = (HitType)2,
				m_skill = (SkillType)0,
				m_damage = 
				{
					m_lightning = LightningFor(target.GetMaxHealth(), percent)
				}
			};
			val.SetAttacker(by);
			return val;
		}
	}
	internal static class Shield
	{
		internal const string WantKey = "mysix_accessibilityshield";

		internal static readonly int UpKey = StringExtensionMethods.GetStableHashCode("mysix_accessibilityshield_up");

		internal const string EffectName = "MySix_AccessibilityShield";

		internal static readonly int[] Harmful = new int[6]
		{
			SEMan.s_statusEffectBurning,
			SEMan.s_statusEffectSpirit,
			SEMan.s_statusEffectPoison,
			SEMan.s_statusEffectFrost,
			SEMan.s_statusEffectLightning,
			SEMan.s_statusEffectSmoked
		};

		private static readonly Func<Player, bool> TakeInput = AccessTools.MethodDelegate<Func<Player, bool>>(AccessTools.Method(typeof(Player), "TakeInput", (Type[])null, (Type[])null), (object)null, true);

		private static bool _up;

		private static Access.Verdict _verdict = Access.Verdict.NotInWorld;

		private static StatusEffect _effect;

		private static readonly KeyCode[] DebugKeys;

		public static bool Up => _up;

		internal static Access.Verdict Verdict => _verdict;

		internal static string KeyName => ZInput.KeyCodeToDisplayName((KeyCode)((ShieldPlugin.Key == null) ? 122 : ((int)ShieldPlugin.Key.Value)));

		internal static StatusEffect Effect
		{
			get
			{
				if ((Object)(object)_effect != (Object)null)
				{
					return _effect;
				}
				_effect = ScriptableObject.CreateInstance<StatusEffect>();
				((Object)_effect).name = "MySix_AccessibilityShield";
				_effect.m_name = "$mysix_shield_name";
				_effect.m_tooltip = "$mysix_shield_tooltip";
				_effect.m_icon = Icon.Load("shield");
				_effect.m_ttl = 0f;
				return _effect;
			}
		}

		public static bool Protects(Character c)
		{
			if (_up && (Object)(object)c != (Object)null)
			{
				return