Decompiled source of Overwatch Doctrine v1.0.0

plugins/DoctrineMod/DoctrineMod.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using HarmonyLib;
using KinematicCharacterController;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

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

public enum DoctrineGesture
{
	None,
	Deploy,
	Ultimate,
	Momentum,
	Primary
}
[DefaultExecutionOrder(150)]
public sealed class DoctrinePose : MonoBehaviour
{
	[SerializeField]
	internal bool DisplayOnly;

	private Quaternion rightPalmBind;

	private Quaternion leftPalmBind;

	private Vector3 rightHandRest;

	private Vector3 leftHandRest;

	private Transform displayStaff;

	private Transform leftGrip;

	private MaterialPropertyBlock revealBlock;

	private Vector3 staffRest;

	private bool staffStruck;

	private Transform capeMid;

	private Transform capeHem;

	private Quaternion capeMidBase;

	private Quaternion capeHemBase;

	private float capeBend;

	private float capeTurn;

	private float lastCapeYaw;

	private bool capeYawReady;

	private Transform capeL;

	private Transform capeR;

	private Quaternion capeLeftBase;

	private Quaternion capeRightBase;

	private Quaternion displayRotation;

	private Vector3 displayPosition;

	private Vector3 displayScale;

	private float displayStart;

	private bool displayInitialized;

	private CharacterModel model;

	private Transform upperR;

	private Transform foreR;

	private Transform handR;

	private Transform upperL;

	private Transform foreL;

	private Transform handL;

	private Transform chest;

	private Transform head;

	private Transform thighL;

	private Transform thighR;

	private Transform calfL;

	private Transform calfR;

	private Transform tip;

	private Transform[] petals;

	private DoctrineGesture gesture;

	private float age;

	private float duration;

	private float infuseWeight;

	private float ghostTimer;

	private Vector3 aim;

	private bool releasedDrones;

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

	private readonly List<Quaternion> original = new List<Quaternion>();

	private readonly List<Quaternion> applied = new List<Quaternion>();

	private float EntrancePoseTime
	{
		get
		{
			float entranceAge = EntranceAge;
			if (!(entranceAge <= 1.75f))
			{
				if (!(entranceAge < 3.6f))
				{
					return entranceAge - 0.6f;
				}
				return 1.75f + (entranceAge - 1.75f) * 0.6756757f;
			}
			return entranceAge;
		}
	}

	public float EntranceAge => Mathf.Max(0f, Time.unscaledTime - displayStart);

