Decompiled source of KaiSa v0.2.15

BepInEx/plugins/KaisaPrototype/KaisaRoR2.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using MonoMod.RuntimeDetour;
using R2API;
using RoR2;
using RoR2.Networking;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace KaisaRoR2;

public class KaisaTargetVisual : MonoBehaviour
{
	private KaisaController owner;

	private LineRenderer[] corners;

	private GameObject root;

	private float hitUntil;

	private HealthComponent hitTarget;

	private void Awake()
	{
		owner = ((Component)this).GetComponent<KaisaController>();
	}

	public void Hit(HealthComponent target)
	{
		hitTarget = target;
		hitUntil = Time.time + 0.16f;
	}

	private void LateUpdate()
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Expected O, but got Unknown
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01f1: 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_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: 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_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)owner.Body) || !((NetworkBehaviour)owner.Body).hasAuthority || !owner.Body.healthComponent.alive || !Object.op_Implicit((Object)(object)Run.instance))
		{
			Hide();
			return;
		}
		HurtBox val = owner.PrimaryTarget();
		Camera val2 = CombatRing.CameraFor(owner.Body);
		if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || owner.AimingR)
		{
			Hide();
			return;
		}
		if (!Object.op_Implicit((Object)(object)root))
		{
			root = new GameObject("KaisaAutoAttackTarget");
			corners = (LineRenderer[])(object)new LineRenderer[4];
			for (int i = 0; i < 4; i++)
			{
				corners[i] = CombatRing.Line(root.transform, "TargetCross", 2, 0.055f);
			}
		}
		root.SetActive(true);
		Vector3 val3 = (Object.op_Implicit((Object)(object)val.healthComponent.body) ? val.healthComponent.body.corePosition : ((Component)val).transform.position);
		Transform transform = root.transform;
		Vector3 val4 = ((Component)val2).transform.position - val3;
		transform.position = val3 + ((Vector3)(ref val4)).normalized * Mathf.Min(Vector3.Distance(((Component)val2).transform.position, val3) * 0.8f, (Object.op_Implicit((Object)(object)val.healthComponent.body) ? val.healthComponent.body.radius : 1f) + 0.5f);
		root.transform.rotation = ((Component)val2).transform.rotation;
		float num = Mathf.Clamp(Vector3.Distance(((Component)val2).transform.position, val3) * 0.012f, 0.25f, 4f);
		bool flag = (Object)(object)hitTarget == (Object)(object)val.healthComponent && Time.time < hitUntil;
		Color val5 = (Color)(flag ? Color.white : new Color(0.85f, 0.25f, 1f));
		float num2 = num * (flag ? 0.92f : 1f);
		float num3 = num2 * 0.32f;
		Vector3 val6 = default(Vector3);
		for (int i = 0; i < 4; i++)
		{
			float num4 = (float)(45 + i * 90) * ((float)Math.PI / 180f);
			((Vector3)(ref val6))..ctor(Mathf.Cos(num4), Mathf.Sin(num4), 0f);
			corners[i].SetPosition(0, val6 * num2 * 0.25f);
			corners[i].SetPosition(1, val6 * num2);
			LineRenderer obj = corners[i];
			float startWidth = (corners[i].endWidth = num2 * 0.13f);
			obj.startWidth = startWidth;
			LineRenderer obj2 = corners[i];
			Color startColor = (corners[i].endColor = val5);
			obj2.startColor = startColor;
		}
	}

	private void Hide()
	{
		if (Object.op_Implicit((Object)(object)root))
		{
			root.SetActive(false);
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)root))
		{
			Object.Destroy((Object)(object)root);
		}
	}
}
public static class CombatRing
{
	private static Material material;

	public static Material Material
	{
		get
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)material))
			{
				material = new Material(KaisaPlugin.Bundle.LoadAsset<Material>("CombatFX"));
				material.color = Color.white;
			}
			return material;
		}
	}

	public static Camera CameraFor(CharacterBody body)
	{
		foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList)
		{
			if (Object.op_Implicit((Object)(object)readOnlyInstances) && (Object)(object)readOnlyInstances.targetBody == (Object)(object)body && Object.op_Implicit((Object)(object)readOnlyInstances.sceneCam))
			{
				return readOnlyInstances.sceneCam;
			}
		}
		return null;
	}

	public static LineRenderer Line(Transform parent, string name, int points, float width)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		Material sharedMaterial = Material;
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent, false);
		LineRenderer val2 = val.AddComponent<LineRenderer>();
		((Renderer)val2).sharedMaterial = sharedMaterial;
		val2.useWorldSpace = false;
		val2.positionCount = points;
		float startWidth = (val2.endWidth = width);
		val2.startWidth = startWidth;
		val2.numCapVertices = 3;
		val2.numCornerVertices = 2;
		((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)val2).receiveShadows = false;
		return val2;
	}

	public static void Arc(LineRenderer line, float start, float sweep, float radius)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < line.positionCount; i++)
		{
			float num = (start + sweep * (float)i / (float)(line.positionCount - 1)) * ((float)Math.PI / 180f);
			line.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, Mathf.Sin(num) * radius, 0f));
		}
	}
}
public class PlasmaRingVisual : MonoBehaviour
{
	private HealthComponent health;

	private GameObject root;

	private LineRenderer circle;

	private LineRenderer[] outlines;

	private Renderer[] fills;

	private static Mesh petal;

	private static Vector3[] contour;

	private readonly MaterialPropertyBlock block = new MaterialPropertyBlock();

	private CharacterBody observer;

	private int count;

	private float expires;

	private float changedAt;

	private float burstUntil;

	public void Set(CharacterBody owner, int stacks, float until)
	{
		if (Object.op_Implicit((Object)(object)owner) && ((NetworkBehaviour)owner).hasAuthority)
		{
			observer = owner;
			if (stacks != count)
			{
				changedAt = Time.time;
			}
			count = Mathf.Clamp(stacks, 0, 4);
			expires = until;
		}
	}

	public void Burst(CharacterBody owner)
	{
		if (Object.op_Implicit((Object)(object)owner) && ((NetworkBehaviour)owner).hasAuthority)
		{
			observer = owner;
			burstUntil = Time.time + 0.32f;
		}
	}

	private void Awake()
	{
		health = ((Component)this).GetComponent<HealthComponent>();
	}

