Decompiled source of Shino Aburame v0.4.1

plugins/Shino/Shino.dll

Decompiled 11 hours 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 System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BeetleGuardMonster;
using ExtraSkillSlots;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.EntityStates.BeetleGuardMonster;
using On.RoR2;
using On.RoR2.Projectile;
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 TMPro;
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("Shino")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+90f327a2402b95cdcfcb082996b9cf267f470631")]
[assembly: AssemblyProduct("Shino")]
[assembly: AssemblyTitle("Shino")]
[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 ShinoMod
{
	public static class Snd
	{
		[Serializable]
		public class EvRow
		{
			public string @event;

			public float duration;
		}

		[Serializable]
		public class EvFile
		{
			public EvRow[] events;
		}

		private sealed class Speaking
		{
			public float until;

			public int prio;

			public uint id;
		}

		private static readonly Dictionary<string, Vector2> few = new Dictionary<string, Vector2>();

		private static Dictionary<string, float> lengths;

		private static readonly Dictionary<int, Speaking> speaking = new Dictionary<int, Speaking>();

		public static uint LastVoiceId;

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

		public static uint Sfx(string key, GameObject at)
		{
			if (key != null && !key.StartsWith("S_"))
			{
				key = "S_" + key;
			}
			uint result = (Object.op_Implicit((Object)(object)at) ? AkSoundEngine.PostEvent("Play_Shino_" + key, at) : 0u);
			Combat.Trace?.Invoke("SFX Play_Shino_" + key + " playingId=" + result + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
			return result;
		}

		public static void Few(string key, GameObject at, int max)
		{
			//IL_0013: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			few.TryGetValue(key, out var value);
			if (Time.time - value.x > 0.15f)
			{
				((Vector2)(ref value))..ctor(Time.time, 0f);
			}
			if (!(value.y >= (float)max))
			{
				value.y += 1f;
				few[key] = value;
				Sfx(key, at);
			}
		}

		private static float Length(string ev, float fallback)
		{
			LoadLengths();
			if (!lengths.TryGetValue(ev, out var value))
			{
				return fallback;
			}
			return value;
		}

		public static void LoadLengths()
		{
			if (lengths != null)
			{
				return;
			}
			lengths = new Dictionary<string, float>();
			try
			{
				EvFile evFile = Media.Read<EvFile>(Path.Combine(Media.Assets, "Audio", "ShinoEvents.json"));
				if (evFile != null && evFile.events != null)
				{
					EvRow[] events = evFile.events;
					foreach (EvRow evRow in events)
					{
						lengths[evRow.@event] = evRow.duration;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("SHINO_AUDIO event lengths unavailable: " + ex.Message));
			}
		}

		public static bool Voice(CharacterBody body, string key, float length, bool grunt = false, int prio = -1, bool log = false)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			int instanceID = ((Object)body).GetInstanceID();
			float time = Time.time;
			if (prio < 0)
			{
				prio = ((!grunt) ? 1 : 0);
			}
			if (!speaking.TryGetValue(instanceID, out var value))
			{
				Dictionary<int, Speaking> dictionary = speaking;
				Speaking obj = new Speaking
				{
					until = -1f
				};
				value = obj;
				dictionary[instanceID] = obj;
			}
			if (time < value.until && prio <= value.prio)
			{
				if (log)
				{
					Plugin.Log.LogInfo((object)("SHINO_VOICE skip " + key + " busy prio=" + value.prio + " t=" + time.ToString("0.00")));
				}
				return false;
			}
			if (grunt && Random.value > 0.55f)
			{
				return false;
			}
			bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English;
			string text = "Play_Shino_" + (flag ? "VE_" : "V_") + key;
			uint num = AkSoundEngine.PostEvent(text, ((Component)body).gameObject, 1048576u, (EventCallback)null, (object)null);
			if (num == 0)
			{
				if (log)
				{
					Plugin.Log.LogInfo((object)("SHINO_VOICE not in a loaded bank: " + text));
				}
				return false;
			}
			if (time < value.until && value.id != 0)
			{
				AkSoundEngine.StopPlayingID(value.id, 80);
			}
			value.until = time + Length(text, length);
			value.prio = prio;
			value.id = num;
			LastVoiceId = num;
			Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key + " playingId=" + num + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
			if (log)
			{
				Plugin.Log.LogInfo((object)("SHINO_VOICE post " + text + " id=" + num + " t=" + time.ToString("0.00")));
				VoiceProbe.Watch(body, text, num);
			}
			return num != 0;
		}

		public static bool Playing(uint id, out int ms)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			ms = 0;
			if (id != 0 && (int)AkSoundEngine.GetSourcePlayPosition(id, ref ms, true) == 1)
			{
				return ms > 0;
			}
			return false;
		}
	}
	public sealed class VoiceProbe : MonoBehaviour
	{
		private sealed class W
		{
			public string ev;

			public uint id;

			public float postT;
		}

		private readonly List<W> watch = new List<W>();

		public static void Watch(CharacterBody b, string ev, uint id)
		{
			if (Object.op_Implicit((Object)(object)b) && id != 0)
			{
				(((Component)b).GetComponent<VoiceProbe>() ?? ((Component)b).gameObject.AddComponent<VoiceProbe>()).watch.Add(new W
				{
					ev = ev,
					id = id,
					postT = Time.time
				});
			}
		}

		private void Update()
		{
			for (int num = watch.Count - 1; num >= 0; num--)
			{
				W w = watch[num];
				if (Snd.Playing(w.id, out var ms))
				{
					Plugin.Log.LogInfo((object)("SHINO_VOICE audible " + w.ev + " posMs=" + ms));
					watch.RemoveAt(num);
				}
				else if (Time.time - w.postT > 1.5f)
				{
					Plugin.Log.LogInfo((object)("SHINO_VOICE NOT_PLAYING " + w.ev + " id=" + w.id));
					watch.RemoveAt(num);
				}
			}
		}
	}
	public sealed class ShinoClone : NetworkBehaviour
	{
		public static GameObject Prefab;

		public static BodyIndex Index = (BodyIndex)(-1);

		public byte skin;

		public NetworkInstanceId ownerId;

		private CharacterBody owner;

		private CharacterBody body;

		private float born;

		private float nextTaunt;

		private int hits;

		private bool burst;

		public static int AuraCount = 260;

		public static int GatherCount = 560;

		public static float AuraRadius = 1.55f;

		public static float GatherRadius = 1.35f;

		public static float GatherTight = 0.7f;

		public static float GatherReveal = 0.3f;

		public static float GatherSettle = 0.85f;

		private Swarm aura;

		private CharVisual vis;

		private bool revealed;

		public CharacterBody Owner
		{
			get
			{
				//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_0020: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)owner) && ownerId != NetworkInstanceId.Invalid)
				{
					GameObject val = Util.FindNetworkObject(ownerId);
					owner = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
				}
				return owner;
			}
		}

		public static void Build()
		{
			//IL_0087: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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)
			SkinDef[] sharedSkins = CharVisual.SharedSkins;
			Prefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"), "ShedurrShinoCloneBody", true);
			CharacterBody component = Prefab.GetComponent<CharacterBody>();
			component.baseNameToken = "SHINO_CLONE_NAME";
			component.subtitleNameToken = "";
			LanguageAPI.Add("SHINO_CLONE_NAME", "Insect Clone");
			component.baseMaxHealth = 200f;
			component.levelMaxHealth = 60f;
			component.baseRegen = 0f;
			component.levelRegen = 0f;
			component.baseArmor = 0f;
			component.bodyFlags = (BodyFlags)(component.bodyFlags | 2);
			component.portraitIcon = (Texture)(object)Media.Icon("portrait").texture;
			CharVisual.Build(((Component)Prefab.GetComponent<ModelLocator>().modelTransform).gameObject, display: false);
			CharVisual.SharedSkins = sharedSkins;
			EntityStateMachine[] components = Prefab.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Body")
				{
					val.initialStateType = new SerializableEntityStateType(typeof(Idle));
					val.mainStateType = new SerializableEntityStateType(typeof(Idle));
				}
			}
			Prefab.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(CloneBurst));
			Prefab.AddComponent<ShinoClone>();
			Plugin.ExtraBodies.Add(Prefab);
			((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)delegate
			{
				//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)
				Index = BodyCatalog.FindBodyIndex(Prefab);
			});
		}

		public unsafe static void Spawn(CharacterBody owner, Vector3 at, Vector3 fwd)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_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_0109: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)Prefab))
			{
				fwd.y = 0f;
				if (((Vector3)(ref fwd)).sqrMagnitude < 0.01f)
				{
					fwd = Vector3.forward;
				}
				GameObject obj = Object.Instantiate<GameObject>(Prefab, at + Vector3.up * 0.05f, Quaternion.LookRotation(fwd));
				ShinoClone component = obj.GetComponent<ShinoClone>();
				component.owner = owner;
				component.ownerId = ((NetworkBehaviour)owner).netId;
				component.skin = (byte)Mathf.Max(0, (int)owner.skinIndex);
				CharacterBody component2 = obj.GetComponent<CharacterBody>();
				component2.baseMaxHealth = Mathf.Max(50f, owner.maxHealth * Tuning.CloneHealth.Value);
				component2.levelMaxHealth = 0f;
				component2.level = 1f;
				TeamComponent component3 = obj.GetComponent<TeamComponent>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					component3.teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)owner.teamComponent)) ? 1 : ((int)owner.teamComponent.teamIndex));
				}
				CharacterDirection component4 = obj.GetComponent<CharacterDirection>();
				if (Object.op_Implicit((Object)(object)component4))
				{
					component4.forward = fwd;
				}
				NetworkServer.Spawn(obj);
				Action<string> trace = Combat.Trace;
				if (trace != null)
				{
					Vector3 val = at;
					trace("CLONE spawn at=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString());
				}
			}
		}

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			born = Time.time;
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body))
			{
				body.RecalculateStats();
				if (Object.op_Implicit((Object)(object)body.healthComponent))
				{
					body.healthComponent.health = body.healthComponent.fullHealth;
				}
			}
			vis = CharVisual.Find(body);
			if (Object.op_Implicit((Object)(object)vis))
			{
				vis.Hidden = true;
			}
			if (Object.op_Implicit((Object)(object)body))
			{
				aura = Insects.On(body, SwarmKind.Swarm, GatherCount, GatherRadius);
				aura.sizeMul = 1.45f;
				aura.minPx = 1.6f;
			}
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)aura) || burst)
			{
				return;
			}
			float num = Time.time - born;
			if (num < GatherReveal)
			{
				float num2 = Mathf.SmoothStep(0f, 1f, num / GatherReveal);
				aura.SetRadius(Mathf.Lerp(GatherRadius, GatherTight, num2));
				return;
			}
			if (!revealed)
			{
				revealed = true;
				if (Object.op_Implicit((Object)(object)vis))
				{
					vis.Hidden = false;
				}
			}
			float num3 = Mathf.SmoothStep(0f, 1f, (num - GatherReveal) / Mathf.Max(0.05f, GatherSettle - GatherReveal));
			if (!(num3 >= 1f) || aura.count != AuraCount)
			{
				aura.SetRadius(Mathf.Lerp(GatherTight, AuraRadius, num3));
				aura.SetCount(Mathf.RoundToInt(Mathf.Lerp((float)GatherCount, (float)AuraCount, num3)));
				aura.sizeMul = Mathf.Lerp(1.45f, 1.35f, num3);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)aura))
			{
				aura.Despawn(0.25f);
			}
		}

		public static void OnDamage(DamageReport r)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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)
			if (!NetworkServer.active || r == null || !Object.op_Implicit((Object)(object)r.victimBody) || r.victimBody.bodyIndex != Index)
			{
				return;
			}
			ShinoClone component = ((Component)r.victimBody).GetComponent<ShinoClone>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.hits++;
				Combat.Trace?.Invoke("CLONE hit n=" + component.hits + " by=" + (Object.op_Implicit((Object)(object)r.attackerBody) ? ((Object)r.attackerBody).name : "?"));
				if (component.hits >= Tuning.CloneHits.Value && r.victimBody.healthComponent.alive)
				{
					r.victimBody.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
			{
				return;
			}
			if (Time.time - born > Tuning.CloneSeconds.Value)
			{
				Combat.Trace?.Invoke("CLONE expire");
				body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
			}
			else
			{
				if (!(Time.time >= nextTaunt))
				{
					return;
				}
				nextTaunt = Time.time + 0.5f;
				float num = Tuning.CloneTaunt.Value * Tuning.CloneTaunt.Value;
				TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? 1 : ((int)body.teamComponent.teamIndex));
				foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
				{
					if (!Object.op_Implicit((Object)(object)readOnlyInstances) || readOnlyInstances.teamIndex == val)
					{
						continue;
					}
					CharacterBody val2 = readOnlyInstances.GetBody();
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					Vector3 val3 = val2.corePosition - body.corePosition;
					if (((Vector3)(ref val3)).sqrMagnitude > num || (val2.isBoss && Random.value < 0.5f))
					{
						continue;
					}
					BaseAI[] aiComponents = readOnlyInstances.aiComponents;
					foreach (BaseAI val4 in aiComponents)
					{
						if (Object.op_Implicit((Object)(object)val4))
						{
							val4.currentEnemy.gameObject = ((Component)this).gameObject;
							val4.enemyAttentionDuration = 1f;
						}
					}
				}
			}
		}

		public void Burst()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			if (burst)
			{
				return;
			}
			burst = true;
			Combat.Trace?.Invoke("CLONE burst hits=" + hits + " age=" + (Time.time - born).ToString("0.0") + " y=" + ((Component)this).transform.position.y.ToString("0.0"));
			Vector3 val = (Object.op_Implicit((Object)(object)body) ? body.corePosition : ((Component)this).transform.position);
			if (Object.op_Implicit((Object)(object)aura))
			{
				aura.Despawn(0.15f);
				aura = null;
			}
			Swarm swarm = Insects.BurstAt(val, Vector3.up, 480, 3.2f, 1.7f, 0.45f);
			swarm.sizeMul = 1.7f;
			swarm.minPx = 1.6f;
			Swarm swarm2 = Insects.BurstAt(val + Vector3.up * 0.3f, Vector3.up, 320, 2.8f, 1.35f);
			swarm2.sizeMul = 1.45f;
			swarm2.minPx = 1.5f;
			Swarm swarm3 = Insects.Spawn(SwarmKind.Swarm, val + Vector3.up * 0.6f, 300, 2.1f);
			swarm3.sizeMul = 1.3f;
			swarm3.minPx = 1.5f;
			swarm3.Despawn(1.4f);
			Snd.Sfx("Insect", ((Component)this).gameObject);
			CharacterBody val2 = Owner;
			if (Object.op_Implicit((Object)(object)val2))
			{
				Lines.Say(val2, "Clone", 1, 8f);
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)val2))
			{
				for (int i = 0; i < Mathf.Max(1, Tuning.CloneColonies.Value); i++)
				{
					Vector3 at = Combat.Ground(val + Quaternion.Euler(0f, (float)i * 360f / (float)Tuning.CloneColonies.Value, 0f) * Vector3.forward * 1.6f, 10f);
					ShinoColony.Spawn(val2, at, (DamageSource)4, ColonyMode.Roam, null, Vector3.zero, 0);
				}
			}
		}

		public override bool OnSerialize(NetworkWriter w, bool initial)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!initial)
			{
				return false;
			}
			w.Write(skin);
			w.Write(ownerId);
			return true;
		}

		public override void OnDeserialize(NetworkReader r, bool initial)
		{
			//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)
			if (initial)
			{
				skin = r.ReadByte();
				ownerId = r.ReadNetworkId();
			}
		}
	}
	public sealed class CloneBurst : BaseState
	{
		public override void OnEnter()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			ShinoClone component = ((EntityState)this).GetComponent<ShinoClone>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.Burst();
			}
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)charVisual))
			{
				charVisual.Hidden = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 0.5f)
			{
				NetworkServer.Destroy(((EntityState)this).gameObject);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
	public sealed class ShinoTornado : NetworkBehaviour
	{
		public static GameObject Prefab;

		public static readonly List<ShinoTornado> All = new List<ShinoTornado>();

		public static readonly float[] RadiusMul = new float[3] { 1f, 1.5f, 3.85f };

		public static readonly float[] LifeMul = new float[3] { 1f, 1.35f, 1.8f };

		public static readonly float[] PullMul = new float[3] { 1f, 1.2f, 1.5f };

		public static readonly float[] TickMul = new float[3] { 1.25f, 1.25f, 0.95f };

		public static readonly float[] PullRMul = new float[3] { 2.2f, 2.2f, 1.45f };

		public static readonly int[] LookCount = new int[3] { 4400, 7200, 21000 };

		public static float GrowSeconds = 1.7f;

		public byte tier;

		public float radius;

		public NetworkInstanceId ownerId;

		private Vector3 netPos;

		private Vector3 dir;

		private float fall;

		private CharacterBody owner;

		private float born;

		private float life;

		private float nextTick;

		private float nextShed;

		private float sendAt;

		private int slice;

		private Swarm look;

		private bool folded;

		public Vector3 Dir => dir;

		public float Age => Time.time - born;

		private float Grow
		{
			get
			{
				if (tier != 0)
				{
					return Mathf.SmoothStep(0f, 1f, Age / GrowSeconds);
				}
				return 1f;
			}
		}

		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
			GameObject val = new GameObject("ShedurrShinoTornadoTemplate");
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<ShinoTornado>();
			Prefab = PrefabAPI.InstantiateClone(val, "ShedurrShinoTornado", true);
			Object.Destroy((Object)val);
			Plugin.NetworkPrefabs.Add(Prefab);
		}

		public static void Cast(CharacterBody owner, Vector3 foot, Vector3 dir)
		{
			//IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0067: 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_007c: 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_0097: 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_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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)Prefab))
			{
				List<ShinoColony> list = ShinoColony.Owned(owner, null);
				int num = TornadoTier.FromCount(list.Count);
				float num2 = Tuning.TornadoRadius.Value * RadiusMul[num];
				Vector3 val = foot + dir * (3.5f + num2 * 0.45f);
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Linecast(foot + Vector3.up * 1.2f, val + Vector3.up * 1.2f, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					val = ((RaycastHit)(ref val2)).point - dir * 0.8f - Vector3.up * 1.2f;
				}
				GameObject val3 = Object.Instantiate<GameObject>(Prefab, Combat.Ground(val, 20f), Quaternion.identity);
				ShinoTornado component = val3.GetComponent<ShinoTornado>();
				component.owner = owner;
				component.ownerId = ((NetworkBehaviour)owner).netId;
				component.tier = (byte)num;
				component.dir = dir;
				component.netPos = val3.transform.position;
				component.radius = num2;
				component.life = Tuning.TornadoSeconds.Value * LifeMul[num];
				NetworkServer.Spawn(val3);
				int count = list.Count;
				for (int i = 0; i < count; i++)
				{
					list[i].Consume();
				}
				Combat.Trace?.Invoke("TORNADO cast tier=" + TornadoTier.Names[num] + " consumed=" + count + " radius=" + num2.ToString("0.0") + " life=" + component.life.ToString("0.0"));
			}
		}

		private void Awake()
		{
			All.Add(this);
			born = Time.time;
		}

		private void OnDestroy()
		{
			All.Remove(this);
			if (Object.op_Implicit((Object)(object)look))
			{
				look.Despawn(TornadoSwarm.EndSeconds);
			}
		}

		private void Start()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp((int)tier, 0, 2);
			float num2 = radius / RadiusMul[num];
			look = Insects.Spawn(SwarmKind.Tornado, ((Component)this).transform.position, LookCount[0], Mathf.Max(1f, num2));
			Feed();
			Snd.Sfx(num switch
			{
				1 => "TornadoL", 
				2 => "TornadoM", 
				_ => "Tornado", 
			}, ((Component)this).gameObject);
		}

		private void Feed()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp((int)tier, 0, 2);
			float grow = Grow;
			float num2 = radius / RadiusMul[num];
			float num3 = Mathf.Lerp(num2, radius, grow);
			look.SetAnchor(((Component)this).transform.position);
			look.SetRadius(Mathf.Max(1f, num3));
			look.SetCount(Mathf.RoundToInt(Mathf.Lerp((float)LookCount[0], (float)LookCount[num], grow)));
			look.P[0] = Mathf.Lerp(TornadoSwarm.HeightFor(num2, 0), TornadoSwarm.HeightFor(radius, num), grow);
			look.P[1] = num;
			look.P[2] = dir.x;
			look.P[3] = dir.z;
		}

		private void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, netPos, 1f - Mathf.Exp((0f - Time.deltaTime) * 10f));
			}
			if (Object.op_Implicit((Object)(object)look))
			{
				Feed();
			}
		}

		public static void ShedLook(Vector3 colony)
		{
			//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_004c: 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_004e: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_009d: 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_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_00b4: Unknown result type (might be due to invalid IL or missing references)
			foreach (ShinoTornado item in All)
			{
				if (Object.op_Implicit((Object)(object)item) && !(item.Age < 0.8f))
				{
					Vector3 position = ((Component)item).transform.position;
					float num = item.radius + 4f;
					Vector3 val = position - colony;
					if (!(((Vector3)(ref val)).sqrMagnitude > num * num))
					{
						Vector3 val2 = position + Vector3.up * (2.5f + item.radius * 0.35f) + (colony - position) * 0.35f;
						Insects.BurstAt(val2, colony + Vector3.up * 0.3f - val2, 120, 1.25f, 0.8f, 0.32f).sizeMul = 1.3f;
						break;
					}
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: 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_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: 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_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: 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_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_070f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: 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_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)owner))
			{
				GameObject val = Util.FindNetworkObject(ownerId);
				owner = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
			}
			if (Object.op_Implicit((Object)(object)owner) && !folded && Time.time - born > life - 0.7f)
			{
				folded = true;
				FoldIn();
			}
			if (Time.time - born > life || !Object.op_Implicit((Object)(object)owner))
			{
				FoldIn();
				Combat.Trace?.Invoke("TORNADO end age=" + (Time.time - born).ToString("0.0") + " owner=" + ((Object)(object)owner != (Object)null) + " atPlay=" + ShinoColony.Count(owner));
				NetworkServer.Destroy(((Component)this).gameObject);
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			float num = Tuning.TornadoSpeed.Value * Time.fixedDeltaTime;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.SphereCast(position + Vector3.up * 1.2f, 0.8f, dir, ref val2, num + 0.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).normal.y < 0.5f)
			{
				Vector3 normal = ((RaycastHit)(ref val2)).normal;
				normal.y = 0f;
				if (((Vector3)(ref normal)).sqrMagnitude > 0.01f)
				{
					dir = Vector3.ProjectOnPlane(dir, ((Vector3)(ref normal)).normalized);
					if (((Vector3)(ref dir)).sqrMagnitude < 0.05f)
					{
						Vector3 val3 = Vector3.Cross(Vector3.up, normal);
						dir = ((Vector3)(ref val3)).normalized;
					}
					((Vector3)(ref dir)).Normalize();
				}
			}
			position += dir * num;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(position + Vector3.up * 1.5f, Vector3.down, ref val4, 6f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val4)).normal.y > 0.45f)
			{
				fall = 0f;
				position.y = ((RaycastHit)(ref val4)).point.y;
			}
			else
			{
				fall += 9.8f * Time.fixedDeltaTime;
				position.y -= fall * Time.fixedDeltaTime;
			}
			((Component)this).transform.position = position;
			netPos = position;
			int num2 = Mathf.Clamp((int)tier, 0, 2);
			float num3 = radius * PullRMul[num2];
			float num4 = Tuning.TornadoPull.Value * PullMul[num2];
			float num5 = radius * 0.45f;
			float num6 = Mathf.Min(3.2f, 1.2f + radius * 0.15f);
			Vector3 val7 = default(Vector3);
			Vector3 val9 = default(Vector3);
			foreach (HurtBox item in Combat.Around(owner, position + Vector3.up * radius * 0.8f, num3, sight: false))
			{
				CharacterBody val5 = (Object.op_Implicit((Object)(object)item.healthComponent) ? item.healthComponent.body : null);
				if (Object.op_Implicit((Object)(object)val5) && !Combat.IsHeavy(val5))
				{
					Vector3 val6 = position + Vector3.up * 1.2f - val5.corePosition;
					((Vector3)(ref val7))..ctor(val6.x, 0f, val6.z);
					float num7 = ((Vector3)(ref val7)).magnitude;
					if (num7 < 0.05f)
					{
						val7 = dir;
						num7 = 0.05f;
					}
					Vector3 val8 = val7 / num7;
					((Vector3)(ref val9))..ctor(val8.z, 0f, 0f - val8.x);
					float num8 = 1f - Mathf.Clamp01(num7 / num3);
					float num9 = num4 * (0.55f + 0.45f * num8);
					bool flag = Object.op_Implicit((Object)(object)val5.characterMotor);
					bool flag2 = (flag ? val5.characterMotor.mass : (Object.op_Implicit((Object)(object)val5.rigidbody) ? val5.rigidbody.mass : 1000f)) < 260f;
					Vector3 val10;
					if (num7 > num5)
					{
						val10 = val8 * num9 + val9 * (num9 * 0.45f) + Vector3.up * (flag ? 2f : Mathf.Clamp(val6.y * 2f, -4f, 4f));
					}
					else
					{
						float num10 = (num7 - num5 * 0.55f) * 3f;
						val10 = val8 * num10 + val9 * (num4 * 0.5f) + Vector3.up * ((flag2 || !flag) ? Mathf.Clamp((position.y + num6 - val5.footPosition.y) * 3f, -4f, 5f) : 1.5f);
					}
					if (flag)
					{
						val5.characterMotor.velocity = Vector3.Lerp(val5.characterMotor.velocity, val10, 0.25f);
						((BaseCharacterController)val5.characterMotor).Motor.ForceUnground(0.1f);
					}
					else if (Object.op_Implicit((Object)(object)val5.rigidbody))
					{
						val5.rigidbody.velocity = Vector3.Lerp(val5.rigidbody.velocity, val10, 0.25f);
					}
				}
			}
			if (Time.time >= nextTick)
			{
				nextTick = Time.time + 0.05f;
				slice = (slice + 1) % 5;
				bool crit = owner.RollCrit();
				Combat.Source = "tornado:" + tier;
				foreach (HurtBox item2 in Combat.Around(owner, position + Vector3.up * radius * 0.8f, radius * TickMul[Mathf.Clamp((int)tier, 0, 2)], sight: false))
				{
					if (Object.op_Implicit((Object)(object)item2.healthComponent) && Object.op_Implicit((Object)(object)item2.healthComponent.body))
					{
						NetworkInstanceId netId = ((NetworkBehaviour)item2.healthComponent.body).netId;
						if (((NetworkInstanceId)(ref netId)).Value % 5 == (uint)slice && Combat.Deal(owner, item2, Combat.Point(item2, position), Tuning.TornadoDamage.Value * (1f + 0.35f * (float)(int)tier), 0.4f, crit, Vector3.up * 200f, (DamageType)0, null, (DamageColorIndex)0, (DamageSource)8) && Object.op_Implicit((Object)(object)item2.healthComponent.body))
						{
							InfestHost.Apply(owner, item2.healthComponent.body, 1, (DamageSource)8);
						}
					}
				}
			}
			if (Time.time >= sendAt)
			{
				sendAt = Time.time + 0.1f;
				((NetworkBehaviour)this).SetDirtyBit(1u);
			}
		}

		private void FoldIn()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)owner))
			{
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			float num = radius * 1.6f + 6f;
			int num2 = 0;
			foreach (ShinoColony item in ShinoColony.Owned(owner, null))
			{
				if (!Object.op_Implicit((Object)(object)item) || !(item.Created >= born))
				{
					continue;
				}
				if ((int)item.Src != 8)
				{
					Vector3 val = ((Component)item).transform.position - position;
					if (!(((Vector3)(ref val)).sqrMagnitude < num * num))
					{
						continue;
					}
				}
				item.Consume();
				num2++;
			}
			if (num2 > 0)
			{
				Combat.Trace?.Invoke("TORNADO fold-in " + num2 + " atPlay=" + ShinoColony.Count(owner));
			}
		}

		public override float GetNetworkSendInterval()
		{
			return 0.1f;
		}

		public override int GetNetworkChannel()
		{
			return 1;
		}

		public override bool OnSerialize(NetworkWriter w, bool initial)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			w.Write(netPos);
			w.Write(tier);
			w.Write(radius);
			w.Write(ownerId);
			w.Write(dir);
			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_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_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_0046: Unknown result type (might be due to invalid IL or missing references)
			netPos = r.ReadVector3();
			tier = r.ReadByte();
			radius = r.ReadSingle();
			ownerId = r.ReadNetworkId();
			dir = r.ReadVector3();
			if (initial)
			{
				((Component)this).transform.position = netPos;
			}
		}
	}
	public static class Combat
	{
		public sealed class SpreadDealer : MonoBehaviour
		{
			public CharacterBody attacker;

			public Vector3 center;

			public float coef;

			public float proc;

			public float force;

			public float upward;

			public DamageType type;

			public bool crit;

			public string source;

			public DamageSource damageSource;

			public readonly List<HurtBox> targets = new List<HurtBox>();

			private void FixedUpdate()
			{
				//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_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: 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_0095: 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_00b4: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				int num = 0;
				while (targets.Count > 0 && num < PerStep)
				{
					HurtBox val = targets[0];
					targets.RemoveAt(0);
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive && Object.op_Implicit((Object)(object)attacker))
					{
						num++;
						Vector3 val2 = Point(val, center);
						Vector3 val3 = val2 - center;
						val3.y = 0f;
						val3 = ((((Vector3)(ref val3)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref val3)).normalized);
						Source = source;
						CharacterBody obj = attacker;
						float coefficient = coef;
						float num2 = proc;
						bool num3 = crit;
						Vector3 val4 = val3 + Vector3.up * upward;
						Deal(obj, val, val2, coefficient, num2, num3, ((Vector3)(ref val4)).normalized * force, type, null, (DamageColorIndex)0, damageSource);
					}
				}
				if (targets.Count == 0 || !Object.op_Implicit((Object)(object)attacker))
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		public static Action<string> Trace;

		public static string Source = "";

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

		public static int PerStep = 6;

		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 unsafe 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, DamageSource damageSource = (DamageSource)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_0070: 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_0073: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			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,
				inflictedHurtbox = hurt,
				damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit(type), (DamageTypeExtended)0, damageSource),
				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 + " slot=" + ((object)(*(DamageSource*)(&damageSource))/*cast due to .constrained prefix*/).ToString() + " 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, DamageSource damageSource = (DamageSource)0, bool sight = true)
		{
			//IL_001b: 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_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_0053: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_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_00b7: 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, sight))
			{
				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, damageSource))
					{
						num++;
					}
				}
			}
			return num;
		}

		public static int BlastSpread(CharacterBody attacker, Vector3 center, float radius, float coefficient, float proc, float force, DamageType type = (DamageType)0u, float upward = 0.35f, string source = null, DamageSource damageSource = (DamageSource)0)
		{
			//IL_0012: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)attacker))
			{
				return 0;
			}
			List<HurtBox> list = Around(attacker, center, radius);
			if (list.Count == 0)
			{
				return 0;
			}
			SpreadDealer spreadDealer = new GameObject("ShinoBlastSpread").AddComponent<SpreadDealer>();
			spreadDealer.attacker = attacker;
			spreadDealer.center = center;
			spreadDealer.coef = coefficient;
			spreadDealer.proc = proc;
			spreadDealer.force = force;
			spreadDealer.type = type;
			spreadDealer.upward = upward;
			spreadDealer.crit = attacker.RollCrit();
			spreadDealer.source = source ?? Source;
			spreadDealer.damageSource = damageSource;
			spreadDealer.targets.AddRange(list);
			return list.Count;
		}

		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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)2);
			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) && ((RaycastHit)(ref val)).collider.isTrigger)
				{
					continue;
				}
				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 int Box(CharacterBody attacker, Vector3 center, Vector3 half, Quaternion rot, Dictionary<HealthComponent, HurtBox> into)
		{
			//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_000e: 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)
			into.Clear();
			int num = Physics.OverlapBoxNonAlloc(center, half, buffer, rot, 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) && (!into.ContainsKey(component.healthComponent) || component.isBullseye))
				{
					into[component.healthComponent] = component;
				}
			}
			return into.Count;
		}

		public static List<HurtBox> Cone(CharacterBody attacker, Vector3 origin, Vector3 dir, float range, float halfAngle, bool sight = false)
		{
			//IL_0008: 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_001e: 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_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_003f: 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_0058: 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)
			List<HurtBox> list = new List<HurtBox>();
			dir = ((Vector3)(ref dir)).normalized;
			float num = Mathf.Cos(halfAngle * (MathF.PI / 180f));
			foreach (HurtBox item in Around(attacker, origin, range, sight))
			{
				Vector3 val = Point(item, origin) - origin;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 2.5f || Vector3.Dot(val / Mathf.Max(0.01f, magnitude), dir) >= num)
				{
					list.Add(item);
				}
			}
			return list;
		}

		public static List<HurtBox> Front(CharacterBody attacker, Vector3 origin, Vector3 fwd, float range, float halfAngle, float minUp, float maxUp)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			List<HurtBox> list = new List<HurtBox>();
			fwd.y = 0f;
			fwd = ((Vector3)(ref fwd)).normalized;
			float num = Mathf.Cos(halfAngle * (MathF.PI / 180f));
			foreach (HurtBox item in Around(attacker, origin + Vector3.up * (minUp + maxUp) * 0.5f, Mathf.Sqrt(range * range + (maxUp - minUp) * (maxUp - minUp) * 0.25f), sight: false))
			{
				Vector3 val = Point(item, origin) - origin;
				float y = val.y;
				val.y = 0f;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (!(y < minUp) && !(y > maxUp) && !(magnitude > range) && (magnitude < 2f || Vector3.Dot(val / Mathf.Max(0.01f, magnitude), fwd) >= num))
				{
					list.Add(item);
				}
			}
			return list;
		}

		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 ShinoDeath : GenericCharacterDeath
	{
		public override void OnEnter()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			Lines.Say(((EntityState)this).characterBody, "Death", 4);
			if (Object.op_Implicit((Object)(object)charVisual))
			{
				try
				{
					Ragdoll.Spawn(charVisual, Object.op_Implicit((Object)(object)ShinoRemoteMotion.For(((EntityState)this).characterBody)) ? ShinoRemoteMotion.For(((EntityState)this).characterBody).Velocity : Vector3.zero);
					return;
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("SHINO_RAGDOLL " + ex));
					return;
				}
			}
			Plugin.Log.LogWarning((object)"SHINO_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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//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_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: 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_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: 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)("SHINO_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;
			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)"SHINO_RAGDOLL spawned");
		}
	}
	public static class Fx
	{
		public static readonly List<EffectDef> Effects = new List<EffectDef>();

		private static Material glow;

		private static Material additive;

		private static Material alpha;

		private static Texture2D soft;

		private static Texture2D ring;

		private static Material rocks;

		private static Material smoke;

		private static Texture2D cloud;

		private static Material dustMat;

		private static Mesh quadMesh;

		private static Mesh[] chunkMeshes;

		private static Material chunkMat;

		public static Texture2D Soft
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)soft))
				{
					soft = Radial(64, (float r) => Mathf.Pow(Mathf.Clamp01(1f - r * r), 2f));
				}
				return soft;
			}
		}

		public static Texture2D Ring
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)ring))
				{
					ring = Radial(128, (float r) => Mathf.Clamp01(1f - Mathf.Abs(r - 0.82f) / 0.14f) * (float)((r < 1f) ? 1 : 0));
				}
				return ring;
			}
		}

		public static Material Glow
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)glow))
				{
					glow = Transparent(add: true);
					glow.mainTexture = (Texture)(object)Soft;
				}
				return glow;
			}
		}

		public static Material Rocks
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)rocks))
				{
					rocks = Transparent(add: false);
					Texture2D val = Media.Texture("rock.png");
					rocks.mainTexture = (Texture)(object)(Object.op_Implicit((Object)(object)val) ? val : Soft);
				}
				return rocks;
			}
		}

		public static Texture2D Cloud
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: 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_019a: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)cloud))
				{
					cloud = new Texture2D(64, 64, (TextureFormat)4, false);
					Color[] array = (Color[])(object)new Color[4096];
					Random random = new Random(7);
					float[,] array2 = new float[9, 9];
					for (int i = 0; i < 9; i++)
					{
						for (int j = 0; j < 9; j++)
						{
							array2[i, j] = (float)random.NextDouble();
						}
					}
					for (int k = 0; k < 64; k++)
					{
						for (int l = 0; l < 64; l++)
						{
							float num = (float)l / 63f * 8f;
							float num2 = (float)k / 63f * 8f;
							int num3 = Mathf.Min(7, (int)num);
							int num4 = Mathf.Min(7, (int)num2);
							float num5 = Mathf.SmoothStep(0f, 1f, num - (float)num3);
							float num6 = Mathf.SmoothStep(0f, 1f, num2 - (float)num4);
							float num7 = Mathf.Lerp(Mathf.Lerp(array2[num3, num4], array2[num3 + 1, num4], num5), Mathf.Lerp(array2[num3, num4 + 1], array2[num3 + 1, num4 + 1], num5), num6);
							float num8 = Vector2.Distance(new Vector2((float)l, (float)k), new Vector2(31.5f, 31.5f)) / 31.5f;
							float num9 = Mathf.Clamp01((1f - num8) * 1.6f - num7 * 0.55f);
							float num10 = 0.82f + 0.18f * (1f - num7);
							array[k * 64 + l] = new Color(num10, num10, num10, num9 * num9);
						}
					}
					cloud.SetPixels(array);
					cloud.Apply();
					((Texture)cloud).wrapMode = (TextureWrapMode)1;
				}
				return cloud;
			}
		}

		public static Material DustMat
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)dustMat))
				{
					Texture2D val = Media.Texture("dust.png");
					dustMat = (Object.op_Implicit((Object)(object)val) ? AlphaTex((Texture)(object)val) : SmokeMat);
				}
				return dustMat;
			}
		}

		public static Material SmokeMat
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)smoke))
				{
					smoke = Transparent(add: false);
					smoke.mainTexture = (Texture)(object)Cloud;
				}
				return smoke;
			}
		}

		public static Material AlphaSoft
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)alpha))
				{
					alpha = Transparent(add: false);
					alpha.mainTexture = (Texture)(object)Soft;
				}
				return alpha;
			}
		}

		public static Mesh QuadMesh
		{
			get
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				if (!Object.op_Implicit((Object)(object)quadMesh))
				{
					quadMesh = new Mesh();
					quadMesh.vertices = (Vector3[])(object)new Vector3[4]
					{
						new Vector3(-0.5f, -0.5f),
						new Vector3(0.5f, -0.5f),
						new Vector3(0.5f, 0.5f),
						new Vector3(-0.5f, 0.5f)
					};
					quadMesh.uv = (Vector2[])(object)new Vector2[4]
					{
						new Vector2(0f, 0f),
						new Vector2(1f, 0f),
						new Vector2(1f, 1f),
						new Vector2(0f, 1f)
					};
					quadMesh.triangles = new int[6] { 0, 2, 1, 0, 3, 2 };
					quadMesh.RecalculateNormals();
				}
				return quadMesh;
			}
		}

		public static Material Transparent(bool add)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			Material val = new Material(Shader.Find("Hopoo Games/FX/Cloud Remap"))
			{
				renderQueue = 3000
			};
			val.SetInt("_SrcBlend", 5);
			val.SetInt("_DstBlend", add ? 1 : 10);
			val.SetInt("_ZWrite", 0);
			val.SetInt("_ZTest", 4);
			val.SetInt("_Cull", 0);
			val.SetFloat("_AlphaBoost", 1f);
			val.SetFloat("_AlphaBias", 0f);
			val.SetFloat("_Boost", 1f);
			val.SetFloat("_InvFade", 0f);
			val.EnableKeyword("DISABLEREMAP");
			val.DisableKeyword("USE_CLOUDS");
			val.DisableKeyword("CALCTEXTUREALPHA");
			val.SetTexture("_Cloud1Tex", (Texture)(object)Texture2D.whiteTexture);
			val.SetTexture("_Cloud2Tex", (Texture)(object)Texture2D.whiteTexture);
			val.SetColor("_Color", Color.white);
			val.SetColor("_TintColor", Color.white);
			return val;
		}

		private static Texture2D Radial(int n, Func<float, float> f)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Texture2D val = new Texture2D(n, n, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[n * n];
			float num = (float)(n - 1) * 0.5f;
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < n; j++)
				{
					float arg = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)) / num;
					float num2 = f(arg);
					array[i * n + j] = new Color(1f, 1f, 1f, num2);
				}
			}
			val.SetPixels(array);
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		public s