Decompiled source of Hiruzen Sarutobi v1.0.2

Hiruzen.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using ExtraSkillSlots;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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("Hiruzen")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9c78e17b5df30654d3dda3a94ff921fd61e1dd0a")]
[assembly: AssemblyProduct("Hiruzen")]
[assembly: AssemblyTitle("Hiruzen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace HiruzenMod
{
	public static class Snd
	{
		private static readonly Dictionary<int, float> voiceUntil = new Dictionary<int, float>();

		public static void Init()
		{
			string path = Path.Combine(Media.Assets, "Audio", "Hiruzen.bnk");
			if (File.Exists(path))
			{
				SoundBanks.Add(File.ReadAllBytes(path));
			}
			else
			{
				Plugin.Log.LogWarning((object)"HIRUZEN_AUDIO bank missing");
			}
		}

		public static uint Sfx(string key, GameObject at)
		{
			if (!Object.op_Implicit((Object)(object)at))
			{
				return 0u;
			}
			return AkSoundEngine.PostEvent("Play_Hiruzen_" + key, at);
		}

		public static void Voice(CharacterBody body, string key, float length, bool grunt = false)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				int instanceID = ((Object)body).GetInstanceID();
				float time = Time.time;
				if ((!voiceUntil.TryGetValue(instanceID, out var value) || !(time < value)) && (!grunt || !(Random.value > 0.55f)))
				{
					voiceUntil[instanceID] = time + length;
					bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English;
					Sfx((flag ? "VE_" : "V_") + key, ((Component)body).gameObject);
					Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key);
				}
			}
		}
	}
	public static class Combat
	{
		public static Action<string> Trace;

		public static string Source = "";

		private static readonly Collider[] buffer = (Collider[])(object)new Collider[96];

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

		public static bool Target(HurtBox hurt, CharacterBody attacker)
		{
			//IL_006e: 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_007b: 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_0099: 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)
			if (!Object.op_Implicit((Object)(object)hurt) || !Object.op_Implicit((Object)(object)hurt.healthComponent) || !hurt.healthComponent.alive || !Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)attacker.teamComponent) || (Object)(object)hurt.healthComponent == (Object)(object)attacker.healthComponent)
			{
				return false;
			}
			CharacterBody body = hurt.healthComponent.body;
			if (((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent)) ? body.teamComponent.teamIndex : hurt.teamIndex) == attacker.teamComponent.teamIndex || hurt.teamIndex == attacker.teamComponent.teamIndex)
			{
				return false;
			}
			return FriendlyFireManager.ShouldDirectHitProceed(hurt.healthComponent, attacker.teamComponent.teamIndex);
		}

		public static bool TargetBody(CharacterBody victim, CharacterBody attacker)
		{
			//IL_0058: 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_0068: Invalid comparison between I4 and Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)attacker) || (Object)(object)victim == (Object)(object)attacker || !Object.op_Implicit((Object)(object)victim.healthComponent) || !victim.healthComponent.alive || !Object.op_Implicit((Object)(object)attacker.teamComponent))
			{
				return false;
			}
			if (((!Object.op_Implicit((Object)(object)victim.teamComponent)) ? (-1) : ((int)victim.teamComponent.teamIndex)) == (int)attacker.teamComponent.teamIndex)
			{
				return false;
			}
			return FriendlyFireManager.ShouldDirectHitProceed(victim.healthComponent, attacker.teamComponent.teamIndex);
		}

		public static bool Visible(Vector3 a, Vector3 b)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			return !Physics.Linecast(a, b, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
		}

		public static Vector3 Point(HurtBox h, Vector3 from)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			Collider val = (Object.op_Implicit((Object)(object)h) ? h.collider : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				if (!Object.op_Implicit((Object)(object)h))
				{
					return from;
				}
				return ((Component)h).transform.position;
			}
			return val.ClosestPoint(from);
		}

		public static bool Deal(CharacterBody attacker, HurtBox hurt, Vector3 position, float coefficient, float proc, bool crit, Vector3 force, DamageType type = (DamageType)0u, GameObject inflictor = null, DamageColorIndex color = (DamageColorIndex)0)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Target(hurt, attacker))
			{
				return false;
			}
			DamageInfo val = new DamageInfo
			{
				attacker = ((Component)attacker).gameObject,
				inflictor = (Object.op_Implicit((Object)(object)inflictor) ? inflictor : ((Component)attacker).gameObject),
				damage = attacker.damage * coefficient,
				crit = crit,
				position = position,
				force = force,
				procCoefficient = proc,
				damageType = DamageTypeCombo.op_Implicit(type),
				damageColorIndex = color
			};
			HealthComponent healthComponent = hurt.healthComponent;
			float combinedHealth = healthComponent.combinedHealth;
			healthComponent.TakeDamage(val);
			if (!val.rejected)
			{
				GlobalEventManager instance = GlobalEventManager.instance;
				if (instance != null)
				{
					instance.OnHitEnemy(val, ((Component)healthComponent).gameObject);
				}
				GlobalEventManager instance2 = GlobalEventManager.instance;
				if (instance2 != null)
				{
					instance2.OnHitAll(val, ((Component)healthComponent).gameObject);
				}
			}
			if (Trace != null)
			{
				Trace("DAMAGE source=" + Source + " victim=" + (Object.op_Implicit((Object)(object)healthComponent.body) ? ((Object)healthComponent.body).name : ((Object)healthComponent).name) + " team=" + ((Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent)) ? ((object)healthComponent.body.teamComponent.teamIndex/*cast due to .constrained prefix*/).ToString() : "?") + " coef=" + coefficient.ToString("0.00") + " loss=" + (combinedHealth - healthComponent.combinedHealth).ToString("0.0") + " rejected=" + val.rejected);
			}
			return !val.rejected;
		}

		public static int Capsule(CharacterBody attacker, Vector3 a, Vector3 b, float radius, List<HurtBox> into, HashSet<HealthComponent> exclude)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics.OverlapCapsuleNonAlloc(a, b, radius, buffer, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
			int num2 = 0;
			for (int i = 0; i < num; i++)
			{
				HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>();
				if (!Target(component, attacker) || exclude.Contains(component.healthComponent))
				{
					continue;
				}
				bool flag = false;
				foreach (HurtBox item in into)
				{
					if ((Object)(object)item.healthComponent == (Object)(object)component.healthComponent)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					into.Add(component);
					num2++;
				}
			}
			return num2;
		}

		public static List<HurtBox> Around(CharacterBody attacker, Vector3 origin, float radius, bool sight = true)
		{
			//IL_0007: 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_0014: 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_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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<HealthComponent, HurtBox> dictionary = new Dictionary<HealthComponent, HurtBox>();
			int num = Physics.OverlapSphereNonAlloc(origin, radius, buffer, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
			for (int i = 0; i < num; i++)
			{
				HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>();
				if (!Target(component, attacker))
				{
					continue;
				}
				Vector3 val = buffer[i].ClosestPoint(origin);
				Vector3 val2;
				if (sight)
				{
					val2 = val - origin;
					if (((Vector3)(ref val2)).sqrMagnitude > 0.25f && !Visible(origin, val))
					{
						continue;
					}
				}
				if (dictionary.TryGetValue(component.healthComponent, out var value))
				{
					val2 = Point(component, origin) - origin;
					float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
					val2 = Point(value, origin) - origin;
					if (!(sqrMagnitude < ((Vector3)(ref val2)).sqrMagnitude))
					{
						continue;
					}
				}
				dictionary[component.healthComponent] = component;
			}
			List<HurtBox> list = new List<HurtBox>(dictionary.Values);
			list.Sort(delegate(HurtBox x, HurtBox y)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val3 = Point(x, origin) - origin;
				float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = Point(y, origin) - origin;
				return sqrMagnitude2.CompareTo(((Vector3)(ref val3)).sqrMagnitude);
			});
			return list;
		}

		public static int Blast(CharacterBody attacker, Vector3 center, float radius, float coefficient, float proc, float force, DamageType type = (DamageType)0u, HashSet<HealthComponent> once = null, GameObject inflictor = null, float upward = 0.35f)
		{
			//IL_001b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_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_007f: 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_0084: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)attacker))
			{
				return 0;
			}
			bool crit = attacker.RollCrit();
			int num = 0;
			foreach (HurtBox item in Around(attacker, center, radius))
			{
				if (once == null || once.Add(item.healthComponent))
				{
					Vector3 val = Point(item, center);
					Vector3 val2 = val - center;
					val2.y = 0f;
					val2 = ((((Vector3)(ref val2)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref val2)).normalized);
					Vector3 val3 = val2 + Vector3.up * upward;
					if (Deal(attacker, item, val, coefficient, proc, crit, ((Vector3)(ref val3)).normalized * force, type, inflictor, (DamageColorIndex)0))
					{
						num++;
					}
				}
			}
			return num;
		}

		public static bool AimHit(Ray ray, CharacterBody owner, float range, out RaycastHit best, bool entities = true)
		{
			//IL_0001: 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_0028: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			best = default(RaycastHit);
			float num = float.MaxValue;
			int num2 = LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | (entities ? LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask) : 0);
			int num3 = Physics.RaycastNonAlloc(ray, rayHits, range, num2, (QueryTriggerInteraction)1);
			for (int i = 0; i < num3; i++)
			{
				RaycastHit val = rayHits[i];
				if (((RaycastHit)(ref val)).distance >= num || !Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
				{
					continue;
				}
				HurtBox component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<HurtBox>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (!Target(component, owner))
					{
						continue;
					}
				}
				else if (Object.op_Implicit((Object)(object)owner) && ((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)owner).gameObject.transform))
				{
					continue;
				}
				best = val;
				num = ((RaycastHit)(ref val)).distance;
			}
			return num < float.MaxValue;
		}

		public static Vector3 Ground(Vector3 p, float down = 60f)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0038: 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)
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(p + Vector3.up * 3f, Vector3.down, ref val, down, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				return p;
			}
			return ((RaycastHit)(ref val)).point;
		}

		public static bool TryGround(Vector3 p, float down, out Vector3 g)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(p + Vector3.up * 1.5f, Vector3.down, ref val, down, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				g = ((RaycastHit)(ref val)).point;
				return true;
			}
			g = p;
			return false;
		}

		public static bool IsHeavy(CharacterBody b)
		{
			if (Object.op_Implicit((Object)(object)b))
			{
				if (!b.isChampion && !b.isBoss && (!Object.op_Implicit((Object)(object)b.characterMotor) || !(b.characterMotor.mass >= 700f)))
				{
					if (Object.op_Implicit((Object)(object)b.rigidbody))
					{
						return b.rigidbody.mass >= 700f;
					}
					return false;
				}
				return true;
			}
			return false;
		}

		public static float Mass(CharacterBody b)
		{
			if (!Object.op_Implicit((Object)(object)b.characterMotor))
			{
				if (!Object.op_Implicit((Object)(object)b.rigidbody))
				{
					return 100f;
				}
				return b.rigidbody.mass;
			}
			return b.characterMotor.mass;
		}
	}
	public sealed class HiruzenDeath : GenericCharacterDeath
	{
		public override bool shouldAutoDestroy => ((EntityState)this).fixedAge > 10f;

		public override void OnEnter()
		{
			//IL_0064: 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)
			((GenericCharacterDeath)this).OnEnter();
			if (NetworkServer.active)
			{
				((EntityState)this).GetComponent<EnmaController>()?.ServerRecall(smoke: false);
			}
			Snd.Voice(((EntityState)this).characterBody, "Death", 4.5f);
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)charVisual))
			{
				try
				{
					Ragdoll.Spawn(charVisual, Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
					return;
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("HIRUZEN_RAGDOLL " + ex));
					return;
				}
			}
			Plugin.Log.LogWarning((object)"HIRUZEN_RAGDOLL no visual");
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
		}
	}
	public static class Ragdoll
	{
		private static readonly string[][] parts = new string[11][]
		{
			new string[2] { "pelvis", "" },
			new string[2] { "spine1", "pelvis" },
			new string[2] { "head", "spine1" },
			new string[2] { "l upperarm", "spine1" },
			new string[2] { "l forearm", "l upperarm" },
			new string[2] { "r upperarm", "spine1" },
			new string[2] { "r forearm", "r upperarm" },
			new string[2] { "l thigh", "pelvis" },
			new string[2] { "l calf", "l thigh" },
			new string[2] { "r thigh", "pelvis" },
			new string[2] { "r calf", "r thigh" }
		};

		private static readonly Queue<GameObject> corpses = new Queue<GameObject>();

		public static void Spawn(CharVisual v, Vector3 velocity)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: 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_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: 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_036f: 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_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: 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_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
			string[][] array = parts;
			foreach (string[] array2 in array)
			{
				Transform val = v.Bone(array2[0]);
				if (!Object.op_Implicit((Object)(object)val))
				{
					Plugin.Log.LogWarning((object)("HIRUZEN_RAGDOLL missing bone " + array2[0]));
					return;
				}
				dictionary[array2[0]] = val;
			}
			Transform presentation = v.Presentation;
			presentation.SetParent((Transform)null, true);
			if (Object.op_Implicit((Object)(object)v.Anim))
			{
				v.Anim.Stop();
			}
			v.Dying = true;
			((Behaviour)v).enabled = false;
			if (Object.op_Implicit((Object)(object)v.Staff))
			{
				try
				{
					v.Staff.Drop(velocity);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("HIRUZEN_STAFFDROP " + ex.Message));
				}
				v.Staff.Hide();
				CharacterModel component = ((Component)v).GetComponent<CharacterModel>();
				Renderer sr = ((Component)v.Staff).GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)sr) && component.baseRendererInfos != null)
				{
					component.baseRendererInfos = component.baseRendererInfos.Where((RendererInfo ri) => (Object)(object)ri.renderer != (Object)(object)sr).ToArray();
				}
			}
			Dictionary<string, Rigidbody> dictionary2 = new Dictionary<string, Rigidbody>();
			array = parts;
			foreach (string[] array3 in array)
			{
				Transform val2 = dictionary[array3[0]];
				((Component)val2).gameObject.layer = LayerIndex.debris.intVal;
				Rigidbody val3 = ((Component)val2).gameObject.AddComponent<Rigidbody>();
				val3.mass = ((array3[0] == "pelvis" || array3[0] == "spine1") ? 8 : 3);
				val3.drag = 0.2f;
				val3.angularDrag = 0.8f;
				val3.velocity = velocity * 0.6f + Vector3.up * 1.5f;
				Transform val4 = null;
				foreach (Transform item in val2)
				{
					Transform val5 = item;
					if (val5.childCount > 0 || ((Object)val5).name.Contains("hand") || ((Object)val5).name.Contains("foot"))
					{
						val4 = val5;
						break;
					}
				}
				CapsuleCollider obj = ((Component)val2).gameObject.AddComponent<CapsuleCollider>();
				float num;
				Vector3 localPosition;
				if (!Object.op_Implicit((Object)(object)val4))
				{
					num = 0.18f;
				}
				else
				{
					localPosition = val4.localPosition;
					num = ((Vector3)(ref localPosition)).magnitude;
				}
				float num2 = num;
				float num3 = Mathf.Max(0.01f, val2.lossyScale.x);
				obj.radius = ((array3[0] == "pelvis" || array3[0] == "spine1") ? 0.13f : ((array3[0] == "head") ? 0.11f : 0.06f)) / num3;
				obj.height = Mathf.Max(obj.radius * 2f, num2);
				Vector3 val6;
				if (!Object.op_Implicit((Object)(object)val4))
				{
					val6 = Vector3.up;
				}
				else
				{
					localPosition = val4.localPosition;
					val6 = ((Vector3)(ref localPosition)).normalized;
				}
				Vector3 val7 = val6;
				obj.direction = ((!(Mathf.Abs(val7.x) > Mathf.Abs(val7.y))) ? ((Mathf.Abs(val7.y) > Mathf.Abs(val7.z)) ? 1 : 2) : ((!(Mathf.Abs(val7.x) > Mathf.Abs(val7.z))) ? 2 : 0));
				obj.center = val7 * num2 * 0.5f;
				dictionary2[array3[0]] = val3;
				if (array3[1] != "")
				{
					CharacterJoint obj2 = ((Component)val2).gameObject.AddComponent<CharacterJoint>();
					((Joint)obj2).connectedBody = dictionary2[array3[1]];
					obj2.enableProjection = true;
					SoftJointLimit lowTwistLimit = obj2.lowTwistLimit;
					((SoftJointLimit)(ref lowTwistLimit)).limit = -30f;
					obj2.lowTwistLimit = lowTwistLimit;
					SoftJointLimit highTwistLimit = obj2.highTwistLimit;
					((SoftJointLimit)(ref highTwistLimit)).limit = 30f;
					obj2.highTwistLimit = highTwistLimit;
					SoftJointLimit swing1Limit = obj2.swing1Limit;
					((SoftJointLimit)(ref swing1Limit)).limit = 45f;
					obj2.swing1Limit = swing1Limit;
				}
			}
			Collider[] componentsInChildren = ((Component)presentation).GetComponentsInChildren<Collider>();
			foreach (Collider val8 in componentsInChildren)
			{
				foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
				{
					if (Object.op_Implicit((Object)(object)readOnlyInstances))
					{
						Collider[] componentsInChildren2 = ((Component)readOnlyInstances).GetComponentsInChildren<Collider>();
						foreach (Collider val9 in componentsInChildren2)
						{
							Physics.IgnoreCollision(val8, val9);
						}
					}
				}
			}
			corpses.Enqueue(((Component)presentation).gameObject);
			while (corpses.Count > 4)
			{
				GameObject val10 = corpses.Dequeue();
				if (Object.op_Implicit((Object)(object)val10))
				{
					Object.Destroy((Object)(object)val10);
				}
			}
			Object.Destroy((Object)(object)((Component)presentation).gameObject, 14f);
			Plugin.Log.LogInfo((object)"HIRUZEN_RAGDOLL spawned");
		}
	}
	public sealed class EarthCast : BaseSkillState
	{
		private const float Seal = 0.42f;

		private const float Duration = 0.62f;

		private bool fired;

		private Gesture g;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).characterBody.SetAimTimer(1.2f);
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)charVisual))
			{
				g = new Gesture
				{
					clip = "skl2_s",
					startF = 8f,
					endF = 40f,
					duration = 0.67f
				};
				charVisual.PlayGesture(g);
			}
			Snd.Voice(((EntityState)this).characterBody, "Earth", 1f);
		}

		public override void FixedUpdate()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!fired && ((EntityState)this).fixedAge >= 0.42f)
			{
				fired = true;
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 fwd = ((Ray)(ref aimRay)).direction;
				fwd.y = 0f;
				fwd = ((((Vector3)(ref fwd)).sqrMagnitude > 0.01f) ? ((Vector3)(ref fwd)).normalized : ((EntityState)this).characterDirection.forward);
				if (NetworkServer.active && !EarthWall.TrySpawn(((EntityState)this).characterBody, fwd) && ((EntityState)this).isAuthority)
				{
					RefundElement();
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.62f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void RefundElement()
		{
			ElementController component = ((EntityState)this).GetComponent<ElementController>();
			GenericSkill val = (Object.op_Implicit((Object)(object)component) ? component.Skills[4] : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				val.AddOneStock();
			}
		}

		public override void OnExit()
		{
			if (g != null)
			{
				CharVisual.Find(((EntityState)this).characterBody)?.EndGesture(g);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public sealed class EarthWall : NetworkBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_IsColliderValidForCollisions <>9__31_0;

			internal bool <Build>b__31_0(orig_IsColliderValidForCollisions orig, CharacterMotor self, Collider coll)
			{
				//IL_0060: 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)
				if (Object.op_Implicit((Object)(object)coll) && ((Component)coll).gameObject.layer == LayerIndex.collideWithCharacterHullOnly.intVal)
				{
					EarthWall componentInParent = ((Component)coll).GetComponentInParent<EarthWall>();
					if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.teamComponent) && self.body.teamComponent.teamIndex == componentInParent.team)
					{
						return false;
					}
				}
				return orig.Invoke(self, coll);
			}
		}

		public static GameObject Prefab;

		public static readonly List<EarthWall> Active = new List<EarthWall>();

		public const float Sink = 2.5f;

		public const float Rise = 0.6f;

		public const float Hold = 9.7f;

		public const float Crumble = 0.8f;

		public const float Width = 15.6f;

		public const float Height = 18.6f;

		public const float Thick = 2.6f;

		public const float Distance = 8.5f;

		public const float WScale = 1.3f;

		public const float HScale = 3f;

		public Vector3 center;

		public Quaternion rot;

		public float startTime;

		public bool molten;

		public float moltenAt;

		public TeamIndex team;

		public GameObject owner;

		private CharacterBody ownerBody;

		private BoxCollider box;

		private bool emerged;

		private float nextScan;

		private float nextBurn;

		private uint id;

		private static uint nextId = 1u;

		private static readonly Collider[] buf = (Collider[])(object)new Collider[64];

		public static int Deleted;

		private static readonly List<CharacterBody> pushTmp = new List<CharacterBody>();

		public static int PushedOut;

		public float Age => (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.fixedTime : Time.fixedTime) - startTime;

		public bool Live => Age < 10.3f;

		public static void Build()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002e: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			GameObject val = new GameObject("HiruzenEarthWall");
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<EarthWall>();
			Prefab = PrefabAPI.InstantiateClone(val, "HiruzenEarthWall", true);
			Object.DestroyImmediate((Object)val);
			Plugin.NetworkPrefabs.Add(Prefab);
			object obj = <>c.<>9__31_0;
			if (obj == null)
			{
				hook_IsColliderValidForCollisions val2 = delegate(orig_IsColliderValidForCollisions orig, CharacterMotor self, Collider coll)
				{
					//IL_0060: 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)
					if (Object.op_Implicit((Object)(object)coll) && ((Component)coll).gameObject.layer == LayerIndex.collideWithCharacterHullOnly.intVal)
					{
						EarthWall componentInParent = ((Component)coll).GetComponentInParent<EarthWall>();
						if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.teamComponent) && self.body.teamComponent.teamIndex == componentInParent.team)
						{
							return false;
						}
					}
					return orig.Invoke(self, coll);
				};
				<>c.<>9__31_0 = val2;
				obj = (object)val2;
			}
			CharacterMotor.IsColliderValidForCollisions += (hook_IsColliderValidForCollisions)obj;
		}

		public unsafe static bool TrySpawn(CharacterBody owner, Vector3 fwd)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[4] { 8.5f, 6.5f, 10.5f, 4.5f };
			for (int i = 0; i < array.Length; i++)
			{
				float num = array[i];
				if (!Combat.TryGround(owner.footPosition + fwd * num + Vector3.up * 4f, 12f, out var g))
				{
					continue;
				}
				Vector3 g2 = Vector3.Cross(Vector3.up, fwd);
				Vector3 normalized = ((Vector3)(ref g2)).normalized;
				int num2 = 0;
				float[] array2 = new float[2] { -6.2400002f, 6.2400002f };
				foreach (float num3 in array2)
				{
					if (Combat.TryGround(g + normalized * num3 + Vector3.up * 4f, 12f, out g2))
					{
						num2++;
					}
				}
				if (num2 >= 1)
				{
					GameObject obj = Object.Instantiate<GameObject>(Prefab, g, Quaternion.LookRotation(fwd));
					EarthWall component = obj.GetComponent<EarthWall>();
					component.center = g;
					component.rot = Quaternion.LookRotation(fwd);
					component.team = owner.teamComponent.teamIndex;
					component.owner = ((Component)owner).gameObject;
					component.ownerBody = owner;
					component.startTime = (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.fixedTime : Time.fixedTime);
					component.id = nextId++;
					NetworkServer.Spawn(obj);
					Action<string> trace = Combat.Trace;
					if (trace != null)
					{
						g2 = g;
						trace("WALL_SPAWN at=" + ((object)(*(Vector3*)(&g2))/*cast due to .constrained prefix*/).ToString() + " dist=" + num);
					}
					return true;
				}
			}
			Combat.Trace?.Invoke("WALL_NO_SPACE");
			return false;
		}

		private void OnEnable()
		{
			Active.Add(this);
		}

		private void OnDisable()
		{
			Active.Remove(this);
		}

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_009b: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = center;
			((Component)this).transform.rotation = rot;
			if (!Object.op_Implicit((Object)(object)ownerBody) && Object.op_Implicit((Object)(object)owner))
			{
				ownerBody = owner.GetComponent<CharacterBody>();
			}
			GameObject val = new GameObject("WallCollider");
			val.layer = LayerIndex.collideWithCharacterHullOnly.intVal;
			val.transform.SetParent(((Component)this).transform, false);
			box = val.AddComponent<BoxCollider>();
			box.size = new Vector3(15.6f, 21.1f, 2.6f);
			box.center = new Vector3(0f, 8.05f, 0f);
			((Component)this).gameObject.AddComponent<WallLook>().wall = this;
			((Component)this).gameObject.AddComponent<MudPass>().wall = this;
			Snd.Sfx("S_EarthRise", ((Component)this).gameObject);
			Snd.Sfx("S_RockBreak", ((Component)this).gameObject);
			Fx.Emit(Fx.SlamImpact, center, 7f, center);
		}

		public bool InBox(Vector3 p, float pad)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Quaternion.Inverse(rot) * (p - center);
			if (Mathf.Abs(val.x) < 7.8f + pad && val.y > -1f - pad && val.y < 18.6f + pad)
			{
				return Mathf.Abs(val.z) < 1.3f + pad;
			}
			return false;
		}

		private void FixedUpdate()
		{
			//IL_0054: 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)
			float age = Age;
			float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(age / 0.6f));
			float num2 = Mathf.Clamp01((age - 0.6f - 9.7f) / 0.8f);
			if (Object.op_Implicit((Object)(object)box))
			{
				((Component)box).transform.localPosition = Vector3.up * (-18.6f * (1f - num) - 18.6f * num2);
				((Collider)box).enabled = num > 0.5f && num2 < 0.5f;
			}
			if (!NetworkServer.active)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)ownerBody) && Object.op_Implicit((Object)(object)owner))
			{
				ownerBody = owner.GetComponent<CharacterBody>();
			}
			if (age >= 11.3f || !Object.op_Implicit((Object)(object)owner))
			{
				Combat.Trace?.Invoke("EARTHWALL_END age=" + age.ToString("0.00"));
				NetworkServer.Destroy(((Component)this).gameObject);
			}
			else if (Object.op_Implicit((Object)(object)ownerBody))
			{
				if (!emerged && age >= 0.33f)
				{
					emerged = true;
					Emerge();
				}
				if (age >= 0.3f && age < 10.3f)
				{
					PushOutEnemies();
				}
				if (age < 10.3f && Time.fixedTime >= nextScan)
				{
					nextScan = Time.fixedTime + 0.08f;
					DeleteProjectiles();
				}
				if (molten && age < 10.3f && Time.fixedTime >= nextBurn)
				{
					nextBurn = Time.fixedTime + 0.5f;
					Burn();
				}
			}
		}

		private void Emerge()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			Combat.Source = "WallEmergence";
			bool crit = ownerBody.RollCrit();
			HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
			foreach (HurtBox item in Combat.Around(ownerBody, center + Vector3.up * 2f, 9.8f, sight: false))
			{
				Vector3 val = Combat.Point(item, center);
				if (hashSet.Add(item.healthComponent) && InBox(val, 1.6f))
				{
					Vector3 val2 = Quaternion.Inverse(rot) * (val - center);
					Vector3 val3 = rot * new Vector3(0f, 0f, Mathf.Sign((val2.z == 0f) ? 1f : val2.z));
					Vector3 val4 = val3 + Vector3.up * 1.2f;
					val3 = ((Vector3)(ref val4)).normalized;
					Combat.Deal(ownerBody, item, val, 4f, 1f, crit, val3 * 1800f, (DamageType)32, ((Component)this).gameObject, (DamageColorIndex)0);
				}
			}
		}

		private void PushOutEnemies()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_0168: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_019e: Unknown result type (might be due to invalid IL or missing references)
			pushTmp.Clear();
			pushTmp.AddRange(CharacterBody.readOnlyInstancesList);
			foreach (CharacterBody item in pushTmp)
			{
				if (!Object.op_Implicit((Object)(object)item) || !Object.op_Implicit((Object)(object)item.teamComponent) || item.teamComponent.teamIndex == team || !Object.op_Implicit((Object)(object)item.characterMotor) || !Object.op_Implicit((Object)(object)item.healthComponent) || !item.healthComponent.alive)
				{
					continue;
				}
				Vector3 val = Quaternion.Inverse(rot) * (item.footPosition - center);
				float num = 1.8f;
				if (!(Mathf.Abs(val.x) > 8.1f) && !(val.y < -2f) && !(val.y > 18.6f) && !(Mathf.Abs(val.z) >= num))
				{
					float num2 = ((val.z >= 0f) ? 1f : (-1f));
					Vector3 val2 = center + rot * new Vector3(val.x, val.y, num2 * (num + 0.05f));
					CharacterMotor characterMotor = item.characterMotor;
					Vector3 val3 = rot * Vector3.forward * num2;
					Vector3 velocity = characterMotor.velocity;
					float num3 = Vector3.Dot(velocity, val3);
					if (num3 < 0f)
					{
						characterMotor.velocity = velocity - val3 * num3;
					}
					((BaseCharacterController)characterMotor).Motor.SetPosition(val2 + (item.transform.position - item.footPosition), true);
					PushedOut++;
				}
			}
		}

		private void DeleteProjectiles()
		{
			//IL_0006: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics.OverlapBoxNonAlloc(((Component)this).transform.position + rot * (Vector3.up * 18.6f * 0.5f), new Vector3(8.2f, 9.7f, 1.9f), buf, rot, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.projectile)).mask), (QueryTriggerInteraction)2);
			for (int i = 0; i < num; i++)
			{
				ProjectileController val = (Object.op_Implicit((Object)(object)buf[i]) ? ((Component)buf[i]).GetComponentInParent<ProjectileController>() : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					TeamFilter teamFilter = val.teamFilter;
					if (!Object.op_Implicit((Object)(object)teamFilter) || teamFilter.teamIndex != team)
					{
						Fx.Emit(Fx.Smoke, ((Component)val).transform.position, 0.45f, ((Component)val).transform.position);
						NetworkServer.Destroy(((Component)val).gameObject);
						Deleted++;
					}
				}
			}
		}

		public bool Superheat(CharacterBody by)
		{
			//IL_0039: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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)
			if (!NetworkServer.active || molten || !Live)
			{
				return false;
			}
			molten = true;
			moltenAt = Age;
			((NetworkBehaviour)this).SetDirtyBit(1u);
			Fx.Emit(Fx.CastFlash, center + Vector3.up * 3f, 9f, center, 0f, (Color?)new Color(1f, 0.45f, 0.1f, 1f));
			Snd.Sfx("S_FireBall", ((Component)this).gameObject);
			Plugin.Log.LogInfo((object)("HIRUZEN_COMBO superheated wall id=" + id));
			return true;
		}

		private void Burn()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Combat.Source = "SuperheatedWall";
			bool crit = ownerBody.RollCrit();
			HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
			foreach (HurtBox item in Combat.Around(ownerBody, center + Vector3.up * 2.5f, 11.8f, sight: false))
			{
				Vector3 val = Combat.Point(item, center);
				if (hashSet.Add(item.healthComponent) && InBox(val, 3f) && Combat.Deal(ownerBody, item, val, 0.6f, 0.4f, crit, Vector3.zero, (DamageType)0, ((Component)this).gameObject, (DamageColorIndex)0) && item.healthComponent.alive)
				{
					DotController.InflictDot(((Component)item.healthComponent).gameObject, ((Component)ownerBody).gameObject, item, (DotIndex)1, 2f, 1f, (uint?)null);
				}
			}
		}

		public static EarthWall HitBy(Vector3 o, Vector3 dir, float range)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			foreach (EarthWall item in Active)
			{
				if (!Object.op_Implicit((Object)(object)item) || !item.Live || !(item.Age > 0.3f))
				{
					continue;
				}
				for (int i = 1; i <= 12; i++)
				{
					if (item.InBox(o + dir * range * (float)i / 12f, 0.4f))
					{
						return item;
					}
				}
			}
			return null;
		}

		public override bool OnSerialize(NetworkWriter w, bool initial)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected I4, but got Unknown
			w.Write(center);
			w.Write(rot);
			w.Write(startTime);
			w.Write(molten);
			w.Write(moltenAt);
			w.Write((int)team);
			w.Write(owner);
			return true;
		}

		public override void OnDeserialize(NetworkReader r, bool initial)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			center = r.ReadVector3();
			rot = r.ReadQuaternion();
			startTime = r.ReadSingle();
			molten = r.ReadBoolean();
			moltenAt = r.ReadSingle();
			team = (TeamIndex)(sbyte)r.ReadInt32();
			owner = r.ReadGameObject();
		}
	}
	public sealed class WallLook : MonoBehaviour
	{
		public EarthWall wall;

		private readonly List<Transform> slabs = new List<Transform>();

		private readonly List<Vector3> basePos = new List<Vector3>();

		private Material rock;

		private Material hot;

		private ParticleSystem dust;

		private ParticleSystem embers;

		private static Mesh mesh;

		private static Mesh glowMesh;

		private static string tex;

		private bool shownMolten;

		private const bool OwnerSeeThrough = false;

		private const float WS = 1.3f;

		private readonly List<Material> crackMats = new List<Material>();

		private readonly List<GameObject> overlays = new List<GameObject>();

		private MaterialPropertyBlock fadeBlock;

		private bool ownerView;

		private static Texture2D cracks;

		private static Texture2D Cracks
		{
			get
			{
				//IL_0036: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Expected O, but got Unknown
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: 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_00d3: 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)
				if (Object.op_Implicit((Object)(object)cracks))
				{
					return cracks;
				}
				Random random = new Random(11);
				Vector2[] array = (Vector2[])(object)new Vector2[24];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = new Vector2((float)random.NextDouble(), (float)random.NextDouble());
				}
				cracks = new Texture2D(256, 256, (TextureFormat)4, true);
				Color[] array2 = (Color[])(object)new Color[65536];
				Vector2 val = default(Vector2);
				for (int j = 0; j < 256; j++)
				{
					for (int k = 0; k < 256; k++)
					{
						((Vector2)(ref val))..ctor((float)k / 256f, (float)j / 256f);
						float num = 9f;
						float num2 = 9f;
						Vector2[] array3 = array;
						foreach (Vector2 val2 in array3)
						{
							for (int m = -1; m <= 1; m++)
							{
								for (int n = -1; n <= 1; n++)
								{
									Vector2 val3 = val - val2 - new Vector2((float)m, (float)n);
									float magnitude = ((Vector2)(ref val3)).magnitude;
									if (magnitude < num)
									{
										num2 = num;
										num = magnitude;
									}
									else if (magnitude < num2)
									{
										num2 = magnitude;
									}
								}
							}
						}
						float num3 = num2 - num;
						float num4 = Mathf.Clamp01(1f - num3 / 0.022f);
						num4 *= num4;
						array2[j * 256 + k] = new Color(num4, num4 * 0.6f, num4 * 0.25f, 1f);
					}
				}
				cracks.SetPixels(array2);
				cracks.Apply(true);
				((Texture)cracks).wrapMode = (TextureWrapMode)0;
				return cracks;
			}
		}

		private void Start()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: 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_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Expected O, but got Unknown
			//IL_038e: 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)
			if (!Object.op_Implicit((Object)(object)mesh))
			{
				mesh = Rigs.RestMesh("Wall", out tex);
			}
			rock = new Material(Rigs.Mat(tex));
			if (rock.HasProperty("_Fade"))
			{
				rock.EnableKeyword("DITHER");
			}
			hot = new Material(rock);
			hot.color = new Color(1f, 0.9f, 0.82f);
			if (hot.HasProperty("_EmColor"))
			{
				hot.SetColor("_EmColor", new Color(0.6f, 0.24f, 0.05f));
				hot.SetFloat("_EmPower", 0.08f);
				hot.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture);
			}
			if (!Object.op_Implicit((Object)(object)glowMesh))
			{
				glowMesh = GradientMesh(mesh);
			}
			(Vector3, float, float, bool)[] array = new(Vector3, float, float, bool)[3]
			{
				(new Vector3(-3.5749998f, 0f, 0f), 1.15f, 0f, false),
				(new Vector3(3.5749998f, 0f, 0.1f), 1.15f, 180f, true),
				(new Vector3(0f, -0.4f, -0.35f), 0.8f, 8f, false)
			};
			for (int i = 0; i < array.Length; i++)
			{
				(Vector3, float, float, bool) tuple = array[i];
				GameObject val = new GameObject("Slab");
				val.transform.SetParent(((Component)this).transform, false);
				val.AddComponent<MeshFilter>().sharedMesh = mesh;
				MeshRenderer val2 = val.AddComponent<MeshRenderer>();
				((Renderer)val2).sharedMaterial = rock;
				val.transform.localPosition = tuple.Item1;
				val.transform.localRotation = Quaternion.Euler(0f, tuple.Item3, 0f);
				val.transform.localScale = new Vector3((tuple.Item4 ? (0f - tuple.Item2) : tuple.Item2) * 1.3f, tuple.Item2 * 1.15f * 3f, tuple.Item2 * 1.7f * 1.18f);
				if (tuple.Item4)
				{
					((Renderer)val2).sharedMaterial = rock;
				}
				slabs.Add(val.transform);
				basePos.Add(tuple.Item1);
				int num = slabs.Count - 1;
				Material val3 = Fx.Additive((Texture)(object)Cracks);
				val3.SetColor("_TintColor", new Color(1f, 0.5f, 0.12f, 1f));
				val3.SetInt("_ZTest", 4);
				val3.mainTextureScale = new Vector2((new float[3] { 1.7f, 2.3f, 1.3f })[num % 3], (new float[3] { 1.5f, 1.9f, 1.2f })[num % 3]);
				val3.mainTextureOffset = new Vector2((new float[3] { 0.13f, 0.58f, 0.37f })[num % 3], (new float[3] { 0.71f, 0.22f, 0.46f })[num % 3]);
				GameObject val4 = new GameObject("SlabCracks");
				val4.transform.SetParent(val.transform, false);
				val4.transform.localScale = Vector3.one * 1.004f;
				val4.AddComponent<MeshFilter>().sharedMesh = glowMesh;
				MeshRenderer obj = val4.AddComponent<MeshRenderer>();
				((Renderer)obj).sharedMaterial = val3;
				((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
				val4.SetActive(false);
				crackMats.Add(val3);
				overlays.Add(val4);
			}
			Fx.Debris(((Component)this).transform.position + ((Component)this).transform.right * -4f, 3.5f, 10, 10f);
			Fx.Debris(((Component)this).transform.position + ((Component)this).transform.right * 4f, 3.5f, 10, 10f);
			Fx.Debris(((Component)this).transform.position, 3f, 8, 12f);
			dust = Fx.Particles(((Component)this).transform, Fx.SmokeMat, new Color(0.66f, 0.58f, 0.48f, 0.5f), 2.8f, 1.3f, 3f);
			ShapeModule shape = dust.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
			((ShapeModule)(ref shape)).scale = new Vector3(15.6f, 0.3f, 2f);
			MainModule main = dust.main;
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, 6.28f);
			dust.Emit(26);
			embers = Fx.Particles(((Component)this).transform, Fx.Glow, new Color(1f, 0.6f, 0.2f), 0.32f, 1.6f, 1.6f, 90);
			ShapeModule shape2 = embers.shape;
			((ShapeModule)(ref shape2)).shapeType = (ParticleSystemShapeType)5;
			((ShapeModule)(ref shape2)).scale = new Vector3(14.04f, 0.4f, 1.4f);
			((ShapeModule)(ref shape2)).position = Vector3.up * 18.300001f;
			EmissionModule emission = embers.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			MainModule main2 = embers.main;
			((MainModule)(ref main2)).loop = true;
			((MainModule)(ref main2)).gravityModifier = MinMaxCurve.op_Implicit(-0.35f);
			NoiseModule noise = embers.noise;
			((NoiseModule)(ref noise)).enabled = true;
			((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.6f);
			((NoiseModule)(ref noise)).frequency = 0.7f;
			embers.Play();
			ownerView = false;
			foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.targetBody) && Object.op_Implicit((Object)(object)wall.owner) && (Object)(object)((Component)readOnlyInstances.targetBody).gameObject == (Object)(object)wall.owner)
				{
					ownerView = true;
				}
			}
		}

		private static Mesh GradientMesh(Mesh src)
		{
			//IL_0026: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = Object.Instantiate<Mesh>(src);
			Vector3[] vertices = val.vertices;
			float num = float.MaxValue;
			float num2 = float.MinValue;
			Vector3[] array = vertices;
			foreach (Vector3 val2 in array)
			{
				num = Mathf.Min(num, val2.y);
				num2 = Mathf.Max(num2, val2.y);
			}
			Color[] array2 = (Color[])(object)new Color[vertices.Length];
			for (int j = 0; j < vertices.Length; j++)
			{
				float num3 = Mathf.InverseLerp(num, num2, vertices[j].y);
				float num4 = Mathf.Clamp01(1.15f - num3 * 1.25f);
				num4 *= num4;
				array2[j] = new Color(num4, num4, num4, num4);
			}
			val.colors = array2;
			return val;
		}

		private void Update()
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)wall))
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			float age = wall.Age;
			float num = Mathf.Clamp01(age / 0.6f);
			float num2 = Mathf.Clamp01((age - 0.6f - 9.7f) / 0.8f);
			float num3 = -18.6f * (1f - Mathf.SmoothStep(0f, 1f, num)) * 1.05f - 18.6f * num2 * num2;
			float num4 = ((num < 1f) ? (0.12f * (1f - num)) : 0f) + ((num2 > 0f) ? (0.1f * num2) : 0f);
			for (int i = 0; i < slabs.Count; i++)
			{
				slabs[i].localPosition = basePos[i] + Vector3.up * (num3 - ((i == 2) ? 0.4f : 0f)) + Random.insideUnitSphere * num4;
				if (num2 > 0f)
				{
					slabs[i].localRotation = Quaternion.Euler(num2 * (float)((i == 0) ? (-9) : 7), slabs[i].localEulerAngles.y, num2 * (float)((i == 0) ? 6 : (-8)));
				}
			}
			if (num2 > 0f && num2 < 0.6f && Random.value < 0.04f)
			{
				Fx.Debris(((Component)this).transform.position + ((Component)this).transform.right * Random.Range(-5f, 5f), 1f, 2, 4f);
			}
			if (wall.molten && !shownMolten)
			{
				shownMolten = true;
				foreach (Transform slab in slabs)
				{
					((Renderer)((Component)slab).GetComponent<MeshRenderer>()).sharedMaterial = hot;
				}
				foreach (GameObject overlay in overlays)
				{
					if (Object.op_Implicit((Object)(object)overlay))
					{
						overlay.SetActive(true);
					}
				}
				EmissionModule emission = embers.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(14f);
			}
			if (shownMolten)
			{
				float num5 = Mathf.Clamp01((age - wall.moltenAt) / 0.35f);
				for (int j = 0; j < crackMats.Count; j++)
				{
					float num6 = 0.78f + 0.22f * Mathf.Sin(Time.time * 2.2f + (float)j * 1.7f);
					crackMats[j].SetColor("_TintColor", new Color(1f, 0.5f + 0.12f * num6, 0.12f, num5 * num6 * (1f - num2)));
				}
				if (hot.HasProperty("_EmPower"))
				{
					hot.SetFloat("_EmPower", (0.07f + 0.04f * Mathf.Sin(Time.time * 2.2f)) * num5);
				}
			}
			if (num2 > 0.5f)
			{
				EmissionModule emission2 = embers.emission;
				((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			}
			_ = ownerView;
		}
	}
	public sealed class MudPass : MonoBehaviour
	{
		public EarthWall wall;

		private CharacterBody body;

		private bool inside;

		private float nextBubble;

		private Vector3 lastLocal;

		private static Material ringMat;

		private static Material blobMat;

		public static readonly Color Mud = new Color(0.15f, 0.1f, 0.06f, 1f);

		public static readonly Color MudDark = new Color(0.09f, 0.06f, 0.04f, 1f);

		public static int Ripples;

		private Renderer[] slabR;

		private MaterialPropertyBlock fb;

		public static float FadeFrom = 2f;

		public static float FadeMin = 0.3f;

		private float faceDepth = -1f;

		private float dripUntil;

		private float nextDrip;

		private void Update()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			CameraInside();
			if (!Object.op_Implicit((Object)(object)wall) || wall.Age < 0.6f || wall.Age > 10.3f)
			{
				inside = false;
				return;
			}
			if (!Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)wall.owner))
			{
				body = wall.owner.GetComponent<CharacterBody>();
			}
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			Vector3 val = Quaternion.Inverse(wall.rot) * (body.corePosition - wall.center);
			float num = 1.3f;
			bool flag = Mathf.Abs(val.x) < 8f && val.y > -1.5f && val.y < 18.6f && Mathf.Abs(val.z) < num + 0.35f;
			if (flag != inside)
			{
				float num2 = Mathf.Sign((!flag) ? val.z : ((Mathf.Abs(lastLocal.z) > 0.01f) ? lastLocal.z : val.z));
				if (num2 == 0f)
				{
					num2 = 1f;
				}
				Burst(val, num2, flag ? 1f : 0.9f);
				Combat.Trace?.Invoke("MUDPASS_" + (flag ? "ENTER" : "EXIT") + " side=" + num2 + " t=" + Time.time.ToString("0.00"));
				inside = flag;
				nextBubble = Time.time + 0.25f;
				if (!flag)
				{
					dripUntil = Time.time + 0.6f;
					nextDrip = Time.time;
				}
			}
			if (Time.time < dripUntil && Time.time >= nextDrip && Object.op_Implicit((Object)(object)body))
			{
				nextDrip = Time.time + 0.1f;
				Fx.Debris(body.corePosition + Random.insideUnitSphere * 0.35f, 0.25f, 2, 0.4f, 0.32f, 0.6f);
			}
			if (inside && Time.time >= nextBubble)
			{
				nextBubble = Time.time + 0.28f;
				Ripple(val, 1f, 0.45f, 0.7f, 0.55f);
				Ripple(val, -1f, 0.45f, 0.7f, 0.55f);
			}
			lastLocal = val;
		}

		private void CameraInside()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)wall))
			{
				return;
			}
			Camera val = Fx.Cam();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Renderer[] array;
			if (slabR == null || slabR.Length == 0)
			{
				array = (Renderer[])(object)(from r in ((Component)this).GetComponentsInChildren<MeshRenderer>(true)
					where ((Object)r).name == "Slab"
					select r).ToArray();
				slabR = array;
				faceDepth = -1f;
			}
			if (fb == null)
			{
				fb = new MaterialPropertyBlock();
			}
			Vector3 position = ((Component)val).transform.position;
			array = slabR;
			foreach (Renderer val2 in array)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					Bounds bounds = val2.bounds;
					float num2 = Vector3.Distance(((Bounds)(ref bounds)).ClosestPoint(position), position);
					bounds = val2.bounds;
					if (((Bounds)(ref bounds)).Contains(position))
					{
						num2 = 0f;
					}
					float num3 = Mathf.Lerp(FadeMin, 1f, Mathf.Clamp01(num2 / FadeFrom));
					val2.GetPropertyBlock(fb);
					fb.SetFloat("_Fade", num3);
					val2.SetPropertyBlock(fb);
				}
			}
		}

		private float FaceDepth()
		{
			//IL_0068: 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_0079: 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_009e: 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)
			if (faceDepth > 0f)
			{
				return faceDepth;
			}
			float num = 1.3f;
			if (slabR != null)
			{
				Renderer[] array = slabR;
				foreach (Renderer val in array)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
						if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMesh))
						{
							Bounds bounds = component.sharedMesh.bounds;
							Transform transform = ((Component)val).transform;
							float num2 = Mathf.Abs(transform.localScale.z);
							num = Mathf.Max(num, Mathf.Abs(transform.localPosition.z) + (Mathf.Abs(((Bounds)(ref bounds)).center.z) + ((Bounds)(ref bounds)).extents.z) * num2);
						}
					}
				}
			}
			faceDepth = Mathf.Min(num, 3f);
			return faceDepth;
		}

		private Vector3 Face(Vector3 l, float side, float up)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(l.y + up, 0.3f, 18.1f);
			return wall.center + wall.rot * new Vector3(l.x, num, side * (FaceDepth() + 0.04f));
		}

		private void Burst(Vector3 l, float side, float k)
		{
			//IL_0001: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Ripple(l, side, 2.3f * k, 0.75f, 1f);
			Ripple(l, side, 1.2f * k, 0.6f, 0.9f);
			Blob(Face(l, side, 0f), side, 1.6f * k);
			Fx.Debris(Face(l, side, 0.4f) + wall.rot * Vector3.forward * side * 0.25f, 0.45f, 5, 1.6f, 0.45f, 0.8f);
		}

		private void Ripple(Vector3 l, float side, float size, float life, float alpha)
		{
			//IL_0046: 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_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ringMat))
			{
				ringMat = Fx.AlphaTex((Texture)(object)Fx.Ring);
				ringMat.SetColor("_TintColor", Mud);
			}
			GameObject obj = Fx.Quad(null, ringMat, "MudRipple");
			obj.transform.position = Face(l, side, Random.Range(-0.2f, 0.3f));
			obj.transform.rotation = Quaternion.LookRotation(wall.rot * Vector3.forward * side) * Quaternion.Euler(0f, 0f, Random.Range(0f, 360f));
			MudFade mudFade = obj.AddComponent<MudFade>();
			mudFade.life = life;
			mudFade.size0 = size * 0.3f;
			mudFade.size1 = size;
			mudFade.alpha = alpha;
			mudFade.color = Mud;
			Ripples++;
		}

		private void Blob(Vector3 at, float side, float size)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_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_0081: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)blobMat))
			{
				blobMat = Fx.AlphaTex((Texture)(object)Fx.Soft);
				blobMat.SetColor("_TintColor", MudDark);
			}
			GameObject obj = Fx.Quad(null, blobMat, "MudBulge");
			obj.transform.position = at + wall.rot * Vector3.forward * side * 0.02f;
			obj.transform.rotation = Quaternion.LookRotation(wall.rot * Vector3.forward * side);
			MudFade mudFade = obj.AddComponent<MudFade>();
			mudFade.life = 0.7f;
			mudFade.size0 = size;
			mudFade.size1 = size * 0.75f;
			mudFade.alpha = 0.85f;
			mudFade.color = MudDark;
		}
	}
	public sealed class MudFade : MonoBehaviour
	{
		public float life = 0.7f;

		public float size0 = 0.5f;

		public float size1 = 2f;

		public float alpha = 0.9f;

		public Color color = MudPass.Mud;

		private float born = -1f;

		private MaterialPropertyBlock mb;

		private Renderer r;

		private void Update()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			if (born < 0f)
			{
				born = Time.time;
				r = ((Component)this).GetComponent<Renderer>();
				mb = new MaterialPropertyBlock();
			}
			float num = Mathf.Clamp01((Time.time - born) / life);
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			float num2 = 1f - (1f - num) * (1f - num);
			Camera val = Fx.Cam();
			float num3 = (Object.op_Implicit((Object)(object)val) ? Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) : 10f);
			((Component)this).transform.localScale = Vector3.one * Mathf.Min(Mathf.Lerp(size0, size1, num2), num3 * 0.3f);
			float num4 = Mathf.Clamp01((num3 - 2.5f) / 3f);
			float num5 = alpha * Mathf.Clamp01(num / 0.12f) * Mathf.Pow(1f - num, 1.4f) * num4;
			r.GetPropertyBlock(mb);
			mb.SetColor("_TintColor", new Color(color.r, color.g, color.b, num5));
			r.SetPropertyBlock(mb);
		}
	}
	public enum Element
	{
		Water,
		Lightning,
		Wind,
		Fire,
		Earth
	}
	public sealed class ElementController : NetworkBehaviour
	{
		public const int Count = 5;

		private int synced;

		private int predicted = -1;

		private float predictUntil;

		private CharacterBody body;

		private ElementProxySkillDef applied;

		public GenericSkill[] Skills = (GenericSkill[])(object)new GenericSkill[5];

		public static readonly List<ElementController> Instances = new List<ElementController>();

		public int Current
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)body) || !body.hasEffectiveAuthority || !(Time.time < predictUntil) || predicted < 0)
				{
					return synced;
				}
				return predicted;
			}
		}

		public bool HooksActive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)body.skillLocator.secondary))
				{
					return !(body.skillLocator.secondary.skillDef is ElementProxySkillDef);
				}
				return false;
			}
		}

		public static string SkillName(int i)
		{
			Element element = (Element)i;
			return "HiruzenElement" + element;
		}

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			GenericSkill[] components = ((Component)this).GetComponents<GenericSkill>();
			foreach (GenericSkill val in components)
			{
				for (int j = 0; j < 5; j++)
				{
					if (val.skillName == SkillName(j))
					{
						Skills[j] = val;
					}
				}
			}
		}

		private void OnEnable()
		{
			Instances.Add(this);
		}

		private void OnDisable()
		{
			Instances.Remove(this);
		}

		private void Start()
		{
			Apply();
		}

		public void Predict(int i)
		{
			predicted = (i % 5 + 5) % 5;
			predictUntil = Time.time + 1f;
			Apply();
		}

		public void ServerSet(int i)
		{
			synced = (i % 5 + 5) % 5;
			((NetworkBehaviour)this).SetDirtyBit(1u);
			Apply();
		}

		public void Apply()
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.skillLocator) || !Object.op_Implicit((Object)(object)body.skillLocator.secondary))
			{
				return;
			}
			ElementProxySkillDef elementProxySkillDef = SkillSetup.Proxies[Current];
			GenericSkill secondary = body.skillLocator.secondary;
			if (!((Object)(object)applied == (Object)(object)elementProxySkillDef))
			{
				if (Object.op_Implicit((Object)(object)applied))
				{
					secondary.UnsetSkillOverride((object)this, (SkillDef)(object)applied, (SkillOverridePriority)2);
				}
				secondary.SetSkillOverride((object)this, (SkillDef)(object)elementProxySkillDef, (SkillOverridePriority)2);
				applied = elementProxySkillDef;
				Mirror(secondary, Current);
			}
		}

		public void Mirror(GenericSkill slot, int i)
		{
			GenericSkill val = Skills[i];
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)slot))
			{
				if (slot.stock != val.stock)
				{
					slot.stock = val.stock;
				}
				slot.rechargeStopwatch = val.rechargeStopwatch;
			}
		}

		private void FixedUpdate()
		{
			Apply();
		}

		public override bool OnSerialize(NetworkWriter w, bool initial)
		{
			w.Write((byte)synced);
			return true;
		}

		public override void OnDeserialize(NetworkReader r, bool initial)
		{
			synced = r.ReadByte();
			Apply();
		}

		public static void AfterStats(CharacterBody b)
		{
			ElementController elementController = (Object.op_Implicit((Object)(object)b) ? ((Component)b).GetComponent<ElementController>() : null);
			if (!Object.op_Implicit((Object)(object)elementController) || !Object.op_Implicit((Object)(object)b.skillLocator) || !Object.op_Implicit((Object)(object)b.skillLocator.secondary))
			{
				return;
			}
			GenericSkill secondary = b.skillLocator.secondary;
			GenericSkill[] skills = elementController.Skills;
			foreach (GenericSkill val in skills)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.cooldownScale = secondary.cooldownScale;
					val.flatCooldownReduction = secondary.flatCooldownReduction;
					if (val.bonusStockFromBody != secondary.bonusStockFromBody)
					{
						val.SetBonusStockFromBody(secondary.bonusStockFromBody);
					}
				}
			}
		}
	}
	public sealed class ElementProxySkillDef : SkillDef
	{
		public int element;

		public SkillDef real;

		private static ElementController C(GenericSkill s)
		{
			if (!Object.op_Implicit((Object)(object)s))
			{
				return null;
			}
			return ((Component)s).GetComponent<ElementController>();
		}

		public override float GetRechargeInterval(GenericSkill s)
		{
			if (!Object.op_Implicit((Object)(object)real))
			{
				return ((SkillDef)this).GetRechargeInterval(s);
			}
			return real.baseRechargeInterval;
		}

		public override int GetMaxStock(GenericSkill s)
		{
			if (!Object.op_Implicit((Object)(object)real))
			{
				return ((SkillDef)this).GetMaxStock(s);
			}
			return real.baseMaxStock;
		}

		public override int GetRechargeStock(GenericSkill s)
		{
			if (!Object.op_Implicit((Object)(object)real))
			{
				return ((SkillDef)this).Get