	private static Vector3 Bezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float t)
	{
		//IL_000f: 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_0021: 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_0027: 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_003a: 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_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_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_005a: Unknown result type (might be due to invalid IL or missing references)
		float num = 1f - t;
		return num * num * num * a + 3f * num * num * t * b + 3f * num * t * t * c + t * t * t * d;
	}

	private void CreateVisuals()
	{
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Expected O, but got Unknown
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Expected O, but got Unknown
		//IL_02a9: 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_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Expected O, but got Unknown
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)root))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)petal))
		{
			contour = (Vector3[])(object)new Vector3[33];
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, 0.27f, 0f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0f, 0.85f, 0f);
			for (int i = 0; i <= 16; i++)
			{
				ref Vector3 reference = ref contour[i];
				reference = Bezier(val, new Vector3(-0.34f, 0.22f, 0f), new Vector3(-0.12f, 0.66f, 0f), val2, (float)i / 16f);
			}
			for (int i = 1; i <= 16; i++)
			{
				ref Vector3 reference2 = ref contour[16 + i];
				reference2 = Bezier(val2, new Vector3(0.12f, 0.66f, 0f), new Vector3(0.34f, 0.22f, 0f), val, (float)i / 16f);
			}
			Vector3[] array = (Vector3[])(object)new Vector3[34];
			ref Vector3 reference3 = ref array[0];
			reference3 = new Vector3(0f, 0.48f, 0f);
			Array.Copy(contour, 0, array, 1, 33);
			int[] array2 = new int[96];
			for (int i = 0; i < 32; i++)
			{
				array2[i * 3] = 0;
				array2[i * 3 + 1] = i + 1;
				array2[i * 3 + 2] = i + 2;
			}
			petal = new Mesh();
			((Object)petal).name = "KaisaPlasmaPetal";
			petal.vertices = array;
			petal.triangles = array2;
			petal.colors = Enumerable.Repeat<Color>(Color.white, array.Length).ToArray();
			petal.RecalculateBounds();
		}
		root = new GameObject("KaisaFivePetalMark");
		circle = CombatRing.Line(root.transform, "PlasmaCircle", 65, 0.026f);
		CombatRing.Arc(circle, 0f, 360f, 1f);
		outlines = (LineRenderer[])(object)new LineRenderer[5];
		fills = (Renderer[])(object)new Renderer[5];
		for (int i = 0; i < 5; i++)
		{
			GameObject val3 = new GameObject("Petal" + (i + 1));
			val3.transform.SetParent(root.transform, false);
			val3.transform.localRotation = Quaternion.Euler(0f, 0f, (float)(-72 * i));
			val3.AddComponent<MeshFilter>().sharedMesh = petal;
			MeshRenderer val4 = val3.AddComponent<MeshRenderer>();
			((Renderer)val4).sharedMaterial = CombatRing.Material;
			((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val4).receiveShadows = false;
			fills[i] = (Renderer)(object)val4;
			outlines[i] = CombatRing.Line(val3.transform, "PetalOutline", contour.Length, 0.026f);
			outlines[i].SetPositions(contour);
		}
	}

	private void Paint(int stacks, float fade, float pulse, bool bursting)
	{
		//IL_000c: 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_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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: 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_0126: 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_012e: Unknown result type (might be due to invalid IL or missing references)
		root.transform.localScale = Vector3.one * pulse;
		LineRenderer obj = circle;
		Color startColor = (circle.endColor = new Color(0.62f, 0.14f, 0.91f, 0.8f * fade));
		obj.startColor = startColor;
		for (int i = 0; i < 5; i++)
		{
			bool flag = bursting || i < stacks;
			Color val2 = (flag ? new Color(0.74f, 0.2f, 1f, fade) : new Color(0.08f, 0.015f, 0.15f, 0.45f * fade));
			if (bursting)
			{
				val2 = Color.Lerp(val2, new Color(0.94f, 0.62f, 1f, fade), 0.45f);
			}
			KaisaFxGeometry.Tint(fills[i], block, val2);
			LineRenderer obj2 = outlines[i];
			startColor = (outlines[i].endColor = (flag ? new Color(0.3f, 0.025f, 0.5f, fade) : new Color(0.55f, 0.15f, 0.8f, 0.7f * fade)));
			obj2.startColor = startColor;
		}
	}

	private void LateUpdate()
	{
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: 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_00e1: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		Camera val = (Object.op_Implicit((Object)(object)observer) ? CombatRing.CameraFor(observer) : null);
		bool flag = Time.time < burstUntil;
		bool flag2 = Object.op_Implicit((Object)(object)health) && Object.op_Implicit((Object)(object)health.body) && Object.op_Implicit((Object)(object)val) && ((health.alive && count > 0 && Time.time < expires) || flag);
		if (flag2)
		{
			Vector3 val2 = health.body.corePosition - ((Component)val).transform.position;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			flag2 = Vector3.Dot(((Component)val).transform.forward, val2) > 0f;
			if (flag2)
			{
				Vector3 position = ((Component)val).transform.position;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				float num = Mathf.Max(0f, magnitude - health.body.radius - 0.05f);
				LayerIndex world = LayerIndex.world;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(position, normalized, ref val3, num, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					flag2 = (Object)(object)((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<HealthComponent>() == (Object)(object)health;
				}
			}
		}
		if (!flag2)
		{
			if (Object.op_Implicit((Object)(object)root))
			{
				root.SetActive(false);
			}
			return;
		}
		CreateVisuals();
		root.SetActive(true);
		float num2 = Mathf.Clamp(Vector3.Distance(((Component)val).transform.position, health.body.corePosition) * 0.013f, 0.38f, 1.2f);
		float num3 = health.body.corePosition.y + Mathf.Max(0.6f, health.body.radius);
		Collider val4 = (Object.op_Implicit((Object)(object)health.body.mainHurtBox) ? ((Component)health.body.mainHurtBox).GetComponent<Collider>() : null);
		if (Object.op_Implicit((Object)(object)val4))
		{
			float num4 = num3;
			Bounds bounds = val4.bounds;
			num3 = Mathf.Max(num4, ((Bounds)(ref bounds)).max.y);
		}
		root.transform.position = new Vector3(health.body.corePosition.x, num3 + num2 + 0.22f, health.body.corePosition.z);
		root.transform.rotation = ((Component)val).transform.rotation;
		float num5 = (flag ? (1f - (burstUntil - Time.time) / 0.32f) : 0f);
		float num6 = (flag ? (1f + num5 * 0.22f) : (1f + 0.1f * Mathf.Clamp01(1f - (Time.time - changedAt) / 0.15f)));
		Paint(count, flag ? (1f - num5) : Mathf.Clamp01(expires - Time.time), num2 * num6, flag);
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)root))
		{
			Object.Destroy((Object)(object)root);
		}
	}
}
public static class HudPixel
{
	private static Texture2D texture;

	public static Texture2D Texture
	{
		get
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)texture))
			{
				texture = new Texture2D(1, 1, (TextureFormat)4, false);
				texture.SetPixel(0, 0, Color.white);
				texture.Apply();
				((Texture)texture).wrapMode = (TextureWrapMode)1;
			}
			return texture;
		}
	}
}
public class KaisaAfterimages : MonoBehaviour
{
	private KaisaController owner;

	private TrailRenderer trail;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0031: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Expected O, but got Unknown
		//IL_00d4: 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_00e5: Expected O, but got Unknown
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		owner = ((Component)this).GetComponent<KaisaController>();
		GameObject val = new GameObject("KaisaEMotionTrail");
		val.transform.SetParent(((Component)this).transform, false);
		val.transform.localPosition = Vector3.up * 0.9f;
		trail = val.AddComponent<TrailRenderer>();
		trail.time = 0.38f;
		trail.minVertexDistance = 0.04f;
		trail.widthMultiplier = 0.18f;
		trail.numCornerVertices = 4;
		trail.numCapVertices = 4;
		((Renderer)trail).material = new Material(CombatRing.Material);
		((Renderer)trail).material.color = new Color(0.66f, 0.22f, 1f, 0.75f);
		Gradient val2 = new Gradient();
		val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
		{
			new GradientColorKey(new Color(0.82f, 0.48f, 1f), 0f),
			new GradientColorKey(new Color(0.42f, 0.08f, 0.9f), 1f)
		}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
		{
			new GradientAlphaKey(0.8f, 0f),
			new GradientAlphaKey(0f, 1f)
		});
		trail.colorGradient = val2;
		((Renderer)trail).enabled = false;
	}

	private void LateUpdate()
	{
		if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.Body) && Object.op_Implicit((Object)(object)owner.Body.healthComponent) && owner.Body.healthComponent.alive)
		{
			bool enabled = owner.Body.HasBuff(KaisaPlugin.Speed) || owner.RFlying;
			if (Object.op_Implicit((Object)(object)trail))
			{
				((Renderer)trail).enabled = enabled;
			}
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)trail))
		{
			if (Object.op_Implicit((Object)(object)((Renderer)trail).material))
			{
				Object.Destroy((Object)(object)((Renderer)trail).material);
			}
			Object.Destroy((Object)(object)((Component)trail).gameObject);
		}
	}
}
public class KaisaAnimation : MonoBehaviour
{
	private Animation anim;

	private CharacterBody body;

	private float fullUntil;

	private string locomotion;

	private string fullClip;

	private int loggedAttacks;

	private string sampledClip;

	private float sampleStarted;

	private float sampleDuration;

	private bool sampleLoop;

	private float locomotionTime;

	private Transform[] poseBones;

	private Vector3[] previousPositions;

	private Vector3[] previousScales;

	private Quaternion[] previousRotations;

	private Vector3[] gaitPositions;

	private Vector3[] gaitScales;

	private Quaternion[] gaitRotations;

	private bool[] lowerBody;

	private bool upperAction;

	private bool gaitOverlay;

	private bool blendPending;

	private float blendAge;

	private float blendDuration = 0.12f;

	private int attackIndex;

	private bool wasSpeed;

	private bool wasAlive = true;

	public bool RPreparing;

	public void Bind(CharacterBody owner)
	{
		if (Object.op_Implicit((Object)(object)owner))
		{
			body = owner;
		}
	}

	private void Awake()
	{
		anim = ((Component)this).GetComponentInChildren<Animation>();
		body = ((Component)this).GetComponentInParent<CharacterBody>();
		if (Object.op_Implicit((Object)(object)anim))
		{
			((Behaviour)anim).enabled = false;
			anim.cullingType = (AnimationCullingType)0;
			poseBones = ((Component)anim).GetComponentsInChildren<Transform>(true);
			previousPositions = (Vector3[])(object)new Vector3[poseBones.Length];
			previousScales = (Vector3[])(object)new Vector3[poseBones.Length];
			previousRotations = (Quaternion[])(object)new Quaternion[poseBones.Length];
			gaitPositions = (Vector3[])(object)new Vector3[poseBones.Length];
			gaitScales = (Vector3[])(object)new Vector3[poseBones.Length];
			gaitRotations = (Quaternion[])(object)new Quaternion[poseBones.Length];
			lowerBody = poseBones.Select(IsLowerBody).ToArray();
		}
	}

	private void Start()
	{
		if (!Object.op_Implicit((Object)(object)body))
		{
			body = ((Component)this).GetComponentInParent<CharacterBody>();
		}
		if (Object.op_Implicit((Object)(object)anim) && Object.op_Implicit((Object)(object)body))
		{
			KaisaPlugin.Instance.LoggerForBody("KAISA_ANIMATION_CHECK clips=" + anim.GetClipCount() + " mode=FullBodyLateSample");
			Play("Spawn", 0.75f);
		}
	}

	private string Available(params string[] names)
	{
		return names.FirstOrDefault((string n) => Object.op_Implicit((Object)(object)anim) && (TrackedReference)(object)anim[n] != (TrackedReference)null);
	}

	private void Action(string name, float duration, bool upper, string follow = null)
	{
		if (Object.op_Implicit((Object)(object)anim) && !string.IsNullOrEmpty(name) && !((TrackedReference)(object)anim[name] == (TrackedReference)null))
		{
			duration = Mathf.Max(0.04f, duration);
			BeginBlend(Mathf.Min(0.12f, duration * 0.35f));
			sampledClip = name;
			sampleStarted = Time.time;
			sampleDuration = duration;
			sampleLoop = false;
			upperAction = upper;
			fullUntil = Time.time + duration;
			fullClip = name;
		}
	}