	public static void Play(CharacterBody body, DoctrineGesture gesture, float duration, Vector3 aim)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		if (!Application.isBatchMode && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			DoctrinePose component = ((Component)body.modelLocator.modelTransform).GetComponent<DoctrinePose>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.Begin(gesture, duration, aim);
			}
		}
	}

	internal static void EndMomentum(CharacterBody body)
	{
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			DoctrinePose component = ((Component)body.modelLocator.modelTransform).GetComponent<DoctrinePose>();
			if (Object.op_Implicit((Object)(object)component) && component.gesture == DoctrineGesture.Momentum)
			{
				component.gesture = DoctrineGesture.None;
			}
		}
	}

	private void Begin(DoctrineGesture next, float time, Vector3 forward)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		gesture = next;
		duration = time;
		age = 0f;
		aim = ((((Vector3)(ref forward)).sqrMagnitude > 0.01f) ? ((Vector3)(ref forward)).normalized : ((Component)this).transform.forward);
		ghostTimer = 0f;
		releasedDrones = false;
		Animator component = ((Component)this).GetComponent<Animator>();
		int num = (Object.op_Implicit((Object)(object)component) ? component.GetLayerIndex("Gesture, Additive") : (-1));
		int num2 = Animator.StringToHash(next switch
		{
			DoctrineGesture.Ultimate => "FireFMJ", 
			DoctrineGesture.Deploy => "ThrowGrenade", 
			_ => "FirePistol, Right", 
		});
		if (next != DoctrineGesture.Momentum && Object.op_Implicit((Object)(object)component) && num >= 0 && component.HasState(num, num2))
		{
			component.CrossFadeInFixedTime(num2, 0.06f, num);
		}
		if (next == DoctrineGesture.Ultimate && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.body))
		{
			DoctrineVFX.Burst(model.body.corePosition, 1.3f, DoctrineVFX.Gold);
		}
	}

	private Transform Bone(string name)
	{
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>();
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == name)
			{
				return val;
			}
		}
		return null;
	}

	private void Start()
	{
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Expected O, but got Unknown
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isBatchMode)
		{
			((Behaviour)this).enabled = false;
			return;
		}
		model = ((Component)this).GetComponent<CharacterModel>();
		upperR = Bone("upper_arm.r");
		foreR = Bone("lower_arm.r");
		handR = Bone("hand.r");
		upperL = Bone("upper_arm.l");
		foreL = Bone("lower_arm.l");
		handL = Bone("hand.l");
		chest = Bone("chest");
		head = Bone("head");
		thighL = Bone("thigh.l");
		thighR = Bone("thigh.r");
		calfL = Bone("calf.l");
		calfR = Bone("calf.r");
		tip = Bone("DoctrineScepterTip");
		capeMid = Bone("DoctrineCapeMid");
		capeHem = Bone("DoctrineCapeHem");
		if (Object.op_Implicit((Object)(object)capeMid))
		{
			capeMidBase = capeMid.localRotation;
		}
		if (Object.op_Implicit((Object)(object)capeHem))
		{
			capeHemBase = capeHem.localRotation;
		}
		capeL = Bone("DoctrineCapeL");
		capeR = Bone("DoctrineCapeR");
		if (Object.op_Implicit((Object)(object)capeL))
		{
			capeLeftBase = capeL.localRotation;
		}
		if (Object.op_Implicit((Object)(object)capeR))
		{
			capeRightBase = capeR.localRotation;
		}
		if (Object.op_Implicit((Object)(object)handR))
		{
			rightHandRest = handR.localPosition;
		}
		if (Object.op_Implicit((Object)(object)handL))
		{
			leftHandRest = handL.localPosition;
		}
		displayStaff = Bone("DoctrineStaffGrip");
		leftGrip = Bone("DoctrineLeftGrip");
		if (Object.op_Implicit((Object)(object)displayStaff))
		{
			rightPalmBind = displayStaff.localRotation;
		}
		if (Object.op_Implicit((Object)(object)leftGrip))
		{
			leftPalmBind = leftGrip.localRotation;
		}
		if (DisplayOnly)
		{
			revealBlock = new MaterialPropertyBlock();
			((Component)this).gameObject.AddComponent<EntranceMist>().pose = this;
			Transform val = Bone("foot.l");
			float num = (Object.op_Implicit((Object)(object)val) ? (((Component)this).transform.InverseTransformPoint(val.position).y - 0.08f) : 0f);
			staffRest = new Vector3(0f, num + 0.86f, 0.3f);
			displayPosition = ((Component)this).transform.localPosition;
			displayRotation = ((Component)this).transform.localRotation;
			displayScale = ((Component)this).transform.localScale;
			displayInitialized = true;
			displayStart = Time.unscaledTime;
			WeaponAudio.PlayEntrance(this);
		}
		if (Object.op_Implicit((Object)(object)tip))
		{
			petals = (Transform[])(object)new Transform[3];
			for (int i = 0; i < 3; i++)
			{
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3);
				Object.Destroy((Object)(object)val2.GetComponent<Collider>());
				((Object)val2).name = "DoctrineOpeningScepterPetal";
				val2.transform.SetParent(tip, false);
				val2.transform.localScale = new Vector3(0.02f, 0.12f, 0.025f);
				val2.GetComponent<Renderer>().sharedMaterial = Art.EnergyMaterial(new Color(0.75f, 0.42f, 0.1f));
				petals[i] = val2.transform;
			}
		}
	}

	private void Update()
	{
		//IL_001c: 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_0067: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		if (DisplayOnly)
		{
			if (Object.op_Implicit((Object)(object)handR))
			{
				handR.localPosition = rightHandRest;
			}
			if (Object.op_Implicit((Object)(object)handL))
			{
				handL.localPosition = leftHandRest;
			}
		}
		for (int i = 0; i < modified.Count; i++)
		{
			if (Object.op_Implicit((Object)(object)modified[i]) && Quaternion.Angle(modified[i].localRotation, applied[i]) < 0.01f)
			{
				modified[i].localRotation = original[i];
			}
		}
		modified.Clear();
		original.Clear();
		applied.Clear();
	}

	private void Remember(Transform bone)
	{
		//IL_002a: 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)
		if (Object.op_Implicit((Object)(object)bone) && !modified.Contains(bone))
		{
			modified.Add(bone);
			original.Add(bone.localRotation);
			applied.Add(bone.localRotation);
		}
	}

	private void Add(Transform bone, Quaternion offset, float weight)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)bone))
		{
			Remember(bone);
			bone.localRotation *= Quaternion.Slerp(Quaternion.identity, offset, weight);
		}
	}

	private void Reach(Transform upper, Transform fore, Transform hand, Vector3 point, Vector3 elbowDirection, float weight)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: 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_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)upper) && Object.op_Implicit((Object)(object)fore) && Object.op_Implicit((Object)(object)hand))
		{
			Remember(upper);
			Remember(fore);
			float num = Vector3.Distance(upper.position, fore.position);
			float num2 = Vector3.Distance(fore.position, hand.position);
			Vector3 val = point - upper.position;
			float num3 = Mathf.Clamp(((Vector3)(ref val)).magnitude, 0.05f, Mathf.Max(0.06f, num + num2 - 0.015f));
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.ProjectOnPlane(elbowDirection, normalized);
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f)
			{
				Vector3 val3 = Vector3.ProjectOnPlane(((Component)this).transform.right, normalized);
				normalized2 = ((Vector3)(ref val3)).normalized;
			}
			float num4 = (num * num - num2 * num2 + num3 * num3) / (2f * num3);
			float num5 = Mathf.Sqrt(Mathf.Max(0f, num * num - num4 * num4));
			Vector3 val4 = upper.position + normalized * num4 + normalized2 * num5;
			Quaternion val5 = Quaternion.FromToRotation(fore.position - upper.position, val4 - upper.position) * upper.rotation;
			upper.rotation = Quaternion.Slerp(upper.rotation, val5, weight);
			Quaternion val6 = Quaternion.FromToRotation(hand.position - fore.position, point - fore.position) * fore.rotation;
			fore.rotation = Quaternion.Slerp(fore.rotation, val6, weight);
		}
	}

	private void LateUpdate()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: 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_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_044f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0492: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_055b: Unknown result type (might be due to invalid IL or missing references)
		//IL_055d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0564: Unknown result type (might be due to invalid IL or missing references)
		//IL_0569: Unknown result type (might be due to invalid IL or missing references)
		//IL_056e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0575: Unknown result type (might be due to invalid IL or missing references)
		//IL_057a: Unknown result type (might be due to invalid IL or missing references)
		//IL_057f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0586: Unknown result type (might be due to invalid IL or missing references)
		//IL_058b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0590: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_0599: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0605: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_060f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0616: Unknown result type (might be due to invalid IL or missing references)
		//IL_061b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0620: Unknown result type (might be due to invalid IL or missing references)
		//IL_0622: Unknown result type (might be due to invalid IL or missing references)
		//IL_0627: Unknown result type (might be due to invalid IL or missing references)
		//IL_0629: Unknown result type (might be due to invalid IL or missing references)
		//IL_0648: Unknown result type (might be due to invalid IL or missing references)
		//IL_064a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0651: Unknown result type (might be due to invalid IL or missing references)
		//IL_0656: Unknown result type (might be due to invalid IL or missing references)
		//IL_065b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_0667: Unknown result type (might be due to invalid IL or missing references)
		//IL_066c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0673: Unknown result type (might be due to invalid IL or missing references)
		//IL_0678: Unknown result type (might be due to invalid IL or missing references)
		//IL_067d: Unknown result type (might be due to invalid IL or missing references)
		//IL_067f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0684: Unknown result type (might be due to invalid IL or missing references)
		//IL_0686: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_0506: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_0521: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0707: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Unknown result type (might be due to invalid IL or missing references)
		//IL_0710: Unknown result type (might be due to invalid IL or missing references)
		//IL_0715: Unknown result type (might be due to invalid IL or missing references)
		//IL_071a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0721: Unknown result type (might be due to invalid IL or missing references)
		//IL_0726: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0732: Unknown result type (might be due to invalid IL or missing references)
		//IL_0737: Unknown result type (might be due to invalid IL or missing references)
		//IL_073c: Unknown result type (might be due to invalid IL or missing references)
		//IL_073e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0743: Unknown result type (might be due to invalid IL or missing references)
		//IL_0745: Unknown result type (might be due to invalid IL or missing references)
		//IL_0764: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0772: Unknown result type (might be due to invalid IL or missing references)
		//IL_0777: Unknown result type (might be due to invalid IL or missing references)
		//IL_077e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0783: Unknown result type (might be due to invalid IL or missing references)
		//IL_0788: Unknown result type (might be due to invalid IL or missing references)
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0794: Unknown result type (might be due to invalid IL or missing references)
		//IL_0799: Unknown result type (might be due to invalid IL or missing references)
		//IL_079b: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0808: Unknown result type (might be due to invalid IL or missing references)
		//IL_082a: Unknown result type (might be due to invalid IL or missing references)
		//IL_084c: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)model))
		{
			return;
		}
		if (DisplayOnly)
		{
			DisplayPose();
			for (int i = 0; i < modified.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)modified[i]))
				{
					applied[i] = modified[i].localRotation;
				}
			}
			return;
		}
		CapePose(0.04f + Mathf.Sin(Time.time * 2f) * 0.025f);
		if (!Object.op_Implicit((Object)(object)model.body) || !model.body.healthComponent.alive)
		{
			return;
		}
		CharacterBody body = model.body;
		infuseWeight = Mathf.MoveTowards(infuseWeight, DoctrineVFX.InfuseVisible(body) ? 1f : 0f, Time.deltaTime * 6f);
		if (petals != null)
		{
			for (int j = 0; j < 3; j++)
			{
				float num = (float)j * 120f;
				float num2 = num * ((float)Math.PI / 180f);
				petals[j].localPosition = new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * (0.045f + infuseWeight * 0.055f);
				petals[j].localRotation = Quaternion.Euler(infuseWeight * 40f, num, 0f);
			}
		}
		Vector3 val = (Object.op_Implicit((Object)(object)chest) ? chest.position : body.corePosition);
		Reach(upperL, foreL, handL, val - ((Component)this).transform.up * 0.39f - ((Component)this).transform.right * 0.23f + ((Component)this).transform.forward * 0.19f, -((Component)this).transform.up - ((Component)this).transform.right + ((Component)this).transform.forward * 0.25f, 1f);
		if (Object.op_Implicit((Object)(object)handL) && Object.op_Implicit((Object)(object)leftGrip))
		{
			Remember(handL);
			handL.rotation = NaturalPalm(foreL, handL) * Quaternion.Inverse(leftPalmBind);
		}
		if (gesture == DoctrineGesture.None)
		{
			Vector3 val2 = (Object.op_Implicit((Object)(object)chest) ? chest.position : body.corePosition);
			Vector3 forward = ((Component)this).transform.forward;
			Vector3 right = ((Component)this).transform.right;
			Vector3 up = ((Component)this).transform.up;
			float num3 = Mathf.Sin(Time.time * 2.2f) * 0.025f;
			Reach(upperR, foreR, handR, val2 - up * 0.32f + right * 0.24f + forward * (0.15f + num3), -up + right, 0.72f);
			for (int k = 0; k < modified.Count; k++)
			{
				if (Object.op_Implicit((Object)(object)modified[k]))
				{
					applied[k] = modified[k].localRotation;
				}
			}
			return;
		}
		age += Time.deltaTime;
		float num4 = Mathf.Min(Mathf.Clamp01(age / 0.13f), Mathf.Clamp01((duration - age) / 0.18f));
		Vector3 val3 = (Object.op_Implicit((Object)(object)chest) ? chest.position : body.corePosition);
		Vector3 up2 = ((Component)this).transform.up;
		Vector3 right2 = ((Component)this).transform.right;
		Vector3 val4 = aim;
		if (gesture == DoctrineGesture.Primary)
		{
			Reach(upperR, foreR, handR, val3 + val4 * (0.36f - 0.05f * Mathf.Sin(age / duration * (float)Math.PI)) - up2 * 0.1f + right2 * 0.18f, -up2 + right2, num4);
			if (Object.op_Implicit((Object)(object)handR) && Object.op_Implicit((Object)(object)tip))
			{
				Remember(handR);
				Quaternion val5 = Quaternion.FromToRotation(tip.position - handR.position, val4);
				handR.rotation = Quaternion.Slerp(handR.rotation, val5 * handR.rotation, num4);
			}
		}
		else if (gesture == DoctrineGesture.Deploy)
		{
			Reach(upperL, foreL, handL, val3 + val4 * 0.6f + up2 * 0.16f - right2 * 0.12f, -up2 - right2, num4);
			Add(handL, Quaternion.Euler(-35f, 0f, -15f), num4);
		}
		else if (gesture == DoctrineGesture.Ultimate)
		{
			Reach(upperL, foreL, handL, val3 + val4 * 0.78f + up2 * 0.05f - right2 * 0.12f, -up2 - right2, num4);
			Reach(upperR, foreR, handR, val3 + val4 * 0.35f + up2 * 0.04f + right2 * 0.16f, -up2 + right2, num4);
			Add(chest, Quaternion.Euler(-8f, 0f, 0f), num4);
			OrbitingDrones component = ((Component)this).GetComponent<OrbitingDrones>();
			if (Object.op_Implicit((Object)(object)component) && !releasedDrones)
			{
				component.Release(val4);
				releasedDrones = true;
			}
		}
		else if (gesture == DoctrineGesture.Momentum)
		{
			Reach(upperR, foreR, handR, val3 + val4 * 0.16f - up2 * 0.12f + right2 * 0.04f, -up2 + right2, num4);
			Reach(upperL, foreL, handL, val3 + val4 * 0.13f - up2 * 0.08f - right2 * 0.11f, -up2 - right2, num4);
			Add(chest, Quaternion.Euler(17f, 0f, 0f), num4);
			Add(head, Quaternion.Euler(-12f, 0f, 0f), num4);
			Add(thighL, Quaternion.Euler(-24f, 0f, -4f), num4);
			Add(thighR, Quaternion.Euler(-20f, 0f, 4f), num4);
			Add(calfL, Quaternion.Euler(35f, 0f, 0f), num4);
			Add(calfR, Quaternion.Euler(30f, 0f, 0f), num4);
			ghostTimer += Time.deltaTime;
			if (ghostTimer >= 0.21f)
			{
				ghostTimer -= 0.21f;
				Afterimage.Create(model);
			}
		}
		for (int l = 0; l < modified.Count; l++)
		{
			if (Object.op_Implicit((Object)(object)modified[l]))
			{
				applied[l] = modified[l].localRotation;
			}
		}
		if (age >= duration)
		{
			gesture = DoctrineGesture.None;
		}
	}

	private static float Ease(float a, float b, float t)
	{
		return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(a, b, t));
	}

	private void CapePose(float spread)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)capeL))
		{
			capeL.localRotation = capeLeftBase * Quaternion.Euler((0f - spread) * 8f, spread * 15f, (0f - spread) * 46f);
		}
		if (Object.op_Implicit((Object)(object)capeR))
		{
			capeR.localRotation = capeRightBase * Quaternion.Euler((0f - spread) * 8f, (0f - spread) * 15f, spread * 46f);
		}
		float num = Mathf.Clamp(Time.deltaTime, 0f, 0.05f);
		float y = ((Component)this).transform.eulerAngles.y;
		float num2 = ((!DisplayOnly && capeYawReady) ? Mathf.Clamp(Mathf.DeltaAngle(lastCapeYaw, y) / Mathf.Max(num, 0.001f) * 0.025f, -10f, 10f) : 0f);
		lastCapeYaw = y;
		capeYawReady = true;
		float num3 = 0f;
		if (!DisplayOnly && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.body) && Object.op_Implicit((Object)(object)model.body.characterMotor))
		{
			num3 = ((Vector3)(ref model.body.characterMotor.velocity)).magnitude;
		}
		capeBend = Mathf.Lerp(capeBend, Mathf.Min(18f, num3 * 1.2f), 1f - Mathf.Exp((0f - num) * 4f));
		capeTurn = Mathf.Lerp(capeTurn, num2, 1f - Mathf.Exp((0f - num) * 3f));
		float num4 = (DisplayOnly ? Time.unscaledTime : Time.time);
		if (Object.op_Implicit((Object)(object)capeMid))
		{
			capeMid.localRotation = capeMidBase * Quaternion.Euler(capeBend * 0.45f + Mathf.Sin(num4 * 1.7f) * 1.2f, capeTurn * 0.5f, Mathf.Sin(num4 * 1.3f) * 0.8f);
		}
		if (Object.op_Implicit((Object)(object)capeHem))
		{
			capeHem.localRotation = capeHemBase * Quaternion.Euler(capeBend + Mathf.Sin(num4 * 2.1f - 0.8f) * 2.2f, capeTurn, Mathf.Sin(num4 * 1.3f - 0.6f) * 1.8f);
		}
	}

	private Quaternion NaturalPalm(Transform fore, Transform hand)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_0027: 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_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = hand.position - fore.position;
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, normalized);
		Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
		if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f)
		{
			Vector3 val3 = Vector3.ProjectOnPlane(((Component)this).transform.up, normalized);
			normalized2 = ((Vector3)(ref val3)).normalized;
		}
		Quaternion val4 = Quaternion.LookRotation(normalized2, -normalized);
		float num = (DisplayOnly ? (Ease(1.75f, 2.3f, EntrancePoseTime) * (1f - Ease(3f, 3.4f, EntrancePoseTime))) : 0f);
		return val4 * Quaternion.AngleAxis(180f * num, Vector3.up);
	}

	private void PlacePalm(Transform upper, Transform fore, Transform hand, Transform grip, Vector3 target, Vector3 pole, Quaternion orientation)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: 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)
		if (Object.op_Implicit((Object)(object)grip) && Object.op_Implicit((Object)(object)hand))
		{
			Remember(hand);
			Quaternion val = (((Object)(object)hand == (Object)(object)handR) ? rightPalmBind : leftPalmBind);
			for (int i = 0; i < 10; i++)
			{
				hand.rotation = NaturalPalm(fore, hand) * Quaternion.Inverse(val);
				Vector3 val2 = grip.position - hand.position;
				Reach(upper, fore, hand, target - val2, pole, 1f);
			}
			hand.rotation = NaturalPalm(fore, hand) * Quaternion.Inverse(val);
			Vector3 val3 = target - grip.position;
			if (((Vector3)(ref val3)).magnitude < 0.08f)
			{
				hand.position += val3;
			}
			grip.rotation = orientation;
		}
	}

	private void DisplayPose()
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: 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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: 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_0161: 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_016e: 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_0183: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: 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_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: 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_0269: 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_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: 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_02fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0408: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0445: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_0480: Unknown result type (might be due to invalid IL or missing references)
		//IL_0485: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
		float entrancePoseTime = EntrancePoseTime;
		float num = Ease(1.75f, 2.95f, entrancePoseTime);
		float num2 = Ease(2.05f, 2.75f, entrancePoseTime) * (1f - Ease(3f, 3.8f, entrancePoseTime));
		float num3 = Ease(0.45f, 1.4f, entrancePoseTime);
		RendererInfo[] baseRendererInfos = model.baseRendererInfos;
		for (int i = 0; i < baseRendererInfos.Length; i++)
		{
			RendererInfo val = baseRendererInfos[i];
			if (Object.op_Implicit((Object)(object)val.renderer))
			{
				val.renderer.enabled = num3 > 0f;
				val.renderer.GetPropertyBlock(revealBlock);
				revealBlock.SetFloat("_Fade", num3);
				val.renderer.SetPropertyBlock(revealBlock);
			}
		}
		((Component)this).transform.localPosition = displayPosition;
		((Component)this).transform.localRotation = displayRotation * Quaternion.Euler(0f, 180f * (1f - num), 0f);
		((Component)this).transform.localScale = displayScale;
		Vector3 val2 = (Object.op_Implicit((Object)(object)chest) ? chest.position : (((Component)this).transform.position + ((Component)this).transform.up));
		Vector3 up = ((Component)this).transform.up;
		Vector3 right = ((Component)this).transform.right;
		Vector3 forward = ((Component)this).transform.forward;
		float num4 = Ease(2.9f, 3.4f, entrancePoseTime);
		float num5 = 0.13f * Ease(3.05f, 3.3f, entrancePoseTime) * (1f - Ease(3.38f, 3.6f, entrancePoseTime));
		Vector3 val3 = ((Component)this).transform.TransformPoint(staffRest + Vector3.up * num5);
		Vector3 target = Vector3.Lerp(val2 + right * (0.28f + num2 * 0.52f) - up * (0.33f - num2 * 0.4f) + forward * (0.18f + num2 * 0.08f), val3, num4);
		PlacePalm(upperR, foreR, handR, displayStaff, target, -up + right, Quaternion.AngleAxis((0f - (12f + 18f * num2)) * (1f - num4), forward) * ((Component)this).transform.rotation);
		Vector3 target2 = Vector3.Lerp(val2 - right * (0.25f + num2 * 0.58f) - up * (0.32f - num2 * 0.39f) + forward * 0.22f, displayStaff.position + up * 0.035f - right * 0.06f, num4);
		PlacePalm(upperL, foreL, handL, leftGrip, target2, -up - right + forward * 0.25f, Quaternion.AngleAxis(-15f * (1f - num4), forward) * ((Component)this).transform.rotation);
		Add(head, Quaternion.Euler(17f * Ease(3.15f, 3.6f, entrancePoseTime) * (1f - Ease(4.05f, 5.5f, entrancePoseTime)), 0f, 0f), 1f);
		CapePose(0.015f);
		if (Object.op_Implicit((Object)(object)capeL))
		{
			capeL.localRotation = capeLeftBase * Quaternion.Euler(-12f * num2, -46f * num2, -78f * num2);
		}
		if (Object.op_Implicit((Object)(object)capeR))
		{
			capeR.localRotation = capeRightBase * Quaternion.Euler(-5f * num2, -26f * num2, -28f * num2);
		}
		if (Object.op_Implicit((Object)(object)capeMid))
		{
			Transform obj = capeMid;
			obj.localRotation *= Quaternion.Euler(0f, -18f * num2, -16f * num2);
		}
		if (Object.op_Implicit((Object)(object)capeHem))
		{
			Transform obj2 = capeHem;
			obj2.localRotation *= Quaternion.Euler(0f, -35f * num2, -30f * num2);
		}
		if (entrancePoseTime >= 3.6f && !staffStruck)
		{
			staffStruck = true;
			WeaponAudio.PlayStaffStrike(this);
		}
	}

	private void OnEnable()
	{
		if (displayInitialized)
		{
			staffStruck = false;
			displayStart = Time.unscaledTime;
			WeaponAudio.PlayEntrance(this);
		}
	}

	private void OnDisable()
	{
		//IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		WeaponAudio.StopEntrance(this);
		if (DisplayOnly && Object.op_Implicit((Object)(object)model))
		{
			RendererInfo[] baseRendererInfos = model.baseRendererInfos;
			for (int i = 0; i < baseRendererInfos.Length; i++)
			{
				RendererInfo val = baseRendererInfos[i];
				if (Object.op_Implicit((Object)(object)val.renderer))
				{
					val.renderer.enabled = true;
				}
			}
		}
		if (displayInitialized)
		{
			((Component)this).transform.localPosition = displayPosition;
			((Component)this).transform.localRotation = displayRotation;
			((Component)this).transform.localScale = displayScale;
			CapePose(0f);
		}
	}

	private void OnDestroy()
	{
		if (petals == null)
		{
			return;
		}
		Transform[] array = petals;
		foreach (Transform val in array)
		{
			if (Object.op_Implicit((Object)(object)val))
			{
				Renderer component = ((Component)val).GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component.sharedMaterial))
				{
					Object.Destroy((Object)(object)component.sharedMaterial);
				}
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}
	}
}
public sealed class Afterimage : MonoBehaviour
{
	private static Material ghostMaterial;

