Decompiled source of LoreAccurateDemigods v1.1.3

plugins/LoreAccurateDemigods.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using NorseDemigods;
using NorseDemigods.Abilities;
using NorseDemigods.Attributes;
using NorseDemigods.Controllers;
using NorseDemigods.StatusEffects;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LoreAccurateDemigods")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LoreAccurateDemigods")]
[assembly: AssemblyTitle("LoreAccurateDemigods")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LoreAccurateDemigods
{
	internal static class AIHold
	{
		private static readonly Dictionary<BaseAI, int> holds = new Dictionary<BaseAI, int>();

		public static void Acquire(Character character)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			BaseAI val = (((Object)(object)character != (Object)null) ? character.GetBaseAI() : null);
			if (!((Object)(object)val == (Object)null))
			{
				holds.TryGetValue(val, out var value);
				holds[val] = value + 1;
				if (value == 0)
				{
					((Behaviour)val).enabled = false;
					character.SetMoveDir(Vector3.zero);
				}
			}
		}

		public static void Release(Character character)
		{
			BaseAI val = (((Object)(object)character != (Object)null) ? character.GetBaseAI() : null);
			if (!((Object)(object)val == (Object)null) && holds.TryGetValue(val, out var value))
			{
				if (value <= 1)
				{
					holds.Remove(val);
					((Behaviour)val).enabled = true;
				}
				else
				{
					holds[val] = value - 1;
				}
			}
		}

		public static void AcquireFor(Character character, float seconds)
		{
			Acquire(character);
			((MonoBehaviour)Plugin.Instance).StartCoroutine(ReleaseAfter(character, seconds));
		}

		private static IEnumerator ReleaseAfter(Character character, float seconds)
		{
			yield return (object)new WaitForSeconds(seconds);
			Release(character);
		}
	}
	internal static class BossGifts
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		private static class Character_OnDeath_Patch
		{
			private static void Prefix(Character __instance)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				if (!__instance.IsPlayer() && __instance.IsBoss() && Utils.GetPrefabName(((Component)__instance).gameObject) == "Dragon")
				{
					ZRoutedRpc instance = ZRoutedRpc.instance;
					if (instance != null)
					{
						instance.InvokeRoutedRPC(0L, "LAD_BossGift", new object[1] { ((Component)__instance).transform.position });
					}
				}
			}
		}

		private const string RpcName = "LAD_BossGift";

		private const string Boss = "Dragon";

		private const float Range = 200f;

		private static float lastGift;

		public static void RegisterRpc()
		{
			ZRoutedRpc instance = ZRoutedRpc.instance;
			if (instance != null)
			{
				instance.Register<Vector3>("LAD_BossGift", (Action<long, Vector3>)RPC_BossKilled);
			}
		}

		private static void RPC_BossKilled(long sender, Vector3 position)
		{
			//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)
			Player localPlayer = Player.m_localPlayer;
			if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && !(Vector3.Distance(((Component)localPlayer).transform.position, position) > 200f) && !(Time.time - lastGift < 30f))
			{
				lastGift = Time.time;
				switch (Plugin.GodName(localPlayer))
				{
				case "Thor":
					((MonoBehaviour)Plugin.Instance).StartCoroutine(ThorGift(localPlayer));
					break;
				case "Kvasir":
					((MonoBehaviour)Plugin.Instance).StartCoroutine(KvasirGift(localPlayer));
					break;
				case "Njord":
					((MonoBehaviour)Plugin.Instance).StartCoroutine(NjordGift(localPlayer));
					break;
				}
			}
		}

		private static Vector3 SpotInFront(Player player, float distance)
		{
			//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_001e: 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_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_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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = ((Component)player).transform.forward;
			forward.y = 0f;
			Vector3 val = ((Component)player).transform.position + ((Vector3)(ref forward)).normalized * distance;
			int mask = LayerMask.GetMask(new string[4] { "Default", "static_solid", "terrain", "piece" });
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val + Vector3.up * 20f, Vector3.down, ref val2, 40f, mask))
			{
				return val;
			}
			return ((RaycastHit)(ref val2)).point;
		}

		private static void SpawnItem(string prefabName, Vector3 position, Quaternion rotation)
		{
			//IL_001d: 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)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null);
			if ((Object)(object)val != (Object)null)
			{
				Object.Instantiate<GameObject>(val, position, rotation);
			}
		}

		private static IEnumerator ThorGift(Player player)
		{
			yield return (object)new WaitForSeconds(20f);
			if (!((Object)(object)player == (Object)null))
			{
				Vector3 val = SpotInFront(player, 5f);
				AbilityLightningStrike.CreateLightningBeamEffects(val + Vector3.up * 45f, val);
				Helper.DestroyFx(Helper.SpawnGameObject(Resources.FxLightningHit, val, Quaternion.identity), false, false);
				Helper.PlaySoundEffect(Resources.SfxLightningStart, val);
				CameraShake.Add(val, 30f, 0.8f);
				GiftFx.Crater(val);
				SpawnItem("ThorStarShard", val + Vector3.up * 0.3f, Random.rotation);
				((Character)player).Message((MessageType)2, Loc.T("lad_gift_star"), 0, (Sprite)null, false);
			}
		}

		private static IEnumerator KvasirGift(Player player)
		{
			yield return (object)new WaitForSeconds(4f);
			if (!((Object)(object)player == (Object)null))
			{
				Vector3 spot = SpotInFront(player, 3f);
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 25f;
				GiftFx.BeeSwarm(spot + new Vector3(val.x, 4f, val.y), spot + Vector3.up * 1.2f, 4f);
				((Character)player).Message((MessageType)2, Loc.T("lad_gift_bees"), 0, (Sprite)null, false);
				yield return (object)new WaitForSeconds(4f);
				SpawnItem("KvasirPoetryBook", spot + Vector3.up * 1f, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f));
			}
		}

		private static IEnumerator NjordGift(Player player)
		{
			yield return (object)new WaitForSeconds(4f);
			if (!((Object)(object)player == (Object)null))
			{
				Vector3 spot = SpotInFront(player, 4f);
				GiftFx.IceSpike(spot);
				((Character)player).Message((MessageType)2, Loc.T("lad_gift_ice"), 0, (Sprite)null, false);
				yield return (object)new WaitForSeconds(4f);
				SpawnItem("NjordCane", spot + Vector3.up * 0.6f, Quaternion.Euler(0f, Random.Range(0f, 360f), 90f));
				Helper.PlaySoundEffect(Resources.SfxWaterSplash, spot);
			}
		}
	}
	internal static class GiftFx
	{
		private class Flight : MonoBehaviour
		{
			private Vector3 from;

			private Vector3 to;

			private float duration;

			private float time;

			public void Setup(Vector3 a, Vector3 b, float seconds)
			{
				//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)
				from = a;
				to = b;
				duration = seconds;
			}

			private void Update()
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				time += Time.deltaTime;
				float num = Mathf.Clamp01(time / duration);
				Vector3 val = new Vector3(Mathf.Sin(time * 3f), Mathf.Sin(time * 5f) * 0.5f, Mathf.Cos(time * 4f)) * 0.6f * (1f - num);
				((Component)this).transform.position = Vector3.Lerp(from, to, Mathf.SmoothStep(0f, 1f, num)) + val;
				if (num >= 1f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject, 0.1f);
					((Behaviour)this).enabled = false;
				}
			}
		}

		private class IceSpikeFx : MonoBehaviour
		{
			private const string SpikePrefab = "caverock_ice_stalagmite";

			private const string BreakPrefab = "caverock_ice_stalagmite_destruction";

			private const float GrowTime = 0.9f;

			private GameObject spike;

			private Bounds bounds;

			private LineRenderer[] cracks;

			private float time;

			private bool shattered;

			private void Start()
			{
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Expected O, but got Unknown
				//IL_014c: 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_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				spike = PrefabVisuals.Copy("caverock_ice_stalagmite", ((Component)this).transform);
				if ((Object)(object)spike == (Object)null)
				{
					spike = GameObject.CreatePrimitive((PrimitiveType)3);
					Object.DestroyImmediate((Object)(object)spike.GetComponent<Collider>());
					spike.transform.SetParent(((Component)this).transform, false);
					spike.transform.localScale = new Vector3(0.9f, 4f, 0.9f);
					((Renderer)spike.GetComponent<MeshRenderer>()).sharedMaterial = new Material(Combat.LineMaterial)
					{
						color = new Color(0.7f, 0.88f, 1f, 0.85f)
					};
				}
				spike.transform.localRotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
				bounds = PrefabVisuals.RendererBounds(spike);
				cracks = (LineRenderer[])(object)new LineRenderer[7];
				Color val2 = default(Color);
				for (int i = 0; i < cracks.Length; i++)
				{
					LineRenderer val = Combat.CreateLine(((Component)this).transform, "ice_crack", 7);
					val.startWidth = 0.04f;
					val.endWidth = 0.015f;
					((Color)(ref val2))..ctor(0.85f, 0.95f, 1f, 0.9f);
					val.endColor = val2;
					val.startColor = val2;
					((Renderer)val).enabled = false;
					cracks[i] = val;
				}
				Light obj = ((Component)this).gameObject.AddComponent<Light>();
				obj.color = new Color(0.6f, 0.85f, 1f);
				obj.range = 6f;
				obj.intensity = 1.2f;
				spike.transform.localScale = new Vector3(1f, 0.01f, 1f);
			}

			private void Update()
			{
				//IL_007f: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: 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_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0233: 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_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				time += Time.deltaTime;
				float num = Mathf.Clamp01(time / 0.9f);
				float num2 = ((num < 1f) ? (1f - (1f - num) * (1f - num) * (1f - num) * (1f - 2.2f * num)) : 1f);
				spike.transform.localScale = new Vector3(1f, Mathf.Max(0.01f, num2), 1f);
				int num3 = Mathf.Clamp(Mathf.FloorToInt((time - 0.9f) / 0.4f), 0, cracks.Length);
				for (int i = 0; i < cracks.Length; i++)
				{
					if (i < num3 && !((Renderer)cracks[i]).enabled)
					{
						float num4 = ((Bounds)(ref bounds)).size.y * Random.Range(0.15f, 0.8f);
						float num5 = Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z) * 0.55f;
						Vector3 val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward * num5;
						Vector3 val2 = ((Component)this).transform.position + Vector3.up * num4 + val;
						for (int j = 0; j < 7; j++)
						{
							cracks[i].SetPosition(j, val2 + Random.insideUnitSphere * 0.08f + Vector3.up * ((float)j * 0.16f - 0.48f) + val * ((float)j * 0.02f));
						}
						((Renderer)cracks[i]).enabled = true;
					}
				}
				if (!shattered && time >= 4f)
				{
					shattered = true;
					PrefabVisuals.Debris("caverock_ice_stalagmite_destruction", ((Component)this).transform.position, spike.transform.rotation, Vector3.one, 6f);
					CameraShake.Add(((Component)this).transform.position, 20f, 0.4f);
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		public const float SpikeShatterTime = 4f;

		public static void Crater(Vector3 spot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_006a: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("star_crater");
			val.transform.position = spot;
			Material sharedMaterial = new Material(Combat.LineMaterial)
			{
				color = new Color(0.05f, 0.04f, 0.035f, 0.85f)
			};
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
			Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>());
			obj.transform.SetParent(val.transform, false);
			obj.transform.localPosition = Vector3.up * 0.03f;
			obj.transform.localScale = new Vector3(3.2f, 0.02f, 3.2f);
			((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
			Material sharedMaterial2 = new Material(Combat.LineMaterial)
			{
				color = new Color(0.16f, 0.14f, 0.12f, 1f)
			};
			for (int i = 0; i < 14; i++)
			{
				float num = (float)i * MathF.PI * 2f / 14f + Random.Range(-0.15f, 0.15f);
				GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)3);
				Object.DestroyImmediate((Object)(object)obj2.GetComponent<Collider>());
				obj2.transform.SetParent(val.transform, false);
				obj2.transform.localPosition = new Vector3(Mathf.Cos(num), 0.1f, Mathf.Sin(num)) * Random.Range(1.5f, 2f);
				obj2.transform.localRotation = Random.rotation;
				obj2.transform.localScale = Vector3.one * Random.Range(0.2f, 0.45f);
				((Renderer)obj2.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial2;
			}
			DustCloud.Spawn(spot, 3f);
			Object.Destroy((Object)(object)val, 600f);
		}

		public static void BeeSwarm(Vector3 from, Vector3 to, float duration)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00a4: 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)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab("Beehive") : null);
			GameObject val2 = ((!((Object)(object)val != (Object)null)) ? null : val.GetComponent<Beehive>()?.m_beeEffect);
			GameObject val3 = new GameObject("kvasir_bees");
			val3.transform.position = from;
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject obj = Object.Instantiate<GameObject>(val2, val3.transform, false);
				obj.transform.localPosition = Vector3.zero;
				obj.SetActive(true);
			}
			BookModel.Build(val3.transform).transform.localPosition = Vector3.down * 0.6f;
			val3.AddComponent<Flight>().Setup(from, to, duration);
		}

		public static void IceSpike(Vector3 spot)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("njord_ice_spike");
			val.transform.position = spot;
			val.AddComponent<IceSpikeFx>();
		}
	}
	internal class CaneModel : MonoBehaviour
	{
		public float Length;

		public Vector3 GripLocal;

		private static Material wood;

		private static Material silver;

		private static Material brass;

		public static void Build(Transform meshTransform, Bounds meshBounds, Material baseMaterial)
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: 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_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)wood == (Object)null)
			{
				wood = MjolnirModel.Lit(baseMaterial, Mahogany());
				silver = MjolnirModel.Lit(baseMaterial, EngravedSilver());
				brass = MjolnirModel.Lit(baseMaterial, MjolnirModel.Grain(new Color(0.78f, 0.6f, 0.32f), new Color(0.58f, 0.43f, 0.2f), 0.2f));
				Material[] array = (Material[])(object)new Material[3] { wood, silver, brass };
				foreach (Material val in array)
				{
					if (val.HasProperty("_EmissionColor"))
					{
						val.SetColor("_EmissionColor", Color.black);
					}
					val.DisableKeyword("_EMISSION");
					if (val.HasProperty("_RimColor"))
					{
						val.SetColor("_RimColor", Color.black);
					}
				}
			}
			Vector3 size = ((Bounds)(ref meshBounds)).size;
			int num = MjolnirModel.Longest(size);
			int index = 3 - num - MjolnirModel.Second(size, num);
			float num2 = ((Vector3)(ref size))[num];
			GameObject val2 = new GameObject("njord_cane_model");
			val2.transform.SetParent(meshTransform, false);
			val2.transform.localRotation = Quaternion.LookRotation(MjolnirModel.Axis(index), MjolnirModel.Axis(num));
			CaneModel caneModel = val2.AddComponent<CaneModel>();
			Transform transform = val2.transform;
			float num3 = 0.55f * num2;
			float num4 = 0.011f * num2;
			caneModel.Length = num3;
			float num5 = -0.05f * num2;
			float num6 = 0f - num3;
			MjolnirModel.Cylinder(transform, wood, new Vector3(0f, (num5 + num6) * 0.5f, 0f), new Vector3(num4 * 2f, (num5 - num6) * 0.5f, num4 * 2f), Quaternion.identity);
			MjolnirModel.Cylinder(transform, brass, new Vector3(0f, num6 - 0.008f * num2, 0f), new Vector3(num4 * 2.1f, 0.018f * num2, num4 * 2.1f), Quaternion.identity);
			MjolnirModel.Cylinder(transform, silver, new Vector3(0f, -0.035f * num2, 0f), new Vector3(num4 * 3f, 0.025f * num2, num4 * 3f), Quaternion.identity);
			float num7 = 0.045f * num2;
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(0f, -0.005f * num2, num7);
			caneModel.GripLocal = val3 + new Vector3(0f, num7 + num4 * 1.4f, (0f - num7) * 0.35f);
			List<Vector3> list = new List<Vector3>();
			for (int j = 0; j <= 12; j++)
			{
				float num8 = Mathf.Lerp(MathF.PI, -0.75f, (float)j / 12f);
				list.Add(val3 + new Vector3(0f, Mathf.Sin(num8) * num7, Mathf.Cos(num8) * num7));
			}
			list.Insert(0, new Vector3(0f, -0.03f * num2, 0f));
			for (int k = 0; k < list.Count - 1; k++)
			{
				Vector3 val4 = list[k];
				Vector3 val5 = list[k + 1];
				float num9 = num4 * Mathf.Lerp(2.9f, 2.2f, (float)k / (float)list.Count);
				MjolnirModel.Cylinder(transform, silver, (val4 + val5) * 0.5f, new Vector3(num9, Vector3.Distance(val4, val5) * 0.6f, num9), Quaternion.FromToRotation(Vector3.up, val5 - val4));
			}
			((Object)MjolnirModel.Cylinder(transform, silver, list[list.Count - 1], new Vector3(num4 * 3f, num4 * 1.4f, num4 * 3f), Quaternion.identity)).name = "cane_knob";
			MeshRenderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren<MeshRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Renderer)componentsInChildren[i]).shadowCastingMode = (ShadowCastingMode)0;
			}
		}

		private static Texture2D Mahogany()
		{
			//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_0013: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, true)
			{
				wrapMode = (TextureWrapMode)0
			};
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Mathf.PerlinNoise((float)j * 0.35f, (float)i * 0.03f) * 0.7f + Mathf.PerlinNoise((float)j * 1.1f, (float)i * 0.1f) * 0.3f;
					val.SetPixel(j, i, Color.Lerp(new Color(0.2f, 0.07f, 0.04f), new Color(0.42f, 0.15f, 0.08f), num));
				}
			}
			val.Apply(true);
			return val;
		}

		private static Texture2D EngravedSilver()
		{
			//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_0013: Expected O, but got Unknown
			//IL_00bc: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, true)
			{
				wrapMode = (TextureWrapMode)0
			};
			Color val2 = default(Color);
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Mathf.Sin((float)j * 0.4f + Mathf.Sin((float)i * 0.25f) * 2.2f) * Mathf.Cos((float)i * 0.3f - Mathf.Sin((float)j * 0.2f));
					float num2 = Mathf.Lerp(0.62f, 0.85f, Mathf.PerlinNoise((float)j * 0.2f, (float)i * 0.2f));
					((Color)(ref val2))..ctor(num2, num2, num2 * 1.03f);
					if (Mathf.Abs(num) < 0.12f)
					{
						val2 *= 0.45f;
					}
					val2.a = 1f;
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply(true);
			return val;
		}
	}
	internal static class PrefabVisuals
	{
		public static GameObject Copy(string prefabName, Transform parent, bool colliders = false)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00f4: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: 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_0244: 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_025a: 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_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			LODGroup componentInChildren = val.GetComponentInChildren<LODGroup>(true);
			IEnumerable<Renderer> enumerable = (IEnumerable<Renderer>)((!((Object)(object)componentInChildren != (Object)null) || componentInChildren.GetLODs().Length == 0) ? ((Array)val.GetComponentsInChildren<MeshRenderer>(true)) : ((Array)componentInChildren.GetLODs()[0].renderers));
			GameObject val2 = new GameObject(prefabName + "_visual");
			Transform transform = val.transform;
			foreach (Renderer item in enumerable)
			{
				MeshFilter val3 = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent<MeshFilter>() : null);
				if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3.sharedMesh == (Object)null))
				{
					GameObject val4 = new GameObject(((Object)item).name);
					val4.transform.SetParent(val2.transform, false);
					val4.transform.localPosition = transform.InverseTransformPoint(((Component)item).transform.position);
					val4.transform.localRotation = Quaternion.Inverse(transform.rotation) * ((Component)item).transform.rotation;
					Vector3 lossyScale = ((Component)item).transform.lossyScale;
					Vector3 lossyScale2 = transform.lossyScale;
					val4.transform.localScale = new Vector3(lossyScale.x / lossyScale2.x, lossyScale.y / lossyScale2.y, lossyScale.z / lossyScale2.z);
					val4.AddComponent<MeshFilter>().sharedMesh = val3.sharedMesh;
					((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterials = item.sharedMaterials;
				}
			}
			if (colliders)
			{
				int layer = LayerMask.NameToLayer("static_solid");
				Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true);
				foreach (Collider val5 in componentsInChildren)
				{
					if (val5.isTrigger)
					{
						continue;
					}
					GameObject val6 = new GameObject("collider");
					val6.layer = layer;
					val6.transform.SetParent(val2.transform, false);
					val6.transform.localPosition = transform.InverseTransformPoint(((Component)val5).transform.position);
					val6.transform.localRotation = Quaternion.Inverse(transform.rotation) * ((Component)val5).transform.rotation;
					Vector3 lossyScale3 = ((Component)val5).transform.lossyScale;
					Vector3 lossyScale4 = transform.lossyScale;
					val6.transform.localScale = new Vector3(lossyScale3.x / lossyScale4.x, lossyScale3.y / lossyScale4.y, lossyScale3.z / lossyScale4.z);
					MeshCollider val7 = (MeshCollider)(object)((val5 is MeshCollider) ? val5 : null);
					if (val7 == null)
					{
						BoxCollider val8 = (BoxCollider)(object)((val5 is BoxCollider) ? val5 : null);
						if (val8 == null)
						{
							SphereCollider val9 = (SphereCollider)(object)((val5 is SphereCollider) ? val5 : null);
							if (val9 == null)
							{
								CapsuleCollider val10 = (CapsuleCollider)(object)((val5 is CapsuleCollider) ? val5 : null);
								if (val10 != null)
								{
									CapsuleCollider obj = val6.AddComponent<CapsuleCollider>();
									obj.center = val10.center;
									obj.radius = val10.radius;
									obj.height = val10.height;
									obj.direction = val10.direction;
								}
								else
								{
									Object.Destroy((Object)(object)val6);
								}
							}
							else
							{
								SphereCollider obj2 = val6.AddComponent<SphereCollider>();
								obj2.center = val9.center;
								obj2.radius = val9.radius;
							}
						}
						else
						{
							BoxCollider obj3 = val6.AddComponent<BoxCollider>();
							obj3.center = val8.center;
							obj3.size = val8.size;
						}
					}
					else
					{
						MeshCollider obj4 = val6.AddComponent<MeshCollider>();
						obj4.sharedMesh = val7.sharedMesh;
						obj4.convex = val7.convex;
					}
				}
			}
			if ((Object)(object)parent != (Object)null)
			{
				val2.transform.SetParent(parent, false);
			}
			return val2;
		}

		public static GameObject Debris(string prefabName, Vector3 position, Quaternion rotation, Vector3 scale, float life)
		{
			//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)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			ZNetView.m_forceDisableInit = true;
			GameObject val2;
			try
			{
				val2 = Object.Instantiate<GameObject>(val, position, rotation);
			}
			finally
			{
				ZNetView.m_forceDisableInit = false;
			}
			val2.transform.localScale = Vector3.Scale(val2.transform.localScale, scale);
			Object.Destroy((Object)(object)val2, life);
			return val2;
		}

		public static Bounds RendererBounds(GameObject go)
		{
			//IL_0025: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>();
			Bounds result = (Bounds)((componentsInChildren.Length != 0) ? componentsInChildren[0].bounds : new Bounds(go.transform.position, Vector3.one));
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				((Bounds)(ref result)).Encapsulate(val.bounds);
			}
			return result;
		}
	}
	internal static class Combat
	{
		private const float BuildingReach = 1.8f;

		private const float StaggerRepeat = 0.6f;

		private static int characterMask;

		private static Material lineMaterial;

		private static readonly Collider[] overlap = (Collider[])(object)new Collider[128];

		private static readonly List<Character> enemies = new List<Character>();

		private static readonly List<Character> characters = new List<Character>();

		private static readonly RaycastHit[] rayHits = (RaycastHit[])(object)new RaycastHit[32];

		private static readonly HashSet<IDestructible> singleHit = new HashSet<IDestructible>();

		private static int CharacterMask
		{
			get
			{
				if (characterMask == 0)
				{
					characterMask = LayerMask.GetMask(new string[4] { "character", "character_net", "character_ghost", "character_noenv" });
				}
				return characterMask;
			}
		}

		public static Material LineMaterial
		{
			get
			{
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				if ((Object)(object)lineMaterial == (Object)null)
				{
					string[] array = new string[3] { "Sprites/Default", "Legacy Shaders/Particles/Additive", "Particles/Standard Unlit" };
					for (int i = 0; i < array.Length; i++)
					{
						Shader val = Shader.Find(array[i]);
						if ((Object)(object)val != (Object)null)
						{
							lineMaterial = new Material(val);
							break;
						}
					}
				}
				return lineMaterial;
			}
		}

		public static List<Character> FindEnemies(Player attacker, Vector3 center, float radius)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = enemies;
			list.Clear();
			int num = Physics.OverlapSphereNonAlloc(center, radius, overlap, CharacterMask);
			for (int i = 0; i < num; i++)
			{
				Character componentInParent = ((Component)overlap[i]).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)attacker) && !componentInParent.IsDead() && !list.Contains(componentInParent) && BaseAI.IsEnemy((Character)(object)attacker, componentInParent))
				{
					list.Add(componentInParent);
				}
			}
			return list;
		}

		public static List<Character> FindCharacters(Vector3 center, float radius)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			characters.Clear();
			int num = Physics.OverlapSphereNonAlloc(center, radius, overlap, CharacterMask);
			for (int i = 0; i < num; i++)
			{
				Character componentInParent = ((Component)overlap[i]).GetComponentInParent<Character>();
				if ((Object)(object)componentInParent != (Object)null && !componentInParent.IsDead() && !characters.Contains(componentInParent))
				{
					characters.Add(componentInParent);
				}
			}
			return characters;
		}

		public static Character FindLookedAtEnemy(Player self, float range)
		{
			//IL_002f: 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)
			Transform val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Character result = null;
			float num = float.MaxValue;
			int num2 = Physics.SphereCastNonAlloc(val.position, 0.6f, val.forward, rayHits, range, CharacterMask);
			for (int i = 0; i < num2; i++)
			{
				Character componentInParent = ((Component)((RaycastHit)(ref rayHits[i])).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)self) && !componentInParent.IsDead() && BaseAI.IsEnemy((Character)(object)self, componentInParent) && ((RaycastHit)(ref rayHits[i])).distance < num)
				{
					num = ((RaycastHit)(ref rayHits[i])).distance;
					result = componentInParent;
				}
			}
			return result;
		}

		public static Character FindAimed(Player self, float range, float maxAngle, List<Character> skip = null)
		{
			//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_0012: 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_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_006c: Unknown result type (might be due to invalid IL or missing references)
			Character result = null;
			float num = maxAngle;
			Vector3 centerPoint = ((Character)self).GetCenterPoint();
			Vector3 lookDir = ((Character)self).GetLookDir();
			int num2 = Physics.OverlapSphereNonAlloc(centerPoint, range, overlap, CharacterMask);
			for (int i = 0; i < num2; i++)
			{
				Character componentInParent = ((Component)overlap[i]).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)self) && !componentInParent.IsDead() && (skip == null || !skip.Contains(componentInParent)))
				{
					float num3 = Vector3.Angle(lookDir, componentInParent.GetCenterPoint() - centerPoint);
					if (num3 < num)
					{
						num = num3;
						result = componentInParent;
					}
				}
			}
			return result;
		}

		public static void Hit(Player attacker, Character target, float blunt, float lightning, float push, float stunTime)
		{
			//IL_0002: 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)
			Hit(attacker, target, new DamageTypes
			{
				m_blunt = blunt,
				m_lightning = lightning
			}, push, stunTime);
		}

		public static void Hit(Player attacker, Character target, DamageTypes damage, float push, float stunTime)
		{
			//IL_0002: 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)
			Hit(attacker, target, damage, push, stunTime, ((Component)attacker).transform.position);
		}

		public static void Hit(Player attacker, Character target, DamageTypes damage, float push, float stunTime, Vector3 from)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0069: 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: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			((DamageTypes)(ref damage)).Modify(Plugin.DamageBalance.Value);
			if (target is Player)
			{
				damage.m_damage += damage.m_spirit;
				damage.m_spirit = 0f;
			}
			Vector3 dir = ((Component)target).transform.position - from;
			dir.y = 0f;
			dir = ((((Vector3)(ref dir)).sqrMagnitude > 0.001f) ? ((Vector3)(ref dir)).normalized : ((Component)attacker).transform.forward);
			HitData val = new HitData();
			val.m_damage = damage;
			val.m_point = target.GetCenterPoint();
			val.m_dir = dir;
			val.m_pushForce = push;
			val.m_staggerMultiplier = 10f;
			val.SetAttacker((Character)(object)attacker);
			target.Damage(val);
			if (stunTime > 0f)
			{
				((MonoBehaviour)Plugin.Instance).StartCoroutine(Stun(target, dir, stunTime));
			}
		}

		public static void DamageEnvironment(Player attacker, Vector3 center, float radius, float damage)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			DamageEnvironment(attacker, center, radius, damage, buildings: false, 2);
		}

		public static void DamageEnvironment(Player attacker, Vector3 center, float radius, float damage, bool buildings, short toolTier)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			singleHit.Clear();
			DamageEnvironment(attacker, center, radius, damage, buildings, toolTier, singleHit, 1f);
		}

		public static void DamageEnvironment(Player attacker, Vector3 center, float radius, float damage, bool buildings, short toolTier, HashSet<IDestructible> done, float treeFactor)
		{
			//IL_0009: 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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00fa: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (damage <= 0f)
			{
				return;
			}
			int num = Physics.OverlapSphereNonAlloc(center, radius, overlap);
			for (int i = 0; i < num; i++)
			{
				Collider val = overlap[i];
				IDestructible componentInParent = ((Component)val).GetComponentInParent<IDestructible>();
				if (componentInParent == null || componentInParent is Character || (!buildings && componentInParent is WearNTear))
				{
					continue;
				}
				Bounds bounds;
				Vector3 val2;
				if (componentInParent is WearNTear)
				{
					bounds = val.bounds;
					val2 = ((Bounds)(ref bounds)).ClosestPoint(center) - center;
					if (((Vector3)(ref val2)).sqrMagnitude > 3.2399998f)
					{
						continue;
					}
				}
				if (done.Add(componentInParent))
				{
					float num2 = ((componentInParent is TreeBase || componentInParent is TreeLog) ? (damage * treeFactor) : damage);
					HitData val3 = new HitData();
					val3.m_damage.m_blunt = num2;
					val3.m_damage.m_chop = num2;
					val3.m_damage.m_pickaxe = num2;
					val3.m_toolTier = toolTier;
					Vector3 point;
					if (!SupportsClosestPoint(val))
					{
						bounds = val.bounds;
						point = ((Bounds)(ref bounds)).ClosestPoint(center);
					}
					else
					{
						point = val.ClosestPoint(center);
					}
					val3.m_point = point;
					val2 = val3.m_point - center;
					Vector3 dir;
					if (!(((Vector3)(ref val2)).sqrMagnitude > 0.001f))
					{
						dir = Vector3.down;
					}
					else
					{
						val2 = val3.m_point - center;
						dir = ((Vector3)(ref val2)).normalized;
					}
					val3.m_dir = dir;
					val3.m_hitCollider = val;
					val3.SetAttacker((Character)(object)attacker);
					componentInParent.Damage(val3);
				}
			}
		}

		private static bool SupportsClosestPoint(Collider collider)
		{
			if (!(collider is BoxCollider) && !(collider is SphereCollider) && !(collider is CapsuleCollider))
			{
				MeshCollider val = (MeshCollider)(object)((collider is MeshCollider) ? collider : null);
				if (val != null)
				{
					return val.convex;
				}
				return false;
			}
			return true;
		}

		internal static IEnumerator Stun(Character target, Vector3 dir, float duration)
		{
			//IL_000e: 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)
			for (float elapsed = 0f; elapsed < duration; elapsed += 0.6f)
			{
				if (!((Object)(object)target != (Object)null))
				{
					break;
				}
				if (target.IsDead())
				{
					break;
				}
				if (!target.IsStaggering())
				{
					target.Stagger(-dir);
				}
				yield return (object)new WaitForSeconds(0.6f);
			}
		}

		public static LineRenderer CreateLine(Transform parent, string name, int points)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			LineRenderer obj = val.AddComponent<LineRenderer>();
			obj.useWorldSpace = true;
			obj.positionCount = points;
			((Renderer)obj).sharedMaterial = LineMaterial;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			obj.numCapVertices = 2;
			return obj;
		}
	}
	internal static class CooldownHud
	{
		private struct Entry
		{
			public Texture2D Icon;

			public float Left;

			public float Total;

			public bool Active;

			public string Text;

			public float Shade;
		}

		private const int IconSize = 64;

		private static Texture2D tentacles;

		private static Texture2D volley;

		private static Texture2D ghost;

		private static Texture2D knife;

		private static Texture2D storm;

		private static Texture2D snow;

		private static Texture2D book;

		private static Texture2D pixel;

		private static Texture2D hammer;

		private static Texture2D leap;

		private static Texture2D bubble;

		private static Texture2D disguise;

		private static Texture2D skyArrow;

		private static GUIStyle label;

		private static readonly List<Entry> entries = new List<Entry>();

		private static readonly string[] SwingText = new string[4] { "0/3", "1/3", "2/3", "3/3" };

		public static string CurrentGod;

		private static readonly Dictionary<int, string> secondTexts = new Dictionary<int, string>();

		private static float nextBookRead;

		private static int bookCharges = -1;

		private static string bookText;

		private static Texture2D Storm
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)storm != (Object)null))
				{
					return storm = Build(new Color(0.22f, 0.25f, 0.35f), delegate(Color[] canvas)
					{
						//IL_00c9: 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_00f2: 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_011b: Unknown result type (might be due to invalid IL or missing references)
						//IL_012a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0019: 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_009c: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
						//IL_0035: Unknown result type (might be due to invalid IL or missing references)
						//IL_0040: Unknown result type (might be due to invalid IL or missing references)
						//IL_0051: 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)
						Vector2 val = default(Vector2);
						for (int i = 0; i < 64; i++)
						{
							for (int j = 0; j < 64; j++)
							{
								((Vector2)(ref val))..ctor((float)j, (float)i);
								if (Vector2.Distance(val, new Vector2(24f, 42f)) < 10f || Vector2.Distance(val, new Vector2(36f, 45f)) < 12f || Vector2.Distance(val, new Vector2(46f, 40f)) < 8f || (i > 34 && i < 42 && j > 16 && j < 52))
								{
									canvas[i * 64 + j] = new Color(0.85f, 0.88f, 0.95f, 1f);
								}
							}
						}
						Line(canvas, new Vector2(34f, 32f), new Vector2(27f, 22f), 2f);
						Line(canvas, new Vector2(27f, 22f), new Vector2(35f, 22f), 2f);
						Line(canvas, new Vector2(35f, 22f), new Vector2(28f, 10f), 2f);
					});
				}
				return storm;
			}
		}

		private static Texture2D Snow
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)snow != (Object)null))
				{
					return snow = Build(new Color(0.3f, 0.5f, 0.65f), delegate(Color[] canvas)
					{
						//IL_003a: Unknown result type (might be due to invalid IL or missing references)
						//IL_003b: Unknown result type (might be due to invalid IL or missing references)
						//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_004b: Unknown result type (might be due to invalid IL or missing references)
						//IL_004e: Unknown result type (might be due to invalid IL or missing references)
						//IL_004f: 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_0067: Unknown result type (might be due to invalid IL or missing references)
						//IL_006c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0070: 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_0083: Unknown result type (might be due to invalid IL or missing references)
						//IL_0085: Unknown result type (might be due to invalid IL or missing references)
						//IL_0087: 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_0094: Unknown result type (might be due to invalid IL or missing references)
						//IL_0099: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
						//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
						//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
						//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
						//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
						//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
						//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
						Vector2 val = default(Vector2);
						((Vector2)(ref val))..ctor(32f, 32f);
						Vector2 val2 = default(Vector2);
						Vector2 val4 = default(Vector2);
						for (int i = 0; i < 6; i++)
						{
							float num = (float)i * MathF.PI / 3f;
							((Vector2)(ref val2))..ctor(Mathf.Cos(num), Mathf.Sin(num));
							Vector2 b = val + val2 * 20f;
							Line(canvas, val, b, 2f);
							Vector2 val3 = val + val2 * 13f;
							((Vector2)(ref val4))..ctor(0f - val2.y, val2.x);
							Line(canvas, val3, val3 + (val2 + val4) * 5f, 1.5f);
							Line(canvas, val3, val3 + (val2 - val4) * 5f, 1.5f);
						}
					});
				}
				return snow;
			}
		}

		private static Texture2D Book
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)book != (Object)null))
				{
					return book = Build(new Color(0.45f, 0.3f, 0.12f), delegate(Color[] canvas)
					{
						//IL_000b: 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_0043: 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_0070: 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_009d: 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_00c6: 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)
						Line(canvas, new Vector2(32f, 16f), new Vector2(32f, 48f), 1.5f);
						for (int i = 0; i < 4; i++)
						{
							float num = 22f + (float)i * 7f;
							Line(canvas, new Vector2(15f, num), new Vector2(28f, num + 1f), 1.2f);
							Line(canvas, new Vector2(36f, num + 1f), new Vector2(49f, num), 1.2f);
						}
						Line(canvas, new Vector2(12f, 14f), new Vector2(32f, 16f), 2f);
						Line(canvas, new Vector2(32f, 16f), new Vector2(52f, 14f), 2f);
					});
				}
				return book;
			}
		}

		private static Texture2D Pixel
		{
			get
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)pixel == (Object)null)
				{
					pixel = new Texture2D(1, 1);
					pixel.SetPixel(0, 0, Color.white);
					pixel.Apply();
				}
				return pixel;
			}
		}

		private static Texture2D Tentacles
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)tentacles != (Object)null))
				{
					return tentacles = Build(new Color(0.1f, 0.45f, 0.5f), delegate(Color[] canvas)
					{
						//IL_0056: Unknown result type (might be due to invalid IL or missing references)
						//IL_0057: Unknown result type (might be due to invalid IL or missing references)
						//IL_006c: Unknown result type (might be due to invalid IL or missing references)
						//IL_006e: Unknown result type (might be due to invalid IL or missing references)
						Vector2 a = default(Vector2);
						Vector2 val = default(Vector2);
						for (int i = 0; i < 3; i++)
						{
							float num = 18f + (float)i * 14f;
							((Vector2)(ref a))..ctor(num, 12f);
							for (int j = 1; j <= 20; j++)
							{
								float num2 = 12f + (float)j * 2f;
								((Vector2)(ref val))..ctor(num + Mathf.Sin((float)j * 0.45f + (float)i) * 5f, num2);
								Line(canvas, a, val, 3.2f - (float)j * 0.1f);
								a = val;
							}
						}
					});
				}
				return tentacles;
			}
		}

		private static Texture2D Volley
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)volley != (Object)null))
				{
					return volley = Build(new Color(0.25f, 0.45f, 0.15f), delegate(Color[] canvas)
					{
						//IL_001d: 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_003e: 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_0065: 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)
						for (int i = 0; i < 3; i++)
						{
							float num = 20f + (float)i * 12f;
							Line(canvas, new Vector2(num, 52f), new Vector2(num, 16f), 2f);
							Line(canvas, new Vector2(num, 14f), new Vector2(num - 5f, 22f), 2f);
							Line(canvas, new Vector2(num, 14f), new Vector2(num + 5f, 22f), 2f);
						}
					});
				}
				return volley;
			}
		}

		private static Texture2D Disguise
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)disguise != (Object)null))
				{
					return disguise = Build(new Color(0.2f, 0.38f, 0.18f), delegate(Color[] canvas)
					{
						//IL_0019: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						//IL_0040: Unknown result type (might be due to invalid IL or missing references)
						//IL_0051: 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_008d: 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)
						Vector2 val = default(Vector2);
						for (int i = 0; i < 64; i++)
						{
							for (int j = 0; j < 64; j++)
							{
								((Vector2)(ref val))..ctor((float)j, (float)i);
								if (Vector2.Distance(val, new Vector2(22f, 26f)) < 11f || Vector2.Distance(val, new Vector2(42f, 26f)) < 11f || Vector2.Distance(val, new Vector2(32f, 36f)) < 13f)
								{
									canvas[i * 64 + j] = new Color(0.6f, 0.85f, 0.45f, 1f);
								}
							}
						}
					});
				}
				return disguise;
			}
		}

		private static Texture2D SkyArrow
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)skyArrow != (Object)null))
				{
					return skyArrow = Build(new Color(0.25f, 0.3f, 0.6f), delegate(Color[] canvas)
					{
						//IL_000b: 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_0034: 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_005d: 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_0086: 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_00af: 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)
						Line(canvas, new Vector2(32f, 10f), new Vector2(32f, 54f), 2.5f);
						Line(canvas, new Vector2(32f, 56f), new Vector2(22f, 42f), 2.5f);
						Line(canvas, new Vector2(32f, 56f), new Vector2(42f, 42f), 2.5f);
						Line(canvas, new Vector2(32f, 12f), new Vector2(24f, 6f), 2f);
						Line(canvas, new Vector2(32f, 12f), new Vector2(40f, 6f), 2f);
					});
				}
				return skyArrow;
			}
		}

		private static Texture2D Ghost
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)ghost != (Object)null))
				{
					return ghost = Build(new Color(0.3f, 0.4f, 0.65f), delegate(Color[] canvas)
					{
						//IL_0019: 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_005d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0068: Unknown result type (might be due to invalid IL or missing references)
						//IL_0079: Unknown result type (might be due to invalid IL or missing references)
						//IL_0084: Unknown result type (might be due to invalid IL or missing references)
						//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
						//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
						Vector2 val = default(Vector2);
						for (int i = 0; i < 64; i++)
						{
							for (int j = 0; j < 64; j++)
							{
								((Vector2)(ref val))..ctor((float)j, (float)i);
								bool num = Vector2.Distance(val, new Vector2(32f, 38f)) < 14f;
								bool flag = j > 18 && j < 46 && i > 14 && i <= 38 && (i >= 20 || j / 5 % 2 != 0);
								bool flag2 = Vector2.Distance(val, new Vector2(26f, 40f)) < 3f || Vector2.Distance(val, new Vector2(38f, 40f)) < 3f;
								if ((num || flag) && !flag2)
								{
									canvas[i * 64 + j] = new Color(0.9f, 0.95f, 1f, 1f);
								}
							}
						}
					});
				}
				return ghost;
			}
		}

		private static Texture2D Hammer
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)hammer != (Object)null))
				{
					return hammer = Build(new Color(0.2f, 0.35f, 0.6f), delegate(Color[] canvas)
					{
						//IL_000b: 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_0034: 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)
						Line(canvas, new Vector2(32f, 12f), new Vector2(32f, 40f), 2.5f);
						Line(canvas, new Vector2(18f, 44f), new Vector2(46f, 44f), 6f);
					});
				}
				return hammer;
			}
		}

		private static Texture2D Leap
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)leap != (Object)null))
				{
					return leap = Build(new Color(0.15f, 0.45f, 0.6f), delegate(Color[] canvas)
					{
						//IL_000b: 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_0034: 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_005d: 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)
						Line(canvas, new Vector2(32f, 12f), new Vector2(32f, 50f), 2.5f);
						Line(canvas, new Vector2(32f, 52f), new Vector2(20f, 38f), 2.5f);
						Line(canvas, new Vector2(32f, 52f), new Vector2(44f, 38f), 2.5f);
					});
				}
				return leap;
			}
		}

		private static Texture2D Bubble
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)bubble != (Object)null))
				{
					return bubble = Build(new Color(0.15f, 0.4f, 0.65f), delegate(Color[] canvas)
					{
						//IL_0056: 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_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_0078: Unknown result type (might be due to invalid IL or missing references)
						//IL_0087: Unknown result type (might be due to invalid IL or missing references)
						Vector2 a = default(Vector2);
						((Vector2)(ref a))..ctor(50f, 32f);
						Vector2 val = default(Vector2);
						for (int i = 1; i <= 32; i++)
						{
							float num = (float)i * MathF.PI * 2f / 32f;
							((Vector2)(ref val))..ctor(32f + Mathf.Cos(num) * 18f, 32f + Mathf.Sin(num) * 18f);
							Line(canvas, a, val, 1.8f);
							a = val;
						}
						Line(canvas, new Vector2(23f, 38f), new Vector2(27f, 43f), 2f);
					});
				}
				return bubble;
			}
		}

		private static Texture2D Knife
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)knife != (Object)null))
				{
					return knife = Build(new Color(0.5f, 0.15f, 0.12f), delegate(Color[] canvas)
					{
						//IL_000b: 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_0034: 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_005d: 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_0086: 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)
						Line(canvas, new Vector2(18f, 16f), new Vector2(26f, 24f), 4f);
						Line(canvas, new Vector2(20f, 30f), new Vector2(32f, 18f), 2.5f);
						Line(canvas, new Vector2(26f, 24f), new Vector2(48f, 48f), 3.5f);
						Line(canvas, new Vector2(30f, 24f), new Vector2(48f, 48f), 1.5f);
					});
				}
				return knife;
			}
		}

		public static void Draw()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0039: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Expected O, but got Unknown
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0816: Unknown result type (might be due to invalid IL or missing references)
			//IL_0848: Unknown result type (might be due to invalid IL or missing references)
			//IL_0878: Unknown result type (might be due to invalid IL or missing references)
			//IL_0862: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || (int)Event.current.type != 7 || (Object)(object)Hud.instance == (Object)null)
			{
				return;
			}
			if (NjordBubble.Bleeding)
			{
				Color color = GUI.color;
				GUI.color = new Color(0.8f, 0.05f, 0.03f, 0.1f + 0.03f * Mathf.Sin(Time.time * 3f));
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Pixel);
				GUI.color = color;
			}
			entries.Clear();
			if (CurrentGod == "Njord")
			{
				if (NjordFrost.CooldownLeft > 0f)
				{
					Add(Snow, NjordFrost.CooldownLeft, 30f, active: false);
				}
				if (NjordBubble.Active)
				{
					entries.Add(new Entry
					{
						Icon = Bubble,
						Active = true,
						Text = NjordBubble.Status
					});
					entries.Add(new Entry
					{
						Icon = Bubble,
						Active = true,
						Text = NjordBubble.HealthText,
						Shade = NjordBubble.HealthLost
					});
				}
				else if (NjordBubble.CooldownLeft > 0f)
				{
					Add(Bubble, NjordBubble.CooldownLeft, 300f, active: false);
				}
				Add(Tentacles, NjordTentacles.CooldownLeft, Plugin.TentacleCooldown.Value, NjordTentacles.Held);
				if (NjordSwing.Active)
				{
					entries.Add(new Entry
					{
						Icon = Leap,
						Active = true,
						Text = SwingText[Mathf.Clamp(NjordSwing.SwingsLeft, 0, 3)]
					});
				}
				else if (NjordSwing.CooldownLeft > 0f)
				{
					Add(Leap, NjordSwing.CooldownLeft, 26f, active: false);
				}
				if (NjordCane.HasCane(localPlayer) || NjordCane.StormCooldownLeft > 0f || NjordCane.IceCooldownLeft > 0f)
				{
					Add(Storm, NjordCane.StormCooldownLeft, Plugin.StormCooldown.Value, StormControl.Active);
					Add(Snow, NjordCane.IceCooldownLeft, Plugin.IceCooldown.Value, active: false);
				}
			}
			else if (CurrentGod == "Thor")
			{
				if (ThorStorm.Whirling)
				{
					entries.Add(new Entry
					{
						Icon = Hammer,
						Active = true,
						Text = Loc.T("lad_hud_meters", ThorStorm.RangeMeters)
					});
				}
				else if (ThorStorm.ThrowCooldownLeft > 0f)
				{
					Add(Hammer, ThorStorm.ThrowCooldownLeft, ThorStorm.ThrowCooldownTotal, active: false);
				}
				if (ThorStorm.Beaming || ThorStorm.BeamCooldownLeft > 0f)
				{
					Add(Storm, ThorStorm.BeamCooldownLeft, ThorStorm.BeamCooldownTotal, ThorStorm.Beaming);
				}
				if (ThorStorm.IsCharged || ThorStorm.Leaping || ThorStorm.LeapCooldownLeft > 0f)
				{
					float leapCooldownLeft = ThorStorm.LeapCooldownLeft;
					entries.Add(new Entry
					{
						Icon = Leap,
						Left = leapCooldownLeft,
						Total = ThorStorm.LeapCooldownTotal,
						Active = ThorStorm.Leaping,
						Text = ((leapCooldownLeft > 0f || !ThorStorm.IsCharged) ? null : Loc.T("lad_hud_seconds", ThorStorm.ChargedSeconds))
					});
				}
			}
			else if (CurrentGod == "Kvasir")
			{
				Add(Volley, KvasirAbilities.VolleyCooldownLeft, Plugin.VolleyCooldown.Value, active: false);
				Add(Ghost, KvasirAbilities.PhaseCooldownLeft, KvasirAbilities.PhaseCooldownTotal, KvasirAbilities.GhostActive);
				if (KvasirGator.RestShown(localPlayer) > 0f)
				{
					Add(Leap, KvasirGator.RestShown(localPlayer), 300f, active: false);
				}
				Add(Knife, KvasirGrab.CooldownLeft, Plugin.GrabCooldown.Value, active: false);
				Add(Disguise, KvasirDisguise.CooldownLeft, Plugin.DisguiseCooldown.Value, KvasirDisguise.Hidden);
				if (KvasirSkyArrow.Aiming)
				{
					entries.Add(new Entry
					{
						Icon = SkyArrow,
						Active = true,
						Text = Loc.T("lad_hud_seconds", KvasirSkyArrow.Spent)
					});
				}
				else
				{
					Add(SkyArrow, KvasirSkyArrow.CooldownLeft, Plugin.SkyArrowCooldown.Value, active: false);
				}
				if (Time.time >= nextBookRead)
				{
					nextBookRead = Time.time + 0.5f;
					ItemData val = KvasirBook.EquippedBook(localPlayer);
					int num = ((val != null) ? KvasirBook.Charges(val) : (-1));
					if (num != bookCharges)
					{
						bookCharges = num;
						bookText = $"{num}/{10}";
					}
				}
				if (bookCharges >= 0)
				{
					entries.Add(new Entry
					{
						Icon = Book,
						Left = ((bookCharges < 3) ? 1f : 0f),
						Total = 1f,
						Active = KvasirBook.Reading,
						Text = bookText
					});
				}
			}
			if (entries.Count == 0)
			{
				return;
			}
			float num2 = (float)Screen.height / 1080f;
			float num3 = 48f * num2;
			float num4 = 10f * num2;
			float num5 = (float)Screen.height * 0.3f;
			float num6 = (float)Screen.width - 24f * num2 - num3;
			if (label == null)
			{
				label = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)1,
					fontStyle = (FontStyle)1
				};
			}
			label.fontSize = Mathf.RoundToInt(16f * num2);
			Color color2 = GUI.color;
			Rect val2 = default(Rect);
			Rect val3 = default(Rect);
			for (int num7 = entries.Count - 1; num7 >= 0; num7--)
			{
				Entry entry = entries[num7];
				((Rect)(ref val2))..ctor(num6, num5, num3, num3);
				bool flag = entry.Left > 0f && !entry.Active;
				GUI.color = (Color)(entry.Active ? new Color(1f, 1f, 1f, 1f) : (flag ? new Color(0.45f, 0.45f, 0.45f, 0.9f) : Color.white));
				GUI.DrawTexture(val2, (Texture)(object)entry.Icon);
				if (flag && entry.Total > 0f)
				{
					float num8 = Mathf.Clamp01(entry.Left / entry.Total);
					GUI.color = new Color(0f, 0f, 0f, 0.55f);
					GUI.DrawTexture(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height * num8), (Texture)(object)Pixel);
				}
				if (entry.Shade > 0f)
				{
					GUI.color = new Color(0f, 0f, 0f, 0.6f);
					GUI.DrawTexture(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height * entry.Shade), (Texture)(object)Pixel);
				}
				if (flag || entry.Active || entry.Text != null)
				{
					string text = entry.Text ?? (entry.Active ? Loc.T("lad_hud_active") : FormatSeconds(entry.Left));
					((Rect)(ref val3))..ctor(((Rect)(ref val2)).x - num3 * 0.5f, ((Rect)(ref val2)).yMax + 2f * num2, num3 * 2f, 24f * num2);
					GUI.color = Color.black;
					GUI.Label(new Rect(((Rect)(ref val3)).x + 1f, ((Rect)(ref val3)).y + 1f, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height), text, label);
					GUI.color = (Color)(entry.Active ? new Color(0.7f, 0.9f, 1f) : Color.white);
					GUI.Label(val3, text, label);
				}
				num6 -= num3 + num4;
			}
			GUI.color = color2;
		}

		private static void Add(Texture2D icon, float left, float total, bool active)
		{
			entries.Add(new Entry
			{
				Icon = icon,
				Left = left,
				Total = total,
				Active = active
			});
		}

		private static string FormatSeconds(float seconds)
		{
			int num = Mathf.CeilToInt(seconds);
			if (!secondTexts.TryGetValue(num, out var value))
			{
				value = ((num >= 60) ? $"{num / 60}:{num % 60:00}" : num.ToString());
				secondTexts[num] = value;
			}
			return value;
		}

		private static Texture2D Build(Color tile, Action<Color[]> symbol)
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e3: 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)
			Color[] array = (Color[])(object)new Color[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Mathf.Max(Mathf.Abs((float)j - 31.5f) - 22f, 0f);
					float num2 = Mathf.Max(Mathf.Abs((float)i - 31.5f) - 22f, 0f);
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					if (num3 > 9.5f)
					{
						array[i * 64 + j] = Color.clear;
						continue;
					}
					Color val = Color.Lerp(tile * 0.6f, tile * 1.3f, (float)i / 64f);
					if (num3 > 7.5f || j < 2 || j > 61 || i < 2 || i > 61)
					{
						val = Color.Lerp(val, Color.white, 0.35f);
					}
					val.a = 1f;
					array[i * 64 + j] = val;
				}
			}
			symbol(array);
			Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1
			};
			val2.SetPixels(array);
			val2.Apply();
			return val2;
		}

		private static void Line(Color[] canvas, Vector2 a, Vector2 b, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_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)
			float num = Vector2.Distance(a, b);
			int num2 = Mathf.Max(1, Mathf.CeilToInt(num * 2f));
			for (int i = 0; i <= num2; i++)
			{
				Vector2 val = Vector2.Lerp(a, b, (float)i / (float)num2);
				int num3 = Mathf.CeilToInt(width);
				for (int j = -num3; j <= num3; j++)
				{
					for (int k = -num3; k <= num3; k++)
					{
						if (!((float)(k * k + j * j) > width * width))
						{
							int num4 = Mathf.RoundToInt(val.x) + k;
							int num5 = Mathf.RoundToInt(val.y) + j;
							if (num4 >= 0 && num4 < 64 && num5 >= 0 && num5 < 64 && canvas[num5 * 64 + num4].a > 0f)
							{
								canvas[num5 * 64 + num4] = new Color(0.95f, 0.95f, 0.95f, 1f);
							}
						}
					}
				}
			}
		}
	}
	internal static class DustCloud
	{
		private static Material material;

		internal static Material PuffMaterial => Material;

		private static Material Material
		{
			get
			{
				//IL_001f: 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_0034: Expected O, but got Unknown
				if ((Object)(object)material == (Object)null && (Object)(object)Combat.LineMaterial != (Object)null)
				{
					material = new Material(Combat.LineMaterial)
					{
						mainTexture = (Texture)(object)BuildPuffTexture()
					};
				}
				return material;
			}
		}

		public static void Spawn(Vector3 position, float radius)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0028: 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_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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: 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_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: 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_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			Material val = Material;
			if (!((Object)(object)val == (Object)null))
			{
				GameObject val2 = new GameObject("lad_dust");
				val2.SetActive(false);
				val2.transform.position = position + Vector3.up * 0.2f;
				ParticleSystem val3 = val2.AddComponent<ParticleSystem>();
				MainModule main = val3.main;
				((MainModule)(ref main)).playOnAwake = false;
				((MainModule)(ref main)).loop = false;
				((MainModule)(ref main)).duration = 0.3f;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.6f, 2.8f);
				((MainModule)(ref main)).startSpeed = new MinMaxCurve(radius * 1.2f, radius * 2.4f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(1.2f, 2.6f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
				((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.52f, 0.47f, 0.38f, 0.75f), new Color(0.66f, 0.61f, 0.52f, 0.75f));
				((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.02f);
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
				((MainModule)(ref main)).maxParticles = 120;
				EmissionModule emission = val3.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
				((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[2]
				{
					new Burst(0f, (short)55),
					new Burst(0.05f, (short)15)
				});
				ShapeModule shape = val3.shape;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
				((ShapeModule)(ref shape)).radius = radius * 0.35f;
				((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f);
				VelocityOverLifetimeModule velocityOverLifetime = val3.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.4f, 1.2f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(0f, 0f);
				LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val3.limitVelocityOverLifetime;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0.6f);
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.12f;
				SizeOverLifetimeModule sizeOverLifetime = val3.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 0.5f),
					new Keyframe(1f, 1.8f)
				}));
				RotationOverLifetimeModule rotationOverLifetime = val3.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-0.6f, 0.6f);
				ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
				Gradient val4 = new Gradient();
				val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.white, 0f),
					new GradientColorKey(Color.white, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
				{
					new GradientAlphaKey(0f, 0f),
					new GradientAlphaKey(1f, 0.08f),
					new GradientAlphaKey(0.6f, 0.5f),
					new GradientAlphaKey(0f, 1f)
				});
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val4);
				ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
				((Renderer)component).sharedMaterial = val;
				component.renderMode = (ParticleSystemRenderMode)0;
				component.sortMode = (ParticleSystemSortMode)1;
				((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)component).receiveShadows = false;
				val2.SetActive(true);
				val3.Play();
				Object.Destroy((O