	private bool IsLowerBody(Transform bone)
	{
		if (((Object)bone).name == "Root" || ((Object)bone).name == "Hip" || ((Object)bone).name == "Pelvis")
		{
			return true;
		}
		Transform val = bone;
		while (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)((Component)anim).transform)
		{
			if (((Object)val).name == "Pelvis" || ((Object)val).name == "L_Hip" || ((Object)val).name == "R_Hip")
			{
				return true;
			}
			val = val.parent;
		}
		return false;
	}

	private void BeginBlend(float duration)
	{
		blendPending = true;
		blendDuration = Mathf.Max(0.02f, duration);
	}

	private void LateUpdate()
	{
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Expected O, but got Unknown
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: 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_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)anim) || string.IsNullOrEmpty(sampledClip) || (TrackedReference)(object)anim[sampledClip] == (TrackedReference)null)
		{
			return;
		}
		bool flag = !sampleLoop && upperAction && locomotion != null && locomotion.Contains("Run") && Object.op_Implicit((Object)(object)body.characterMotor) && ((Vector3)(ref body.characterMotor.velocity)).sqrMagnitude > 1f;
		if (flag != gaitOverlay && !sampleLoop && !blendPending)
		{
			BeginBlend(0.12f);
		}
		gaitOverlay = flag;
		if (blendPending)
		{
			for (int i = 0; i < poseBones.Length; i++)
			{
				ref Vector3 reference = ref previousPositions[i];
				reference = poseBones[i].localPosition;
				ref Quaternion reference2 = ref previousRotations[i];
				reference2 = poseBones[i].localRotation;
				ref Vector3 reference3 = ref previousScales[i];
				reference3 = poseBones[i].localScale;
			}
			blendAge = 0f;
			blendPending = false;
		}
		foreach (AnimationState item in anim)
		{
			AnimationState val = item;
			val.enabled = false;
			val.weight = 0f;
		}
		if (flag)
		{
			AnimationState val2 = anim[locomotion];
			val2.enabled = true;
			val2.weight = 1f;
			val2.layer = 0;
			val2.wrapMode = (WrapMode)2;
			val2.time = locomotionTime;
			anim.Sample();
			for (int i = 0; i < poseBones.Length; i++)
			{
				if (lowerBody[i])
				{
					ref Vector3 reference4 = ref gaitPositions[i];
					reference4 = poseBones[i].localPosition;
					ref Quaternion reference5 = ref gaitRotations[i];
					reference5 = poseBones[i].localRotation;
					ref Vector3 reference6 = ref gaitScales[i];
					reference6 = poseBones[i].localScale;
				}
			}
			val2.enabled = false;
			val2.weight = 0f;
		}
		AnimationState val3 = anim[sampledClip];
		val3.enabled = true;
		val3.weight = 1f;
		val3.layer = 0;
		val3.wrapMode = (WrapMode)(sampleLoop ? 2 : 8);
		float num = Mathf.Max(0f, Time.time - sampleStarted);
		val3.time = (sampleLoop ? locomotionTime : (Mathf.Clamp01(num / sampleDuration) * val3.length));
		anim.Sample();
		if (flag)
		{
			for (int i = 0; i < poseBones.Length; i++)
			{
				if (lowerBody[i])
				{
					poseBones[i].localPosition = gaitPositions[i];
					poseBones[i].localRotation = gaitRotations[i];
					poseBones[i].localScale = gaitScales[i];
				}
			}
		}
		if (blendAge < blendDuration)
		{
			blendAge += Time.deltaTime;
			float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(blendAge / blendDuration));
			for (int i = 0; i < poseBones.Length; i++)
			{
				Transform val4 = poseBones[i];
				val4.localPosition = Vector3.Lerp(previousPositions[i], val4.localPosition, num2);
				val4.localRotation = Quaternion.Slerp(previousRotations[i], val4.localRotation, num2);
				val4.localScale = Vector3.Lerp(previousScales[i], val4.localScale, num2);
			}
		}
	}

	public void Attack(Vector3 direction, bool finisher)
	{
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)body))
		{
			body = ((Component)this).GetComponentInParent<CharacterBody>();
		}
		if (!Object.op_Implicit((Object)(object)body) || RPreparing)
		{
			return;
		}
		bool flag = fullClip == "Kaisa_Run_To_E.anm" || fullClip == "E_Run_to_Run01" || fullClip == "Kaisa_Idle_E_to_Idle01.anm";
		if (!(Time.time < fullUntil) || fullClip == null || flag || fullClip.StartsWith("Attack") || fullClip.Contains("Finisher"))
		{
			bool flag2 = body.HasBuff(KaisaPlugin.Haste) || body.HasBuff(KaisaPlugin.Evolved);
			attackIndex++;
			string text;
			if (finisher)
			{
				text = Available(flag2 ? "Kaisa_E_PassiveFinisher01.anm" : "Kaisa_PassiveFinisher01.anm", "Attack3_0");
			}
			else if (flag2)
			{
				text = Available("Attack_E" + (1 + (attackIndex - 1) % 4), "Attack" + (1 + (attackIndex - 1) % 3) + "_0");
			}
			else
			{
				Vector3 val = (Object.op_Implicit((Object)(object)body.characterDirection) ? body.characterDirection.forward : ((Component)body).transform.forward);
				float num = Vector3.SignedAngle(val, Vector3.ProjectOnPlane(direction, Vector3.up), Vector3.up);
				int num2 = Mathf.RoundToInt(num / 90f) * 90;
				text = Available("Attack" + (1 + (attackIndex - 1) % 3) + "_" + num2, "Attack" + (1 + (attackIndex - 1) % 3) + "_0");
			}
			Action(text, 0.6f / Mathf.Max(0.1f, body.attackSpeed), upper: true);
			if (loggedAttacks++ < 3)
			{
				KaisaPlugin.Instance.LoggerForBody("KAISA_ATTACK clip=" + text + " fullBody=" + (sampledClip == text));
			}
		}
	}

	public void Play(string name, float duration)
	{
		//IL_0095: 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_009b: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)anim))
		{
			if (name == "Kaisa_Spell1.anm")
			{
				Action(Available(name, "Spell1_Upper"), duration, upper: false);
			}
			else if (name == "Kaisa_Spell2.anm")
			{
				Vector3 val = (Object.op_Implicit((Object)(object)body.characterDirection) ? body.characterDirection.forward : ((Component)body).transform.forward);
				float num = Vector3.SignedAngle(val, Vector3.ProjectOnPlane(body.inputBank.aimDirection, Vector3.up), Vector3.up);
				Action(Available("Spell2_" + Mathf.Clamp(Mathf.RoundToInt(num / 90f), -1, 1) * 90, name), duration, upper: true);
			}
			else
			{
				Action(Available(name), duration, upper: false);
			}
		}
	}

	public void BeginR()
	{
		RPreparing = true;
		Play("Spell4_Ready_In", 0.25f);
	}

	public void EndR(bool success)
	{
		RPreparing = false;
		Play(success ? "Spell4_Out" : "Spell1_To_Idle", success ? 0.45f : 0.15f);
	}

	private void Update()
	{
		if (!Object.op_Implicit((Object)(object)anim) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent))
		{
			return;
		}
		if (!body.healthComponent.alive)
		{
			if (wasAlive)
			{
				RPreparing = false;
				Play("Death", 1.2f);
				wasAlive = false;
			}
			return;
		}
		bool flag = Object.op_Implicit((Object)(object)body.characterMotor) && ((Vector3)(ref body.characterMotor.velocity)).sqrMagnitude > 1f;
		bool flag2 = body.HasBuff(KaisaPlugin.Speed);
		if (wasSpeed && !flag2 && !RPreparing && Time.time >= fullUntil)
		{
			Play(flag ? "E_Run_to_Run01" : "Kaisa_Idle_E_to_Idle01.anm", 0.2f);
		}
		wasSpeed = flag2;
		string text = (RPreparing ? Available("Spell4_Ready_Loop", "Idle1_Base") : (flag2 ? (flag ? Available("Kaisa_Run_E.anm", "Run_Base") : Available("Kaisa_Idle_E.anm", "Idle1_Base")) : ((!flag) ? Available("Idle1_Base") : (body.HasBuff(KaisaPlugin.Haste) ? Available("Run_Haste", "Run_Fast", "Run_Base") : (body.isSprinting ? Available("Run_Fast", "Run_Base") : Available("Run_Base"))))));
		if (text != null)
		{
			if (text != locomotion)
			{
				float num = ((locomotion != null && (TrackedReference)(object)anim[locomotion] != (TrackedReference)null && anim[locomotion].length > 0f) ? (Mathf.Repeat(locomotionTime, anim[locomotion].length) / anim[locomotion].length) : 0f);
				bool flag3 = locomotion != null && locomotion.Contains("Run") && text.Contains("Run");
				locomotionTime = (flag3 ? (num * anim[text].length) : 0f);
				locomotion = text;
				anim[text].wrapMode = (WrapMode)2;
			}
			float num2 = ((text.Contains("Run") && flag && !RPreparing) ? Mathf.Clamp(body.moveSpeed / 7f, 0.5f, 2.5f) : 1f);
			locomotionTime += Time.deltaTime * num2;
			if (!(Time.time < fullUntil) && (!sampleLoop || sampledClip != text))
			{
				BeginBlend(0.12f);
				sampledClip = text;
				sampleStarted = Time.time;
				sampleLoop = true;
			}
		}
	}
}
public static class KaisaAudio
{
	private sealed class Bank
	{
		public readonly string Name;

		public bool Requested;

		public bool Ready;

		public Bank(string name)
		{
			Name = name;
		}
	}

	private static readonly Bank voidBank = new Bank("char_VoidSurvivor");

	private static readonly Bank mercBank = new Bank("char_Merc");

	private static readonly Bank[] banks = new Bank[2] { voidBank, mercBank };

	private static readonly HashSet<string> loggedEvents = new HashSet<string>();