	private static readonly Queue<Afterimage> pool = new Queue<Afterimage>();

	private float age;

	private readonly List<Mesh> meshes = new List<Mesh>();

	private readonly List<MeshRenderer> renderers = new List<MeshRenderer>();

	private readonly MaterialPropertyBlock block = new MaterialPropertyBlock();

	public static void Create(CharacterModel model)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_008d: 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_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Expected O, but got Unknown
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Expected O, but got Unknown
		if (Application.isBatchMode || !Object.op_Implicit((Object)(object)model) || model.invisibilityCount > 0)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)ghostMaterial))
		{
			ghostMaterial = new Material(DoctrineVFX.Material(new Color(0.55f, 0.08f, 1f, 0.35f)));
			ghostMaterial.DisableKeyword("VERTEXCOLOR");
		}
		Afterimage afterimage = null;
		while (pool.Count > 0 && !Object.op_Implicit((Object)(object)afterimage))
		{
			afterimage = pool.Dequeue();
		}
		if (!Object.op_Implicit((Object)(object)afterimage))
		{
			afterimage = new GameObject("DoctrineMomentumAfterimage").AddComponent<Afterimage>();
		}
		afterimage.age = 0f;
		int num = 0;
		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) && ((Renderer)val2).enabled)
			{
				if (num >= afterimage.meshes.Count)
				{
					GameObject val3 = new GameObject("DoctrineBakedSilhouette");
					val3.transform.SetParent(((Component)afterimage).transform, false);
					Mesh val4 = new Mesh();
					val4.MarkDynamic();
					afterimage.meshes.Add(val4);
					val3.AddComponent<MeshFilter>().sharedMesh = val4;
					MeshRenderer val5 = val3.AddComponent<MeshRenderer>();
					((Renderer)val5).sharedMaterial = ghostMaterial;
					((Renderer)val5).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)val5).receiveShadows = false;
					afterimage.renderers.Add(val5);
				}
				MeshRenderer val6 = afterimage.renderers[num];
				((Component)val6).gameObject.SetActive(true);
				((Component)val6).transform.position = ((Component)val2).transform.position;
				((Component)val6).transform.rotation = ((Component)val2).transform.rotation;
				((Component)val6).transform.localScale = ((Component)val2).transform.lossyScale;
				val2.BakeMesh(afterimage.meshes[num]);
				num++;
			}
		}
		for (int j = num; j < afterimage.renderers.Count; j++)
		{
			((Component)afterimage.renderers[j]).gameObject.SetActive(false);
		}
		afterimage.ApplyAlpha(1f);
		((Component)afterimage).gameObject.SetActive(true);
	}

	private void ApplyAlpha(float alpha)
	{
		//IL_0021: 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)
		block.SetColor("_TintColor", new Color(0.5f, 0.035f, 1f, 0.3f * alpha));
		block.SetColor("_Color", new Color(0.5f, 0.035f, 1f, 0.3f * alpha));
		foreach (MeshRenderer renderer in renderers)
		{
			((Renderer)renderer).SetPropertyBlock(block);
		}
	}

	private void Update()
	{
		age += Time.deltaTime;
		ApplyAlpha(Mathf.Clamp01(1f - age / 0.48f));
		if (age >= 0.48f)
		{
			if (pool.Count < 32)
			{
				((Component)this).gameObject.SetActive(false);
				pool.Enqueue(this);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}

	private void OnDestroy()
	{
		foreach (Mesh mesh in meshes)
		{
			if (Object.op_Implicit((Object)(object)mesh))
			{
				Object.Destroy((Object)(object)mesh);
			}
		}
	}
}
internal static class Art
{
	private static readonly Color Pink = new Color(1f, 0.015f, 0.35f);

	private static Material beamMaterial;

	private static Material droneGold;

	private static Material dronePink;

	private static Material droneBlack;

	private static Mesh droneWing;

	private static Mesh cube;

	private static Mesh sphere;

	private static Mesh cylinder;

	private static readonly Dictionary<string, Texture2D> surfaces = new Dictionary<string, Texture2D>();

	internal static Mesh SparkMesh => sphere;

	internal static Sprite[] LoadIcons()
	{
		string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		return new string[7] { "scepter", "infuse", "drones", "momentum", "deliverance", "portrait", "passive" }.Select(delegate(string name)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_00ac: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			string path = Path.Combine(folder, name + ".png");
			if (File.Exists(path))
			{
				ImageConversion.LoadImage(val, File.ReadAllBytes(path));
			}
			else
			{
				for (int i = 0; i < 256; i++)
				{
					for (int j = 0; j < 256; j++)
					{
						val.SetPixel(j, i, new Color(0.2f, 0.02f, 0.09f));
					}
				}
				val.Apply();
			}
			((Object)val).name = "Doctrine" + name;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}).ToArray();
	}

	private static Mesh PrimitiveMesh(PrimitiveType type)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive(type);
		Mesh sharedMesh = val.GetComponent<MeshFilter>().sharedMesh;
		Object.DestroyImmediate((Object)(object)val);
		return sharedMesh;
	}

	private static Material Mat(Material original, Color color, bool glow)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_013a: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(original);
		((Object)val).name = "DoctrineMaterial";
		val.SetColor("_Color", color);
		val.SetColor("_EmColor", glow ? color : Color.black);
		if (val.HasProperty("_MainTex"))
		{
			val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture);
		}
		if (val.HasProperty("_EmTex"))
		{
			val.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture);
		}
		if (val.HasProperty("_EmPower"))
		{
			val.SetFloat("_EmPower", glow ? 2f : 0f);
		}
		if (val.HasProperty("_NormalStrength"))
		{
			val.SetFloat("_NormalStrength", 0f);
		}
		if (val.HasProperty("_DiffuseBoost"))
		{
			val.SetFloat("_DiffuseBoost", 0.8f);
		}
		if (val.HasProperty("_RimStrength"))
		{
			val.SetFloat("_RimStrength", 0.15f);
		}
		if (val.HasProperty("_SpecularColor"))
		{
			val.SetColor("_SpecularColor", new Color(0.18f, 0.16f, 0.14f));
		}
		if (val.HasProperty("_SpecularTint"))
		{
			val.SetColor("_SpecularTint", new Color(0.6f, 0.58f, 0.54f));
		}
		if (val.HasProperty("_SpecularExponent"))
		{
			val.SetFloat("_SpecularExponent", 24f);
		}
		return val;
	}

	private static Texture2D SurfaceTexture(string name)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		if (surfaces.TryGetValue(name, out var value))
		{
			return value;
		}
		string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "textures", name + ".png");
		value = new Texture2D(1024, 1024, (TextureFormat)3, true);
		if (File.Exists(path))
		{
			ImageConversion.LoadImage(value, File.ReadAllBytes(path));
		}
		((Texture)value).wrapMode = (TextureWrapMode)0;
		((Texture)value).filterMode = (FilterMode)2;
		((Texture)value).anisoLevel = 2;
		((Object)value).name = "Doctrine" + name;
		surfaces[name] = value;
		return value;
	}

	internal static void BuildModel(CharacterModel model, bool display = false)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Expected O, but got Unknown
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0599: Unknown result type (might be due to invalid IL or missing references)
		//IL_059e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_061b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0795: Unknown result type (might be due to invalid IL or missing references)
		//IL_079c: Expected O, but got Unknown
		//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0803: Unknown result type (might be due to invalid IL or missing references)
		//IL_0808: Unknown result type (might be due to invalid IL or missing references)
		//IL_0895: Unknown result type (might be due to invalid IL or missing references)
		//IL_089c: Expected O, but got Unknown
		//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0936: Unknown result type (might be due to invalid IL or missing references)
		//IL_0954: Unknown result type (might be due to invalid IL or missing references)
		//IL_0961: Unknown result type (might be due to invalid IL or missing references)
		//IL_0963: Unknown result type (might be due to invalid IL or missing references)
		//IL_0973: Unknown result type (might be due to invalid IL or missing references)
		//IL_098b: Unknown result type (might be due to invalid IL or missing references)
		//IL_098d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0712: Unknown result type (might be due to invalid IL or missing references)
		Animator component = ((Component)model).GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.runtimeAnimatorController = Addressables.LoadAssetAsync<RuntimeAnimatorController>((object)"RoR2/Base/Commando/animCommando.controller").WaitForCompletion();
			component.cullingMode = (AnimatorCullingMode)0;
			((Behaviour)component).enabled = true;
			if (!Object.op_Implicit((Object)(object)component.runtimeAnimatorController))
			{
				throw new InvalidOperationException("Failed to load Doctrine animation controller.");
			}
			Plugin.Log("Doctrine animator " + ((Object)component.runtimeAnimatorController).name + ", display=" + display);
		}
		cube = PrimitiveMesh((PrimitiveType)3);
		sphere = ModelGeometry.Sphere();
		cylinder = PrimitiveMesh((PrimitiveType)2);
		SkinnedMeshRenderer componentInChildren = ((Component)model).GetComponentInChildren<SkinnedMeshRenderer>();
		if (!Object.op_Implicit((Object)(object)componentInChildren))
		{
			throw new InvalidOperationException("Survivor rig has no skinned mesh.");
		}
		List<Transform> list = componentInChildren.bones.ToList();
		Transform val = list.First((Transform b) => ((Object)b).name == "chest");
		int[] array = new int[2] { -1, 1 };
		foreach (int num2 in array)
		{
			Transform transform = new GameObject((num2 < 0) ? "DoctrineCapeL" : "DoctrineCapeR").transform;
			transform.SetParent(val, false);
			transform.position = val.position + ((Component)model).transform.TransformVector(new Vector3((float)num2 * 0.22f, 0.16f, -0.16f));
			transform.rotation = ((Component)model).transform.rotation;
			list.Add(transform);
		}
		string[] array2 = new string[2] { "DoctrineCapeMid", "DoctrineCapeHem" };
		foreach (string text in array2)
		{
			Transform transform2 = new GameObject(text).transform;
			transform2.SetParent(val, false);
			transform2.position = val.position + ((Component)model).transform.TransformVector(new Vector3(0f, (text == "DoctrineCapeMid") ? (-0.35f) : (-0.75f), -0.21f));
			transform2.rotation = ((Component)model).transform.rotation;
			list.Add(transform2);
		}
		string[] array3 = new string[2] { "l", "r" };
		foreach (string side in array3)
		{
			Transform transform3 = new GameObject((side == "r") ? "DoctrineStaffGrip" : "DoctrineLeftGrip").transform;
			Transform val2 = list.First((Transform b) => ((Object)b).name == "hand." + side);
			transform3.SetParent(val2, false);
			transform3.position = val2.position + ((Component)model).transform.TransformVector(new Vector3(0f, -0.075f, 0.025f));
			transform3.rotation = ((Component)model).transform.rotation;
			list.Add(transform3);
		}
		Transform[] array4 = list.ToArray();
		Plugin.Log("Doctrine rig bones: " + string.Join(",", array4.Select((Transform b) => ((Object)b).name).ToArray()));
		Shader val3 = Shader.Find("Hopoo Games/Deferred/Standard");
		if (!Object.op_Implicit((Object)(object)val3))
		{
			throw new InvalidOperationException("No supported character shader is loaded.");
		}
		Material val4 = ((Renderer)componentInChildren).sharedMaterial;
		if (!Object.op_Implicit((Object)(object)val4))
		{
			val4 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Commando/matCommandoDualies.mat").WaitForCompletion();
		}
		Material val5 = (Object.op_Implicit((Object)(object)val4) ? new Material(val4) : new Material(val3));
		Plugin.Log("Doctrine shader: " + ((Object)val5.shader).name);
		Material[] array5 = (Material[])(object)new Material[8]
		{
			Mat(val5, new Color(0.07f, 0.06f, 0.08f), glow: false),
			Mat(val5, new Color(0.65f, 0.45f, 0.2f), glow: false),
			Mat(val5, Pink, glow: true),
			Mat(val5, new Color(0.31f, 0.17f, 0.12f), glow: false),
			Mat(val5, new Color(0.85f, 0.81f, 0.7f), glow: false),
			Mat(val5, new Color(0.035f, 0.022f, 0.02f), glow: false),
			Mat(val5, new Color(0.8f, 0.055f, 0.4f), glow: false),
			Mat(val5, new Color(0.48f, 0.32f, 0.14f), glow: false)
		};
		MeshMaker meshMaker = new MeshMaker(((Component)model).transform, array4);
		int bone = meshMaker.Find("head");
		int bone2 = meshMaker.Find("chest", "spine2", "spine.002", "spine");
		int bone3 = meshMaker.Find("pelvis", "hips", "base");
		Vector3 val6 = meshMaker.Position(bone);
		meshMaker.Position(bone2);
		meshMaker.Position(bone3);
		TailoredModel.Build(meshMaker, array4, sphere, cube, display);
		meshMaker.ResizeBoneGeometry(bone, val6 + Vector3.down * 0.09f, new Vector3(0.94f, 0.88f, 0.94f));
		int bone4 = meshMaker.Find("hand.r");
		meshMaker.Position(bone4);
		for (int num5 = 0; num5 < array5.Length; num5++)
		{
			if (num5 == 0 || num5 == 6)
			{
				array5[num5].SetTexture("_MainTex", (Texture)(object)SurfaceTexture("cloth"));
				if (array5[num5].HasProperty("_SpecularStrength"))
				{
					array5[num5].SetFloat("_SpecularStrength", 0.08f);
				}
			}
			if (num5 == 1 || num5 == 7)
			{
				array5[num5].SetTexture("_MainTex", (Texture)(object)SurfaceTexture("metal"));
				array5[num5].EnableKeyword("FORCE_SPEC");
				array5[num5].SetFloat("_ForceSpecOn", 1f);
				array5[num5].SetFloat("_SpecularStrength", (num5 == 1) ? 0.55f : 0.45f);
				array5[num5].SetFloat("_SpecularExponent", (num5 == 1) ? 4f : 3.5f);
				array5[num5].SetColor("_SpecularTint", new Color(0.85f, 0.73f, 0.52f));
				if (array5[num5].HasProperty("_Smoothness"))
				{
					array5[num5].SetFloat("_Smoothness", 0.55f);
				}
				array5[num5].SetFloat("_RimStrength", 0.3f);
			}
			if (num5 == 2 && array5[num5].HasProperty("_EmPower"))
			{
				array5[num5].SetFloat("_EmPower", 0.8f);
			}
		}
		GameObject val7 = new GameObject("DoctrineScepterTip");
		val7.transform.SetParent(array4[meshMaker.Find("doctrinestaffgrip")], false);
		val7.transform.position = ((Component)model).transform.TransformPoint(meshMaker.Position(meshMaker.Find("doctrinestaffgrip")) + Vector3.up * 0.55f);
		Mesh source = meshMaker.Finish(array5.Length);
		Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<Renderer>();
		foreach (Renderer val8 in componentsInChildren)
		{
			if (val8 is SkinnedMeshRenderer || val8 is MeshRenderer)
			{
				val8.enabled = false;
			}
		}
		RendererInfo[] array6 = (RendererInfo[])(object)new RendererInfo[array5.Length];
		MeshReplacement[] array7 = (MeshReplacement[])(object)new MeshReplacement[array5.Length];
		for (int num7 = 0; num7 < array5.Length; num7++)
		{
			Mesh val9 = ModelGeometry.Compact(source, num7);
			GameObject val10 = new GameObject("DoctrineOriginalModel" + num7);
			val10.transform.SetParent(((Component)model).transform, false);
			SkinnedMeshRenderer val11 = val10.AddComponent<SkinnedMeshRenderer>();
			val11.sharedMesh = val9;
			val11.bones = array4;
			val11.rootBone = componentInChildren.rootBone;
			((Renderer)val11).sharedMaterial = array5[num7];
			((Renderer)val11).localBounds = new Bounds(Vector3.up, Vector3.one * 6f);
			val11.updateWhenOffscreen = true;
			if (num7 == 0)
			{
				AccessTools.Field(typeof(CharacterModel), "mainSkinnedMeshRenderer").SetValue(model, val11);
			}
			ref RendererInfo reference = ref array6[num7];
			reference = new RendererInfo
			{
				renderer = (Renderer)(object)val11,
				defaultMaterial = array5[num7],
				defaultShadowCastingMode = (ShadowCastingMode)1,
				ignoreOverlays = false
			};
			ref MeshReplacement reference2 = ref array7[num7];
			reference2 = new MeshReplacement
			{
				renderer = (Renderer)(object)val11,
				mesh = val9
			};
		}
		model.baseRendererInfos = array6;
		ModelSkinController component2 = ((Component)model).GetComponent<ModelSkinController>();
		if (Object.op_Implicit((Object)(object)component2))
		{
			Object.DestroyImmediate((Object)(object)component2);
		}
		SkinDef val12 = ScriptableObject.CreateInstance<SkinDef>();
		((Object)val12).name = "DoctrineDefaultSkin";
		val12.nameToken = "DOCTRINE_NAME";
		val12.icon = Plugin.Icons[5];
		val12.rootObject = ((Component)model).gameObject;
		val12.baseSkins = (SkinDef[])(object)new SkinDef[0];
		val12.skinDefParams = ScriptableObject.CreateInstance<SkinDefParams>();
		((Object)val12.skinDefParams).name = "DoctrineDefaultSkinParams";
		val12.skinDefParams.rendererInfos = model.baseRendererInfos;
		val12.skinDefParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0];
		val12.skinDefParams.meshReplacements = array7;
		((Component)model).gameObject.AddComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { val12 };
		((Component)model).gameObject.AddComponent<OrbitingDrones>();
		DoctrinePose doctrinePose = ((Component)model).gameObject.AddComponent<DoctrinePose>();
		doctrinePose.DisplayOnly = display;
		if (display && Object.op_Implicit((Object)(object)component))
		{
			((Behaviour)component).enabled = false;
			component.runtimeAnimatorController = null;
			Plugin.Log("Doctrine display: native entrance disabled; custom turning cape entrance");
		}
	}

	internal static GameObject MakeDrone()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0547: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Expected O, but got Unknown
		//IL_00cd: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: 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_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_046a: Unknown result type (might be due to invalid IL or missing references)
		//IL_046f: 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_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04df: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Expected O, but got Unknown
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: 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_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: 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_02ec: 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_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)droneGold))
		{
			Material val = new Material(Shader.Find("Hopoo Games/Deferred/Standard"));
			droneGold = Mat(val, new Color(0.95f, 0.62f, 0.18f), glow: true);
			dronePink = Mat(val, Pink, glow: true);
			droneBlack = Mat(val, new Color(0.045f, 0.025f, 0.075f), glow: false);
			Object.Destroy((Object)(object)val);
		}
		if (!Object.op_Implicit((Object)(object)droneWing))
		{
			List<Vector3> list = new List<Vector3>();
			List<int>[] array = new List<int>[3]
			{
				new List<int>(),
				new List<int>(),
				new List<int>()
			};
			Vector3[] array2 = (Vector3[])(object)new Vector3[7]
			{
				new Vector3(0.04f, 0f, 0.1f),
				new Vector3(0.26f, 0.04f, 0.19f),
				new Vector3(0.62f, -0.015f, -0.06f),
				new Vector3(0.28f, -0.02f, -0.025f),
				new Vector3(0.1f, 0f, -0.2f),
				new Vector3(0.23f, 0.1f, 0f),
				new Vector3(0.23f, -0.045f, 0f)
			};
			int[] array3 = new int[30]
			{
				0, 1, 5, 1, 2, 5, 2, 3, 5, 3,
				4, 5, 4, 0, 5, 1, 0, 6, 2, 1,
				6, 3, 2, 6, 4, 3, 6, 0, 4, 6
			};
			for (int i = -1; i <= 1; i += 2)
			{
				int count = list.Count;
				Vector3[] array4 = array2;
				for (int j = 0; j < array4.Length; j++)
				{
					Vector3 val2 = array4[j];
					list.Add(new Vector3(val2.x * (float)i, val2.y * (float)i, val2.z));
				}
				int[] array5 = array3;
				foreach (int num in array5)
				{
					array[0].Add(count + num);
				}
				for (int l = 0; l < 4; l++)
				{
					Vector3 val3 = array2[l];
					Vector3 val4 = array2[l + 1];
					((Vector3)(ref val3))..ctor(val3.x * (float)i, val3.y * (float)i + 0.016f, val3.z);
					((Vector3)(ref val4))..ctor(val4.x * (float)i, val4.y * (float)i + 0.016f, val4.z);
					Vector3 val5 = Vector3.Cross(val4 - val3, Vector3.up);
					Vector3 val6 = ((Vector3)(ref val5)).normalized * 0.012f;
					int count2 = list.Count;
					list.Add(val3 - val6);
					list.Add(val3 + val6);
					list.Add(val4 + val6);
					list.Add(val4 - val6);
					List<int> list2 = array[(l < 2) ? 1 : 2];
					list2.AddRange(new int[12]
					{
						count2,
						count2 + 1,
						count2 + 2,
						count2,
						count2 + 2,
						count2 + 3,
						count2 + 2,
						count2 + 1,
						count2,
						count2 + 3,
						count2 + 2,
						count2
					});
				}
			}
			int count3 = list.Count;
			list.AddRange((IEnumerable<Vector3>)(object)new Vector3[6]
			{
				Vector3.up * 0.07f,
				Vector3.down * 0.07f,
				Vector3.right * 0.07f,
				Vector3.forward * 0.07f,
				Vector3.left * 0.07f,
				Vector3.back * 0.07f
			});
			for (int m = 0; m < 4; m++)
			{
				int num2 = (m + 1) % 4;
				array[2].AddRange(new int[6]
				{
					count3,
					count3 + 2 + m,
					count3 + 2 + num2,
					count3 + 1,
					count3 + 2 + num2,
					count3 + 2 + m
				});
			}
			droneWing = new Mesh();
			((Object)droneWing).name = "DoctrineSharedDrone";
			droneWing.SetVertices(list);
			droneWing.subMeshCount = 3;
			for (int n = 0; n < 3; n++)
			{
				droneWing.SetTriangles(array[n], n);
			}
			droneWing.RecalculateNormals();
			droneWing.RecalculateBounds();
		}
		GameObject val7 = new GameObject("DoctrineWingDrone");
		val7.AddComponent<MeshFilter>().sharedMesh = droneWing;
		MeshRenderer val8 = val7.AddComponent<MeshRenderer>();
		((Renderer)val8).sharedMaterials = (Material[])(object)new Material[3] { droneBlack, droneGold, dronePink };
		((Renderer)val8).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)val8).receiveShadows = false;
		return val7;
	}

	internal static Material EnergyMaterial(Color color)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(Shader.Find("Hopoo Games/Deferred/Standard"));
		Material result = Mat(val, color, glow: true);
		Object.Destroy((Object)(object)val);
		return result;
	}

	internal static void Beam(Vector3 from, Vector3 to, float width, Color color)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		if (!Application.isBatchMode)
		{
			if (!Object.op_Implicit((Object)(object)beamMaterial))
			{
				Material val = new Material(Shader.Find("Hopoo Games/Deferred/Standard"));
				beamMaterial = Mat(val, Pink, glow: true);
				Object.Destroy((Object)(object)val);
			}
			GameObject val2 = new GameObject("DoctrineBeam");
			LineRenderer val3 = val2.AddComponent<LineRenderer>();
			((Renderer)val3).sharedMaterial = beamMaterial;
			val3.positionCount = 2;
			val3.SetPosition(0, from);
			val3.SetPosition(1, to);
			val3.startWidth = width;
			val3.endWidth = width * 0.7f;
			val3.startColor = color;
			val3.endColor = color;
			Object.Destroy((Object)(object)val2, 0.14f);
		}
	}

	internal static void Pulse(Vector3 pos, float radius, Color color)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0025: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		if (!Application.isBatchMode)
		{
			if (!Object.op_Implicit((Object)(object)beamMaterial))
			{
				Material val = new Material(Shader.Find("Hopoo Games/Deferred/Standard"));
				beamMaterial = Mat(val, Pink, glow: true);
				Object.Destroy((Object)(object)val);
			}
			GameObject val2 = new GameObject("DoctrinePulse");
			LineRenderer val3 = val2.AddComponent<LineRenderer>();
			((Renderer)val3).sharedMaterial = beamMaterial;
			val3.positionCount = 49;
			val3.startWidth = 0.04f;
			val3.endWidth = 0.04f;
			val3.startColor = color;
			val3.endColor = color;
			for (int i = 0; i < 49; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 48f;
				val3.SetPosition(i, pos + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius);
			}
			Object.Destroy((Object)(object)val2, 0.22f);
		}
	}
}
internal sealed class MeshMaker
{
	private readonly Transform model;