	private static readonly HashSet<string> loggedFailures = new HashSet<string>();

	private static KaisaAudioDriver driver;

	public static void Load(AssetBundle bundle)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)driver))
		{
			GameObject val = new GameObject("KaisaWwiseAudio");
			Object.DontDestroyOnLoad((Object)(object)val);
			driver = val.AddComponent<KaisaAudioDriver>();
		}
		Log("KAISA_AUDIO_CHECK backend=Wwise banks=char_VoidSurvivor,char_Merc");
		PrepareBanks();
	}

	public static void Attack(Vector3 p, GameObject emitter)
	{
		Play("Play_voidman_m1_shoot", voidBank, "Play_huntress_m1_shoot", emitter);
	}

	public static void Attack(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.Attack(owner, emitter);
		}
		else
		{
			Attack(p, emitter);
		}
	}

	public static void Hit(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.Hit(owner, emitter);
		}
	}

	public static void Q(Vector3 p, GameObject emitter)
	{
		Play("Play_voidman_m2_shoot", voidBank, "Play_mage_m2_shoot", emitter);
	}

	public static void Q(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.Q(emitter);
		}
		else
		{
			Q(p, emitter);
		}
	}

	public static void W(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.W(emitter);
		}
		else
		{
			Q(p, emitter);
		}
	}

	public static void QHit(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.QHit(emitter);
		}
	}

	public static void WHit(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.WHit(emitter);
		}
		else
		{
			Plasma(p, emitter);
		}
	}

	public static void E(Vector3 p, GameObject emitter)
	{
		Play("Play_merc_shift_start", mercBank, "Play_merc_shift_slice", emitter);
	}

	public static void E(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.E(emitter);
		}
		else
		{
			E(p, emitter);
		}
		KaisaVoiceController kaisaVoiceController = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).GetComponent<KaisaVoiceController>() : null);
		if (Object.op_Implicit((Object)(object)kaisaVoiceController))
		{
			kaisaVoiceController.Supercharge();
		}
	}

	public static void R(Vector3 p, GameObject emitter)
	{
		Play("Play_voidRaid_gauntlet_portPlayer", null, null, emitter);
	}

	public static void R(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.R(emitter);
		}
		else
		{
			R(p, emitter);
		}
	}

	public static void RShield(GameObject emitter, CharacterBody owner)
	{
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.RShield(emitter);
		}
	}

	public static void Plasma(Vector3 p, GameObject emitter)
	{
		Play("Play_voidman_m2_explode", voidBank, "Play_item_void_explodeOnDeath", emitter);
	}

	public static void Plasma(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.WHit(emitter);
		}
		else
		{
			Plasma(p, emitter);
		}
	}

	public static void Detonate(Vector3 p, GameObject emitter)
	{
		Play("Play_voidman_R_pop", voidBank, "Play_voidman_m2_explode", emitter);
	}

	public static void Detonate(Vector3 p, GameObject emitter, CharacterBody owner)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (KaisaBulletAudio.IsBullet(owner))
		{
			KaisaBulletAudio.Detonate(emitter);
		}
		else
		{
			Detonate(p, emitter);
		}
	}

	public static void Evolve(Vector3 p, GameObject emitter)
	{
		CharacterBody body = (Object.op_Implicit((Object)(object)emitter) ? emitter.GetComponent<CharacterBody>() : null);
		if (KaisaBulletAudio.IsBullet(body))
		{
			KaisaBulletAudio.Evolve(emitter);
			return;
		}
		KaisaVoiceController kaisaVoiceController = (Object.op_Implicit((Object)(object)emitter) ? emitter.GetComponent<KaisaVoiceController>() : null);
		if (!Object.op_Implicit((Object)(object)kaisaVoiceController) || !kaisaVoiceController.Evolve())
		{
			Play("Play_voidman_transform", voidBank, "Play_voidRaid_gauntlet_portPlayer", emitter);
		}
	}

	internal static void PrepareBanks()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		if (!AkSoundEngine.IsInitialized())
		{
			return;
		}
		KaisaVoice.Prepare();
		KaisaBulletAudio.Prepare();
		Bank[] array = banks;
		foreach (Bank bank in array)
		{
			if (!bank.Requested)
			{
				bank.Requested = true;
				Bank requestedBank = bank;
				AkBankManager.LoadBankAsync(bank.Name, (BankCallback)delegate(uint id, IntPtr memory, AKRESULT result, object cookie)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0009: Invalid comparison between Unknown and I4
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Invalid comparison between Unknown and I4
					//IL_0040: Unknown result type (might be due to invalid IL or missing references)
					requestedBank.Ready = (int)result == 1 || (int)result == 69;
					Log(string.Concat("KAISA_AUDIO_BANK name=", requestedBank.Name, " result=", result, " ready=", requestedBank.Ready));
				});
			}
		}
	}

	private static void Play(string eventName, Bank bank, string fallback, GameObject emitter)
	{
		if (!Object.op_Implicit((Object)(object)emitter) || !AkSoundEngine.IsInitialized())
		{
			return;
		}
		PrepareBanks();
		AkGameObj val = emitter.GetComponent<AkGameObj>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = emitter.AddComponent<AkGameObj>();
		}
		if (!((Behaviour)val).enabled)
		{
			((Behaviour)val).enabled = true;
		}
		string text = ((bank == null || bank.Ready) ? eventName : fallback);
		uint num = ((!string.IsNullOrEmpty(text)) ? Util.PlaySound(text, emitter) : 0u);
		if (num == 0 && !string.IsNullOrEmpty(fallback) && text != fallback)
		{
			text = fallback;
			num = Util.PlaySound(fallback, emitter);
		}
		if (num != 0)
		{
			if (loggedEvents.Add(eventName))
			{
				Log("KAISA_AUDIO_PLAY event=" + text + " playingId=" + num + " emitter=" + ((Object)emitter).name);
			}
		}
		else if (loggedFailures.Add(eventName))
		{
			Log("KAISA_AUDIO_FAILED event=" + eventName + " fallback=" + fallback + " playingId=0");
		}
	}

	internal static void Shutdown()
	{
		KaisaVoice.Shutdown();
		KaisaBulletAudio.Shutdown();
		Bank[] array = banks;
		foreach (Bank bank in array)
		{
			if (bank.Requested && AkSoundEngine.IsInitialized())
			{
				AkBankManager.UnloadBank(bank.Name);
			}
			bank.Ready = (bank.Requested = false);
		}
		driver = null;
	}

	private static void Log(string message)
	{
		if (Object.op_Implicit((Object)(object)KaisaPlugin.Instance))
		{
			KaisaPlugin.Instance.LoggerForBody(message);
		}
	}
}
public sealed class KaisaAudioDriver : MonoBehaviour
{
	private void Update()
	{
		KaisaAudio.PrepareBanks();
	}

	private void OnDestroy()
	{
		KaisaAudio.Shutdown();
	}
}
public static class KaisaBulletAudio
{
	private static bool requested;

	private static bool ready;

	private static uint bankId;

	private static int attack;

	private static readonly HashSet<string> logged = new HashSet<string>();

	public static void Prepare()
	{
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Invalid comparison between Unknown and I4
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Invalid comparison between Unknown and I4
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		if (requested || !AkSoundEngine.IsInitialized())
		{
			return;
		}
		requested = true;
		IntPtr intPtr = IntPtr.Zero;
		try
		{
			string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)KaisaPlugin.Instance).Info.Location), "KaisaBulletAngel.bnk");
			byte[] array = File.ReadAllBytes(path);
			intPtr = Marshal.AllocHGlobal(array.Length);
			Marshal.Copy(array, 0, intPtr, array.Length);
			AKRESULT val = AkSoundEngine.LoadBankMemoryCopy(intPtr, (uint)array.Length, ref bankId);
			ready = (int)val == 1 || (int)val == 69;
			KaisaPlugin.Instance.LoggerForBody(string.Concat("KAISA_BULLET_BANK result=", val, " ready=", ready, " bytes=", array.Length));
		}
		catch (Exception ex)
		{
			KaisaPlugin.Instance.LoggerForBody("KAISA_BULLET_BANK_FAILED " + ex.Message);
		}
		finally
		{
			if (intPtr != IntPtr.Zero)
			{
				Marshal.FreeHGlobal(intPtr);
			}
		}
	}

	public static bool IsBullet(CharacterBody body)
	{
		return Object.op_Implicit((Object)(object)body) && body.skinIndex == 1;
	}

	private static uint Post(string eventName, GameObject emitter)
	{
		Prepare();
		if (!ready || !Object.op_Implicit((Object)(object)emitter))
		{
			return 0u;
		}
		AkGameObj val = emitter.GetComponent<AkGameObj>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = emitter.AddComponent<AkGameObj>();
		}
		if (!((Behaviour)val).enabled)
		{
			((Behaviour)val).enabled = true;
		}
		uint num = AkSoundEngine.PostEvent(eventName, emitter);
		if (logged.Add(eventName))
		{
			KaisaPlugin.Instance.LoggerForBody("KAISA_BULLET_AUDIO event=" + eventName + " playingId=" + num);
		}
		if (num == 0)
		{
			KaisaPlugin.Instance.LoggerForBody("KAISA_BULLET_AUDIO_FAILED event=" + eventName);
		}
		return num;
	}

	private static string Variant(string stem, int count, ref int sequence)
	{
		int num = sequence++ % count;
		return "Play_KaisaBullet_" + stem + ((count > 1) ? ("_" + (num + 1).ToString("00")) : "");
	}

	public static uint Attack(CharacterBody owner, GameObject emitter)
	{
		return Post(Variant((Object.op_Implicit((Object)(object)owner) && owner.HasBuff(KaisaPlugin.Haste)) ? "AttackBoost" : "Attack", 4, ref attack), emitter);
	}

	public static uint Hit(CharacterBody owner, GameObject emitter)
	{
		return Post("Play_KaisaBullet_Hit_" + (attack % 4 + 1).ToString("00"), emitter);
	}

	public static uint Q(GameObject emitter)
	{
		return Post("Play_KaisaBullet_Q", emitter);
	}

	public static uint QHit(GameObject emitter)
	{
		return Post("Play_KaisaBullet_QHit", emitter);
	}

	public static uint W(GameObject emitter)
	{
		return Post("Play_KaisaBullet_W", emitter);
	}

	public static uint WHit(GameObject emitter)
	{
		return Post("Play_KaisaBullet_WHit", emitter);
	}

	public static uint E(GameObject emitter)
	{
		return Post("Play_KaisaBullet_E", emitter);
	}

	public static uint R(GameObject emitter)
	{
		return Post("Play_KaisaBullet_R", emitter);
	}

	public static uint RShield(GameObject emitter)
	{
		return Post("Play_KaisaBullet_RShield", emitter);
	}

	public static uint Detonate(GameObject emitter)
	{
		return Post("Play_KaisaBullet_Detonate", emitter);
	}

	public static uint Evolve(GameObject emitter)
	{
		return Post("Play_KaisaBullet_Evolve", emitter);
	}

	public static bool PlayTestEvent(string eventName, GameObject emitter)
	{
		return Post(eventName, emitter) != 0;
	}

	public static void Shutdown()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (ready && AkSoundEngine.IsInitialized())
		{
			AkSoundEngine.UnloadBank(bankId, IntPtr.Zero);
		}
		ready = (requested = false);
		bankId = 0u;
		attack = 0;
	}
}
public static class KaisaDamageColors
{
	public const DamageColorIndex Index = (DamageColorIndex)250;

	public static readonly Color Violet = new Color(0.62f, 0.14f, 0.94f);

	private static Hook hook;

	public static void Install()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		if (hook == null)
		{
			hook = new Hook((MethodBase)typeof(DamageColor).GetMethod("FindColor", BindingFlags.Static | BindingFlags.Public), typeof(KaisaDamageColors).GetMethod("FindColor", BindingFlags.Static | BindingFlags.NonPublic));
		}
	}

	private static Color FindColor(Func<DamageColorIndex, Color> original, DamageColorIndex index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_0012: 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_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		return ((int)index == 250) ? Violet : original(index);
	}

	public static void Shutdown()
	{
		if (hook != null)
		{
			hook.Dispose();
			hook = null;
		}
	}
}
public static class KaisaDashGeometry
{
	private static bool Valid(Vector3 value)
	{
		float sqrMagnitude = ((Vector3)(ref value)).sqrMagnitude;
		return !float.IsNaN(sqrMagnitude) && !float.IsInfinity(sqrMagnitude) && sqrMagnitude > 0.01f;
	}

	public static Vector3 Direction(Vector3 move, Vector3 aim, Vector3 fallback, bool grounded, Vector3 groundNormal)
	{
		//IL_0001: 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_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: 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_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_004e: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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_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)
		//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_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		bool flag = Valid(move);
		Vector3 val = (flag ? ((Vector3)(ref move)).normalized : (Valid(aim) ? ((Vector3)(ref aim)).normalized : Vector3.zero));
		if (!Valid(val))
		{
			val = (Valid(fallback) ? ((Vector3)(ref fallback)).normalized : Vector3.forward);
		}
		if (grounded)
		{
			if (!Valid(groundNormal))
			{
				groundNormal = Vector3.up;
			}
			((Vector3)(ref groundNormal)).Normalize();
			if (flag || Vector3.Dot(val, groundNormal) < 0f)
			{
				Vector3 val2 = Vector3.ProjectOnPlane(val, groundNormal);
				val = ((Vector3)(ref val2)).normalized;
				if (!Valid(val))
				{
					val2 = Vector3.ProjectOnPlane(fallback, groundNormal);
					val = ((Vector3)(ref val2)).normalized;
				}
				if (!Valid(val))
				{
					val2 = Vector3.ProjectOnPlane(Vector3.forward, groundNormal);
					val = ((Vector3)(ref val2)).normalized;
				}
				if (!Valid(val))
				{
					val2 = Vector3.ProjectOnPlane(Vector3.right, groundNormal);
					val = ((Vector3)(ref val2)).normalized;
				}
			}
		}
		return val;
	}
}
public static class KaisaFxGeometry
{
	private static Mesh crystal;

	public static GameObject Core(Transform parent, string name)
	{
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0078: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f2: 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_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)crystal))
		{
			crystal = new Mesh();
			((Object)crystal).name = "KaisaPlasmaCrystal";
			crystal.vertices = (Vector3[])(object)new Vector3[6]
			{
				Vector3.up,
				Vector3.down,
				Vector3.left,
				Vector3.right,
				Vector3.forward,
				Vector3.back
			};
			crystal.triangles = new int[24]
			{
				0, 4, 3, 0, 3, 5, 0, 5, 2, 0,
				2, 4, 1, 3, 4, 1, 5, 3, 1, 2,
				5, 1, 4, 2
			};
			crystal.colors = (Color[])(object)new Color[6]
			{
				Color.white,
				Color.white,
				Color.white,
				Color.white,
				Color.white,
				Color.white
			};
			crystal.RecalculateBounds();
		}
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent, false);
		val.AddComponent<MeshFilter>().sharedMesh = crystal;
		MeshRenderer val2 = val.AddComponent<MeshRenderer>();
		((Renderer)val2).sharedMaterial = CombatRing.Material;
		((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)val2).receiveShadows = false;
		return val;
	}

	public static void Tint(Renderer renderer, MaterialPropertyBlock block, Color color)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		block.SetColor("_Color", color);
		renderer.SetPropertyBlock(block);
	}
}
public class KaisaDetonation : MonoBehaviour
{
	private const int Limit = 24;

	private static int active;

	private bool counted;

	public static void Spawn(Vector3 position, float radius, CharacterBody owner = null)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (active < 24)
		{
			GameObject val = new GameObject("KaisaFifthMarkSound");
			val.transform.position = position;
			KaisaDetonation kaisaDetonation = val.AddComponent<KaisaDetonation>();
			active++;
			kaisaDetonation.counted = true;
			KaisaAudio.Detonate(position, val, owner);
			Object.Destroy((Object)(object)val, 2f);
		}
	}

	private void OnDestroy()
	{
		if (counted)
		{
			active--;
		}
	}
}
public class KaisaAbsorption : MonoBehaviour
{
	private static int active;

	private CharacterBody target;

	private Vector3 from;

	private Vector3 bend;

	private float age;

	private float duration;

	private bool counted;

	private Renderer core;

	private MaterialPropertyBlock block = new MaterialPropertyBlock();