	private readonly Transform[] bones;

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

	private readonly List<Vector2> uvs = new List<Vector2>();

	private readonly List<BoneWeight> weights = new List<BoneWeight>();

	private readonly List<int>[] triangles = new List<int>[8];

	internal MeshMaker(Transform model, Transform[] bones)
	{
		this.model = model;
		this.bones = bones;
		for (int i = 0; i < triangles.Length; i++)
		{
			triangles[i] = new List<int>();
		}
	}

	internal int Find(params string[] names)
	{
		foreach (string text in names)
		{
			for (int j = 0; j < bones.Length; j++)
			{
				if (((Object)bones[j]).name.ToLowerInvariant() == text)
				{
					return j;
				}
			}
		}
		foreach (string value in names)
		{
			for (int l = 0; l < bones.Length; l++)
			{
				if (((Object)bones[l]).name.ToLowerInvariant().Contains(value))
				{
					return l;
				}
			}
		}
		return 0;
	}

	internal Vector3 Position(int bone)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		return model.InverseTransformPoint(bones[bone].position);
	}

	internal void Shape(Mesh primitive, Vector3 center, Vector3 scale, Quaternion rotation, int bone, int material)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		int count = vertices.Count;
		Vector3[] array = primitive.vertices;
		Vector2[] uv = primitive.uv;
		for (int i = 0; i < array.Length; i++)
		{
			vertices.Add(center + rotation * Vector3.Scale(array[i], scale));
			uvs.Add((uv.Length == array.Length) ? uv[i] : Vector2.zero);
			List<BoneWeight> list = weights;
			BoneWeight item = default(BoneWeight);
			((BoneWeight)(ref item)).boneIndex0 = bone;
			((BoneWeight)(ref item)).weight0 = 1f;
			list.Add(item);
		}
		int[] array2 = primitive.triangles;
		for (int j = 0; j < array2.Length; j += 3)
		{
			triangles[material].Add(array2[j] + count);
			triangles[material].Add(array2[j + ((!(scale.x * scale.y * scale.z < 0f)) ? 1 : 2)] + count);
			triangles[material].Add(array2[j + ((scale.x * scale.y * scale.z < 0f) ? 1 : 2)] + count);
		}
	}

	internal void Segment(Vector3 from, Vector3 to, float width, int bone, int material)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
		Mesh sharedMesh = val.GetComponent<MeshFilter>().sharedMesh;
		Vector3 center = (from + to) * 0.5f;
		Vector3 val2 = to - from;
		Shape(sharedMesh, center, new Vector3(width, ((Vector3)(ref val2)).magnitude * 0.5f, width), Quaternion.FromToRotation(Vector3.up, to - from), bone, material);
		Object.DestroyImmediate((Object)(object)val);
	}

	internal void Cape(Vector3 chest, Vector3 pelvis, int centreBone, int leftBone, int rightBone)
	{
		//IL_0034: 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_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: 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)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		int boneIndex = Find("doctrinecapemid");
		int boneIndex2 = Find("doctrinecapehem");
		Vector3 val = chest + new Vector3(0f, 0.2f, -0.12f);
		float num = pelvis.y - 0.87f;
		for (int i = 0; i < 2; i++)
		{
			int count = vertices.Count;
			for (int j = 0; j <= 12; j++)
			{
				for (int k = 0; k <= 16; k++)
				{
					float num2 = (float)j / 12f;
					float num3 = (float)k / 16f * 2f - 1f;
					float num4 = Mathf.Lerp(0.3f, 0.44f, Mathf.SmoothStep(0f, 1f, num2));
					float num5 = 0.023f * Mathf.Sin((num3 + 1f) * (float)Math.PI * 3f) * Mathf.Sin(num2 * (float)Math.PI * 0.5f);
					vertices.Add(new Vector3(val.x + num3 * num4, Mathf.Lerp(val.y, num, num2) + 0.045f * num3 * num3 * num2, Mathf.Lerp(val.z, pelvis.z - 0.34f, num2) + num5 + ((i == 1) ? 0.006f : 0f)));
					uvs.Add(new Vector2((num3 + 1f) * 0.5f, num2));
					float num6 = Mathf.SmoothStep(0f, 1f, Mathf.Abs(num3)) * 0.7f * Mathf.SmoothStep(0f, 1f, num2);
					List<BoneWeight> list = weights;
					BoneWeight item = default(BoneWeight);
					((BoneWeight)(ref item)).boneIndex0 = centreBone;
					((BoneWeight)(ref item)).weight