	public static void Spawn(Vector3 origin, CharacterBody body)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_0030: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)body) && active < 40)
		{
			GameObject val = new GameObject("KaisaHungerAbsorption");
			val.transform.position = origin;
			KaisaAbsorption kaisaAbsorption = val.AddComponent<KaisaAbsorption>();
			kaisaAbsorption.target = body;
			kaisaAbsorption.from = origin;
			kaisaAbsorption.duration = Mathf.Clamp(Vector3.Distance(origin, body.corePosition) / 45f, 0.4f, 0.85f);
			kaisaAbsorption.bend = Vector3.up * Mathf.Clamp(Vector3.Distance(origin, body.corePosition) * 0.1f, 0.4f, 2.5f);
			kaisaAbsorption.core = KaisaFxGeometry.Core(val.transform, "HungerMote").GetComponent<Renderer>();
			PlasmaTrail.Attach(val.transform, 0.085f, 0.2f);
			active++;
			kaisaAbsorption.counted = true;
		}
	}

	private void Update()
	{
		//IL_0076: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)target.healthComponent) || !target.healthComponent.alive)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		age += Time.deltaTime;
		float num = Mathf.Clamp01(age / duration);
		((Component)this).transform.position = Vector3.Lerp(from, target.corePosition, num * num) + bend * (4f * num * (1f - num));
		float num2 = Mathf.Clamp01((1f - num) * 5f);
		((Component)core).transform.localScale = new Vector3(0.11f, 0.2f, 0.11f) * num2;
		((Component)core).transform.Rotate(0f, 240f * Time.deltaTime, 90f * Time.deltaTime);
		KaisaFxGeometry.Tint(core, block, new Color(0.8f, 0.26f, 1f, num2));
		if (num >= 1f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void OnDestroy()
	{
		if (counted)
		{
			active--;
		}
	}
}
[DefaultExecutionOrder(200)]
public class KaisaHungerGlow : MonoBehaviour
{
	private class Layer
	{
		public SkinnedMeshRenderer Source;

		public SkinnedMeshRenderer Glow;
	}

	private static readonly Dictionary<string, Mesh> masks = new Dictionary<string, Mesh>();

	private readonly List<Layer> layers = new List<Layer>();

	private readonly MaterialPropertyBlock block = new MaterialPropertyBlock();

	private CharacterBody body;

	private KaisaHunger hunger;

	private CharacterModel model;

	private float nextUpdate;

	public float CurrentStrength { get; private set; }

	public static float Strength(int stacks)
	{
		return 1.5f * (1f - Mathf.Exp((float)(-(Math.Max(0, stacks) / 100)) * 0.6f));
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
		hunger = ((Component)this).GetComponent<KaisaHunger>();
	}

	private static Mesh Mask(SkinnedMeshRenderer source, Material material)
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		Texture mainTexture = material.mainTexture;
		string key = ((Object)source.sharedMesh).GetInstanceID() + ":" + ((Object)mainTexture).GetInstanceID();
		if (masks.TryGetValue(key, out var value))
		{
			return value;
		}
		RenderTexture temporary = RenderTexture.GetTemporary(128, 128, 0, (RenderTextureFormat)0);
		RenderTexture active = RenderTexture.active;
		Texture2D val = new Texture2D(128, 128, (TextureFormat)3, false);
		try
		{
			Graphics.Blit(mainTexture, temporary);
			RenderTexture.active = temporary;
			val.ReadPixels(new Rect(0f, 0f, 128f, 128f), 0, 0);
			val.Apply();
			value = Object.Instantiate<Mesh>(source.sharedMesh);
			((Object)value).name = ((Object)source.sharedMesh).name + "_HungerLightMask";
			Vector2[] uv = value.uv;
			Color[] array = (Color[])(object)new Color[value.vertexCount];
			Vector2 mainTextureScale = material.mainTextureScale;
			Vector2 mainTextureOffset = material.mainTextureOffset;
			for (int i = 0; i < array.Length; i++)
			{
				Vector2 val2 = ((i < uv.Length) ? (Vector2.Scale(uv[i], mainTextureScale) + mainTextureOffset) : Vector2.zero);
				Color pixelBilinear = val.GetPixelBilinear(val2.x, val2.y);
				float num = Mathf.Clamp01((pixelBilinear.b - pixelBilinear.g * 1.08f) * 5f) * Mathf.Clamp01(pixelBilinear.b * 3f);
				ref Color reference = ref array[i];
				reference = new Color(0.66f, 0.08f, 1f, num * 0.55f);
			}
			value.colors = array;
			masks.Add(key, value);
		}
		finally
		{
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			Object.Destroy((Object)(object)val);
		}
		return value;
	}

	private void LateUpdate()
	{
		//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_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Expected O, but got Unknown
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Invalid comparison between Unknown and I4
		if (!Object.op_Implicit((Object)(object)body) || Time.time < nextUpdate)
		{
			return;
		}
		nextUpdate = Time.time + 0.1f;
		if (!Object.op_Implicit((Object)(object)hunger))
		{
			hunger = ((Component)this).GetComponent<KaisaHunger>();
		}
		if (!Object.op_Implicit((Object)(object)model))
		{
			ModelLocator component = ((Component)this).GetComponent<ModelLocator>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.modelTransform))
			{
				return;
			}
			model = ((Component)component.modelTransform).GetComponent<CharacterModel>();
			if (!Object.op_Implicit((Object)(object)model))
			{
				return;
			}
			RendererInfo[] baseRendererInfos = model.baseRendererInfos;
			for (int i = 0; i < baseRendererInfos.Length; i++)
			{
				RendererInfo val = baseRendererInfos[i];
				Renderer renderer = val.renderer;
				SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null);
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.sharedMesh) && Object.op_Implicit((Object)(object)val.defaultMaterial) && Object.op_Implicit((Object)(object)val.defaultMaterial.mainTexture))
				{
					GameObject val3 = new GameObject("KaisaHungerLight");
					val3.transform.SetParent(((Component)val2).transform, false);
					SkinnedMeshRenderer val4 = val3.AddComponent<SkinnedMeshRenderer>();
					val4.sharedMesh = Mask(val2, val.defaultMaterial);
					val4.bones = val2.bones;
					val4.rootBone = val2.rootBone;
					((Renderer)val4).sharedMaterial = CombatRing.Material;
					((Renderer)val4).localBounds = ((Renderer)val2).localBounds;
					val4.quality = val2.quality;
					val4.updateWhenOffscreen = true;
					((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)val4).receiveShadows = false;
					layers.Add(new Layer
					{
						Source = val2,
						Glow = val4
					});
				}
			}
		}
		CurrentStrength = ((Object.op_Implicit((Object)(object)hunger) && hunger.Selected && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) ? Strength(body.GetBuffCount(KaisaHunger.KillStacks)) : 0f);
		foreach (Layer layer in layers)
		{
			if (Object.op_Implicit((Object)(object)layer.Glow) && Object.op_Implicit((Object)(object)layer.Source))
			{
				((Renderer)layer.Glow).enabled = CurrentStrength > 0f && ((Renderer)layer.Source).enabled && ((Component)layer.Source).gameObject.activeInHierarchy && (int)model.visibility == 5;
				KaisaFxGeometry.Tint((Renderer)(object)layer.Glow, block, new Color(1f, 1f, 1f, CurrentStrength / 1.5f));
			}
		}
	}

	private void OnDestroy()
	{
		foreach (Layer layer in layers)
		{
			if (Object.op_Implicit((Object)(object)layer.Glow))
			{
				Object.Destroy((Object)(object)((Component)layer.Glow).gameObject);
			}
		}
	}
}
public class KaisaEvolutionScreen : MonoBehaviour
{
	private CharacterBody body;

	private KaisaController controller;

	private float intensity;

	private static Texture2D texture;

	public float Intensity => intensity;

	public static float EdgeAlpha(float x, float y)
	{
		float num = Mathf.Max(Mathf.Abs(x * 2f - 1f), Mathf.Abs(y * 2f - 1f));
		return 0.42f * Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num - 0.55f) / 0.45f));
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
		controller = ((Component)this).GetComponent<KaisaController>();
	}

	private void Update()
	{
		bool flag = Object.op_Implicit((Object)(object)controller) && controller.IsEvolved && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive;
		intensity = Mathf.MoveTowards(intensity, (float)(flag ? 1 : 0), Time.unscaledDeltaTime * 2.5f);
	}

	private void OnGUI()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Invalid comparison between Unknown and I4
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Expected O, but got Unknown
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		if ((int)Event.current.type != 7 || intensity <= 0f || !Object.op_Implicit((Object)(object)body) || !KaisaVoice.IsLocal(body) || !Object.op_Implicit((Object)(object)Run.instance))
		{
			return;
		}
		bool flag = false;
		foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList)
		{
			if (Object.op_Implicit((Object)(object)readOnlyInstance) && (Object)(object)readOnlyInstance.targetBodyObject == (Object)(object)((Component)this).gameObject && Object.op_Implicit((Object)(object)readOnlyInstance.mainUIPanel) && readOnlyInstance.mainUIPanel.activeInHierarchy)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)texture))
		{
			texture = new Texture2D(128, 128, (TextureFormat)4, false);
			((Object)texture).name = "KaisaEvolutionVignette";
			((Texture)texture).wrapMode = (TextureWrapMode)1;
			((Texture)texture).filterMode = (FilterMode)1;
			Color[] array = (Color[])(object)new Color[16384];
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					ref Color reference = ref array[i * 128 + j];
					reference = new Color(0.16f, 0.015f, 0.26f, EdgeAlpha((float)j / 127f, (float)i / 127f));
				}
			}
			texture.SetPixels(array);
			texture.Apply(false, true);
		}
		Color color = GUI.color;
		int depth = GUI.depth;
		GUI.depth = 1000;
		GUI.color = new Color(1f, 1f, 1f, intensity);
		GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)texture);
		GUI.color = color;
		GUI.depth = depth;
	}
}
public class KaisaPassiveDef : SkillDef
{
	public override bool CanExecute(GenericSkill skillSlot)
	{
		return false;
	}

	public override bool IsReady(GenericSkill skillSlot)
	{
		return false;
	}
}
public class KaisaHunger : MonoBehaviour
{
	public static SkillDef Normal;

	public static SkillDef Hungry;

	public static BuffDef KillStacks;

	public GenericSkill PassiveSlot;

	private CharacterBody body;

	private float drainClock;

	private bool wasSelected;

	public bool Selected => Object.op_Implicit((Object)(object)PassiveSlot) && (Object)(object)PassiveSlot.skillDef == (Object)(object)Hungry;

	public static void Install(GameObject prefab)
	{
		//IL_004e: 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_0073: Expected O, but got Unknown
		//IL_0074: 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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		Normal = Passive("KAISA_PASSIVE", "Passive");
		Hungry = Passive("KAISA_HUNGER", "Hunger");
		SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
		((Object)val).name = "KaisaPassiveFamily";
		Variant[] array = (Variant[])(object)new Variant[2];
		ref Variant reference = ref array[0];
		Variant val2 = new Variant
		{
			skillDef = Normal
		};
		((Variant)(ref val2)).viewableNode = new Node("KAISA_PASSIVE", false, (Node)null);
		reference = val2;
		ref Variant reference2 = ref array[1];
		Variant val3 = new Variant
		{
			skillDef = Hungry
		};
		((Variant)(ref val3)).viewableNode = new Node("KAISA_HUNGER", false, (Node)null);
		reference2 = val3;
		val.variants = array;
		ContentAddition.AddSkillFamily(val);
		bool activeSelf = prefab.activeSelf;
		prefab.SetActive(false);
		GenericSkill val4 = prefab.AddComponent<GenericSkill>();
		val4.skillName = "KaisaPassive";
		val4.loadoutTitleToken = "KAISA_PASSIVE_SLOT";
		val4.hideInCharacterSelect = false;
		val4.hideInLoadoutSelect = false;
		typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(val4, val);
		prefab.AddComponent<KaisaHunger>().PassiveSlot = val4;
		typeof(SkillLocator).GetField("allSkills", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(prefab.GetComponent<SkillLocator>(), prefab.GetComponents<GenericSkill>());
		prefab.SetActive(activeSelf);
		KillStacks = ScriptableObject.CreateInstance<BuffDef>();
		((Object)KillStacks).name = "KaisaHungerKills";
		KillStacks.canStack = true;
		KillStacks.isDebuff = false;
		KillStacks.buffColor = Color.white;
		KillStacks.iconSprite = KaisaPlugin.Icon("Hunger");
		ContentAddition.AddBuffDef(KillStacks);
	}

	private static SkillDef Passive(string token, string icon)
	{
		//IL_0045: 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)
		KaisaPassiveDef kaisaPassiveDef = ScriptableObject.CreateInstance<KaisaPassiveDef>();
		((Object)kaisaPassiveDef).name = token;
		((SkillDef)kaisaPassiveDef).skillName = token;
		((SkillDef)kaisaPassiveDef).skillNameToken = token;
		((SkillDef)kaisaPassiveDef).skillDescriptionToken = token + "_DESC";
		((SkillDef)kaisaPassiveDef).icon = KaisaPlugin.Icon(icon);
		((SkillDef)kaisaPassiveDef).activationState = new SerializableEntityStateType(typeof(Idle));
		((SkillDef)kaisaPassiveDef).activationStateMachineName = "Weapon";
		((SkillDef)kaisaPassiveDef).baseMaxStock = 1;
		((SkillDef)kaisaPassiveDef).requiredStock = 1;
		((SkillDef)kaisaPassiveDef).stockToConsume = 0;
		((SkillDef)kaisaPassiveDef).rechargeStock = 0;
		((SkillDef)kaisaPassiveDef).fullRestockOnAssign = true;
		((SkillDef)kaisaPassiveDef).cancelSprintingOnActivation = false;
		ContentAddition.AddSkillDef((SkillDef)(object)kaisaPassiveDef);
		return (SkillDef)(object)kaisaPassiveDef;
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
	}

	private void FixedUpdate()
	{
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: 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)Run.instance) || Run.instance.isGameOverServer)
		{
			return;
		}
		bool selected = Selected;
		if (selected != wasSelected)
		{
			drainClock = 0f;
			wasSelected = selected;
			body.RecalculateStats();
		}
		if (selected)
		{
			if (body.HasBuff(KaisaPlugin.Evolved))
			{
				body.ClearTimedBuffs(KaisaPlugin.Evolved.buffIndex);
				body.SetBuffCount(KaisaPlugin.Evolved.buffIndex, 0);
			}
			if (body.HasBuff(KaisaPlugin.Charge))
			{
				body.SetBuffCount(KaisaPlugin.Charge.buffIndex, 0);
			}
			if (Object.op_Implicit((Object)(object)body.master))
			{
				EvolutionStorage component = ((Component)body.master).GetComponent<EvolutionStorage>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.Progress = 0;
				}
			}
			KaisaController component2 = ((Component)body).GetComponent<KaisaController>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.EvolvingUntil = 0f;
			}
		}
		int num = 0;
		if (selected && Object.op_Implicit((Object)(object)body.master))
		{
			KaisaHungerStorage component3 = ((Component)body.master).GetComponent<KaisaHungerStorage>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				num = component3.CountFor(Run.instance);
			}
		}
		if (body.GetBuffCount(KillStacks) != num)
		{
			body.SetBuffCount(KillStacks.buffIndex, num);
		}
		if (!selected || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || Time.timeScale <= 0f)
		{
			drainClock = 0f;
			return;
		}
		drainClock += Time.fixedDeltaTime;
		while (drainClock >= 1f)
		{
			drainClock -= 1f;
			HealthComponent healthComponent = body.healthComponent;
			healthComponent.Networkhealth = KaisaHungerRules.AfterDrain(healthComponent.health, healthComponent.fullHealth, num);
		}
	}

	public void OnKill(DamageReport report)
	{
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: 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_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || Run.instance.isGameOverServer || !Selected || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || report == null || (Object)(object)report.attackerBody != (Object)(object)body || !Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)report.victimBody.teamComponent))
		{
			return;
		}
		TeamMask unprotectedTeams = TeamMask.GetUnprotectedTeams(body.teamComponent.teamIndex);
		if (((TeamMask)(ref unprotectedTeams)).HasTeam(report.victimBody.teamComponent.teamIndex))
		{
			KaisaHungerStorage kaisaHungerStorage = ((Component)body.master).GetComponent<KaisaHungerStorage>();
			if (!Object.op_Implicit((Object)(object)kaisaHungerStorage))
			{
				kaisaHungerStorage = ((Component)body.master).gameObject.AddComponent<KaisaHungerStorage>();
			}
			int num = kaisaHungerStorage.AddKill(Run.instance);
			body.SetBuffCount(KillStacks.buffIndex, num);
			body.RecalculateStats();
			body.healthComponent.Heal(body.healthComponent.fullHealth * 0.05f, default(ProcChainMask), true);
			Vector3 corePosition = report.victimBody.corePosition;
			KaisaAbsorption.Spawn(corePosition, body);
			KaisaVisualMessage kaisaVisualMessage = new KaisaVisualMessage();
			kaisaVisualMessage.kind = 10;
			kaisaVisualMessage.body = KaisaNetwork.Id(((Component)body).gameObject);
			kaisaVisualMessage.position = corePosition;
			KaisaNetwork.Send(kaisaVisualMessage);
		}
	}

	public static void ApplyStats(CharacterBody body, StatHookEventArgs stats)
	{
		KaisaHunger component = ((Component)body).GetComponent<KaisaHunger>();
		if (Object.op_Implicit((Object)(object)component) && component.Selected)
		{
			stats.baseRegenAdd -= body.baseRegen;
			stats.levelRegenAdd -= body.levelRegen;
			stats.attackSpeedMultAdd += (float)body.GetBuffCount(KillStacks) * 0.01f;
		}
	}
}
public class KaisaHungerStorage : MonoBehaviour
{
	private Run ownerRun;

	private int kills;

	public int CountFor(Run run)
	{
		if ((Object)(object)ownerRun != (Object)(object)run)
		{
			ownerRun = run;
			kills = 0;
		}
		return kills;
	}

	public int AddKill(Run run)
	{
		CountFor(run);
		if (kills < int.MaxValue)
		{
			kills++;
		}
		return kills;
	}
}
public static class KaisaHungerRules
{
	public const float DrainFraction = 0.005f;

	public const float ExtraDrainPerHundred = 0.005f;

	public const float HealFraction = 0.05f;

	public const float AttackSpeedPerKill = 0.01f;

	public static float DrainForKills(int kills)
	{
		return 0.005f + (float)(Math.Max(0, kills) / 100) * 0.005f;
	}

	public static float AfterDrain(float health, float fullHealth, int kills = 0)
	{
		if (health <= 1f || fullHealth <= 0f)
		{
			return health;
		}
		return Math.Max(1f, health - fullHealth * DrainForKills(kills));
	}
}
public static class KaisaLocalization
{
	private static readonly string[,] catalog = new string[34, 3]
	{
		{ "KAISA_NAME", "Kai’Sa", "Кай’Са" },
		{ "KAISA_SUBTITLE", "Daughter of the Void", "Дочь Бездны" },
		{ "KAISA_DESCRIPTION", "A Void hunter who strikes with plasma and swiftly repositions.\n\nThe <style=cIsDamage>fifth Plasma mark</style> detonates. <style=cIsUtility>Second Skin</style> unlocks evolution, while <style=cIsUtility>Void Hunger</style> grants power with every kill at the cost of health.", "Охотница Бездны. Поражает врагов плазмой и стремительно меняет позицию.\n\n<style=cIsDamage>Пятая метка плазмы</style> взрывается. <style=cIsUtility>Вторая кожа</style> открывает эволюцию, а <style=cIsUtility>Голод Бездны</style> даёт силу за каждое убийство ценой здоровья." },
		{ "KAISA_OUTRO", "…and so she left, to continue the hunt.", "…и она ушла, чтобы продолжить охоту." },
		{ "KAISA_PRIMARY", "Living Weapon", "Живое оружие" },
		{ "KAISA_PRIMARY_DESC", "Fire a plasma shot that applies a Plasma mark.", "Выстрел плазмой, накладывающий метку плазмы." },
		{ "KAISA_Q", "Icathian Rain", "Икатианский дождь" },
		{ "KAISA_Q_DESC", "Distribute 6 missiles evenly among nearby visible enemies; 10 while evolved. Each volley applies one Plasma mark per target. Deal 25% more damage if there is only one target.", "6 ракет поровну распределяются между видимыми врагами вокруг Кай’Сы; в эволюции — 10. Одна метка плазмы на цель за залп. Если цель одна — на 25% больше урона." },
		{ "KAISA_PLASMA_Q", "Plasma Fission", "Плазменный раскол" },
		{ "KAISA_PLASMA_Q_DESC", "Fire a shot that explodes in a 5 m radius, dealing <style=cIsDamage>280% damage and applying 2 Plasma marks</style>. 4 shards strike enemies behind the impact for <style=cIsDamage>80% damage and 1 mark</style>. Releases 6 shards while evolved.", "Выстрел взрывается в радиусе 5 м: <style=cIsDamage>280% урона и 2 метки плазмы</style>. 4 осколка поражают врагов позади: <style=cIsDamage>80% урона и 1 метка</style>. В эволюции — 6 осколков." },
		{ "KAISA_E", "Supercharge", "Сверхзаряд" },
		{ "KAISA_E_DESC", "Gain movement speed, then attack speed. You can fire while moving faster.", "Ускорение передвижения, затем скорости атаки. Во время ускорения можно стрелять." },
		{ "KAISA_R", "Killer Instinct", "Инстинкт убийцы" },
		{ "KAISA_R_DESC", "Dash 28 metres in your movement direction and gain temporary barrier. With no movement input, dash towards your aim, including upwards.", "Скачок на 28 метров по направлению движения и временный барьер. Без клавиш движения — по прицелу, в том числе вверх." },
		{ "KAISA_PASSIVE", "Second Skin", "Вторая кожа" },
		{ "KAISA_PASSIVE_DESC", "Five Plasma marks cause a detonation. Kills charge evolution: 4% for a normal enemy, 8% for an elite and 20% for a boss. At 100%, press {0} to evolve.", "Пять меток плазмы вызывают взрыв. Убийства заряжают эволюцию: 4% за обычного врага, 8% за элитного, 20% за босса. При 100% нажмите {0} для эволюции." },
		{ "KAISA_PASSIVE_SLOT", "Passive", "Пассивное умение" },
		{ "KAISA_HUNGER", "Void Hunger", "Голод Бездны" },
		{ "KAISA_HUNGER_DESC", "<color=#CE9BFF><i>The second skin demands sacrifice. Each offering feeds its hunger and makes Kai’Sa stronger.</i></color>\n\n<style=cIsUtility>Replaces evolution.</style> Five Plasma marks still cause a detonation.\nEach kill <style=cIsHealing>heals 5% of maximum health</style> and grants <style=cIsDamage>1% attack speed</style> for the rest of the run.\nLose <style=cIsHealth>0.5% of maximum health per second</style>, plus <style=cIsHealth>0.5% per second for every 100 kills</style>, stopping at 1 HP. No natural health regeneration.", "<color=#CE9BFF><i>Вторая кожа требует жертв. Каждая утоляет её голод и делает Кай’Су сильнее.</i></color>\n\n<style=cIsUtility>Заменяет эволюцию.</style> Пять меток плазмы по-прежнему вызывают взрыв.\nКаждое убийство <style=cIsHealing>восстанавливает 5% максимального здоровья</style> и даёт <style=cIsDamage>1% скорости атаки</style> до конца забега.\nЦена: <style=cIsHealth>−0,5% максимального здоровья в секунду</style> и ещё <style=cIsHealth>−0,5% в секунду за каждые 100 убийств</style>, но не ниже 1 HP. Врождённой регенерации нет." },
		{ "KAISA_SKIN_BULLET", "Bullet Angel Kai’Sa", "Bullet Angel Kai’Sa" },
		{ "KAISA_SKIN_LAGOON", "Lagoon Dragon Kai’Sa", "Lagoon Dragon Kai’Sa" },
		{ "KAISA_SKIN_KDA", "K/DA Kai’Sa", "K/DA Kai’Sa" },
		{ "KAISA_SKIN_KDA_ALL_OUT_PRESTIGE", "Prestige K/DA Kai’Sa", "Prestige K/DA Kai’Sa" },
		{ "KAISA_SKIN_IG", "iG Kai’Sa", "iG Kai’Sa" },
		{ "KAISA_SKIN_ARCADE", "Arcade Kai’Sa", "Arcade Kai’Sa" },
		{ "KAISA_SKIN_KDA_ALL_OUT", "K/DA ALL OUT Kai’Sa", "K/DA ALL OUT Kai’Sa" },
		{ "KAISA_SKIN_PRESTIGE_KDA_ALL_OUT", "Prestige K/DA ALL OUT Kai’Sa", "Prestige K/DA ALL OUT Kai’Sa" },
		{ "KAISA_SKIN_KDA_PRESTIGE_2022", "Prestige K/DA Kai’Sa (2022)", "Prestige K/DA Kai’Sa (2022)" },
		{ "KAISA_SKIN_STAR_GUARDIAN", "Star Guardian Kai’Sa", "Star Guardian Kai’Sa" },
		{ "KAISA_SKIN_INKSHADOW", "Inkshadow Kai’Sa", "Inkshadow Kai’Sa" },
		{ "KAISA_SKIN_HEAVENSCALE", "Heavenscale Kai’Sa", "Heavenscale Kai’Sa" },
		{ "KAISA_SKIN_DARK_STAR", "Dark Star Kai’Sa", "Dark Star Kai’Sa" },
		{ "KAISA_SKIN_RISEN_LEGEND", "Risen Legend Kai’Sa", "Risen Legend Kai’Sa" },
		{ "KAISA_SKIN_IMMORTALIZED_LEGEND", "Immortalized Legend Kai’Sa", "Immortalized Legend Kai’Sa" }
	};

	public static void Install()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.Ordinal);
		Dictionary<string, string> dictionary2 = new Dictionary<string, string>(StringComparer.Ordinal);
		string arg = ((object)KaisaPlugin.EvolutionKey.Value/*cast due to .constrained prefix*/).ToString();
		for (int i = 0; i < catalog.GetLength(0); i++)
		{
			string text = catalog[i, 0];
			string text2 = catalog[i, 1];
			string text3 = catalog[i, 2];
			if (text == "KAISA_PASSIVE_DESC")
			{
				text2 = string.Format(text2, arg);
				text3 = string.Format(text3, arg);
			}
			dictionary.Add(text, text2);
			dictionary2.Add(text, text3);
		}
		LanguageAPI.Add(dictionary);
		LanguageAPI.Add(dictionary, "en");
		LanguageAPI.Add(dictionary2, "ru");
	}
}
public static class KaisaNetwork
{
	private const short VisualMessage = 27420;

	private const short EvolutionRequest = 27421;

	private static bool installed;

	public static void Install()
	{
		if (!installed)
		{
			installed = true;
			NetworkManagerSystem.onStartServerGlobal += RegisterServer;
			NetworkManagerSystem.onStartClientGlobal += RegisterClient;
			NetworkManagerSystem.onStopClientGlobal += KaisaRemoteProjectile.Clear;
			if (NetworkServer.active)
			{
				RegisterServer();
			}
			if (Object.op_Implicit((Object)(object)NetworkManager.singleton) && NetworkManager.singleton.client != null)
			{
				RegisterClient(NetworkManager.singleton.client);
			}
		}
	}

	private static void RegisterServer()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		NetworkServer.RegisterHandler((short)27421, new NetworkMessageDelegate(ReceiveEvolution));
	}

	private static void RegisterClient(NetworkClient client)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		client.RegisterHandler((short)27420, new NetworkMessageDelegate(ReceiveVisual));
	}

	public static NetworkInstanceId Id(GameObject go)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		NetworkIdentity val = (Object.op_Implicit((Object)(object)go) ? go.GetComponent<NetworkIdentity>() : null);
		return Object.op_Implicit((Object)(object)val) ? val.netId : NetworkInstanceId.Invalid;
	}

	public static GameObject Find(NetworkInstanceId id)
	{
		//IL_0010: 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)
		return NetworkServer.active ? NetworkServer.FindLocalObject(id) : ClientScene.FindLocalObject(id);
	}

	public static void RequestEvolution(KaisaController controller)
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)controller) || !Object.op_Implicit((Object)(object)controller.Body) || !((NetworkBehaviour)controller.Body).hasAuthority)
		{
			return;
		}
		if (NetworkServer.active)
		{
			controller.TryEvolve();
			return;
		}
		NetworkConnection readyConnection = ClientScene.readyConnection;
		if (readyConnection != null)
		{
			readyConnection.Send((short)27421, (MessageBase)(object)new KaisaEvolutionRequest
			{
				body = Id(((Component)controller).gameObject)
			});
		}
	}

	public static bool OwnsBody(NetworkConnection connection, CharacterBody body)
	{
		return connection != null && Object.op_Implicit((Object)(object)body) && NetworkUser.readOnlyInstancesList.Any((NetworkUser u) => Object.op_Implicit((Object)(object)u) && ((NetworkBehaviour)u).connectionToClient == connection && (Object)(object)u.GetCurrentBody() == (Object)(object)body);
	}

	private static void ReceiveEvolution(NetworkMessage message)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			KaisaEvolutionRequest kaisaEvolutionRequest = message.ReadMessage<KaisaEvolutionRequest>();
			GameObject val = Find(kaisaEvolutionRequest.body);
			KaisaController kaisaController = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<KaisaController>() : null);
			if (Object.op_Implicit((Object)(object)kaisaController) && OwnsBody(message.conn, kaisaController.Body))
			{
				kaisaController.TryEvolve();
			}
		}
	}

	private static void ReceiveVisual(NetworkMessage message)
	{
		if (!NetworkServer.active)
		{
			message.ReadMessage<KaisaVisualMessage>().Apply();
		}
	}

	public static void Send(KaisaVisualMessage message, bool unreliable = false)
	{
		if (NetworkServer.active)
		{
			if (unreliable)
			{
				NetworkServer.SendByChannelToAll((short)27420, (MessageBase)(object)message, 1);
			}
			else
			{
				NetworkServer.SendToAll((short)27420, (MessageBase)(object)message);
			}
		}
	}

	public static void Impact(Vector3 position, float radius, bool plasma, CharacterBody owner = null)
	{
		//IL_0024: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		KaisaVisualMessage kaisaVisualMessage = new KaisaVisualMessage();
		kaisaVisualMessage.kind = 4;
		kaisaVisualMessage.body = (Object.op_Implicit((Object)(object)owner) ? Id(((Component)owner).gameObject) : NetworkInstanceId.Invalid);
		kaisaVisualMessage.position = position;
		kaisaVisualMessage.value = rad