Decompiled source of KayokoBandit v1.0.0

KayokoBandit.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Generics.Dynamics;
using MonoMod.RuntimeDetour.HookGen;
using MwSkinAdditions;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace KayokoBandit;

[BepInPlugin("com.Miyowi.KayokoBandit", "KayokoBandit", "1.0.0")]
public class KayokoBanditPlugin : BaseUnityPlugin
{
	private static AssetBundle assetBundle;

	private static readonly List<Material> materialsWithRoRShader = new List<Material>();

	private static EventSub eventSub;

	private static SkinDef[] skins = (SkinDef[])(object)new SkinDef[2];

	internal static KayokoBanditPlugin Instance { get; private set; }

	internal static ManualLogSource InstanceLogger
	{
		get
		{
			KayokoBanditPlugin instance = Instance;
			if (instance == null)
			{
				return null;
			}
			return ((BaseUnityPlugin)instance).Logger;
		}
	}

	private void Start()
	{
		Instance = this;
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("KayokoBandit.miyowikayokobandit"))
		{
			assetBundle = AssetBundle.LoadFromStream(stream);
		}
		((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit);
		HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LanguageLoadStrings));
		ReplaceShaders();
		AfterStart();
	}

	private void AfterStart()
	{
		Options.Init(assetBundle);
	}

	private static void AfterBodyCatalogInit()
	{
		eventSub.skinDefs = skins;
		EventSub obj = eventSub;
		obj.SkinAppliedRun = (Action<GameObject>)Delegate.Combine(obj.SkinAppliedRun, (Action<GameObject>)delegate(GameObject body)
		{
			ModelLocator val = default(ModelLocator);
			InverseKinematics val2 = default(InverseKinematics);
			if (body.TryGetComponent<ModelLocator>(ref val) && Object.op_Implicit((Object)(object)val.modelTransform) && ((Component)val.modelTransform).TryGetComponent<InverseKinematics>(ref val2))
			{
				((Behaviour)val2).enabled = false;
			}
		});
		eventSub.Init();
	}

	private static void ReplaceShaders()
	{
		LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/SkinAssets/KayokoBandit/matKayokoBandit.mat", "Assets/SkinAssets/KayokoBandit/matKayokoPistol.mat", "Assets/SkinAssets/KayokoBandit/matHarukaShotgun.mat");
	}

	private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		Shader shader = Addressables.LoadAssetAsync<Shader>((object)shaderPath).WaitForCompletion();
		foreach (string text in materialPaths)
		{
			Material val = assetBundle.LoadAsset<Material>(text);
			val.shader = shader;
			materialsWithRoRShader.Add(val);
		}
	}

	private static void LanguageLoadStrings(Action<Language> orig, Language self)
	{
		orig(self);
		self.SetStringByToken("MIYOWI_SKIN_DEFKAYOKOBANDIT_NAME", "Onikata Kayoko");
	}

	private static void BodyCatalogInit()
	{
		AddBandit2BodyDefKayokoBanditSkin();
		AfterBodyCatalogInit();
	}

	private static void Bandit2BodyDefKayokoBanditSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
	{
		skins[0] = skinDef;
		CustomIDRS.Init(skinDef);
	}

	private static SkinDef CreateBandit2BodyDefKayokoBanditSkin(GameObject mdl, ModelSkinController skinController)
	{
		Renderer[] renderers = mdl.GetComponentsInChildren<Renderer>(true);
		mdl.GetComponentsInChildren<Light>(true);
		List<string> skinnedRendererPaths = new List<string>();
		Renderer[] array = renderers;
		foreach (Renderer val in array)
		{
			if (val is SkinnedMeshRenderer)
			{
				skinnedRendererPaths.Add(Util.BuildPrefabTransformPath(mdl.transform, ((Component)val).transform, false, false));
			}
		}
		SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
		SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
		skin.skinDefParams = skinParams;
		((Object)skin).name = "DefKayokoBandit";
		skin.nameToken = "MIYOWI_SKIN_DEFKAYOKOBANDIT_NAME";
		skin.rootObject = mdl;
		Helpers.TryCatchThrow("Icon", delegate
		{
			skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\KayokoBandit\\Icons\\DefKayokoBanditIcon.png");
		});
		Helpers.TryCatchThrow("Unlockable Name", delegate
		{
			skin.unlockableDef = null;
		});
		Helpers.TryCatchThrow("Base Skins", delegate
		{
			skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { Helpers.ThrowIfOutOfBounds(0, "Index 0 is out of bounds of skins array", skinController.skins, 0) };
		});
		Helpers.TryCatchThrow("Game Object Activations", delegate
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2]
			{
				new GameObjectActivation
				{
					gameObject = ((Component)Helpers.ThrowIfNull<Transform>(0, "There is no renderer at path \"BanditArmature/ROOT/base/pelvis\"", mdl.transform.Find("BanditArmature/ROOT/base/pelvis"))).gameObject,
					shouldActivate = false,
					spawnPrefabOnModelObject = true,
					localPosition = new Vector3(-0.2383288f, 0.09758133f, 0.09814335f),
					localRotation = new Vector3(40.83168f, 269.053f, 351.2962f),
					localScale = new Vector3(0.9999999f, 1f, 0.9999999f),
					prefab = Helpers.ClonePrefab(assetBundle.LoadAsset<GameObject>("Assets/SkinAssets/KayokoBandit/Prefabs/skirtwing1.prefab")).WithComponent<InsertBones>((Action<InsertBones>)delegate(InsertBones c)
					{
						c.rendererPaths.AddRange(skinnedRendererPaths);
						c.afterPath = "BanditArmature/ROOT/base/pelvis/thigh.r/calf.r/foot.r/toe.r";
						Transform transform = ((Component)c).transform;
						c.newBones.Add(transform);
						c.newBones.Add(transform.GetChild(0, out var child));
						c.newBones.Add(child.GetChild(0, out var _));
					})
				},
				new GameObjectActivation
				{
					gameObject = ((Component)Helpers.ThrowIfNull<Transform>(1, "There is no renderer at path \"BanditArmature/ROOT/base/stomach/chest/head\"", mdl.transform.Find("BanditArmature/ROOT/base/stomach/chest/head"))).gameObject,
					shouldActivate = false,
					spawnPrefabOnModelObject = true,
					localPosition = new Vector3(0.001271706f, 0.09824228f, -0.0001838107f),
					localRotation = new Vector3(33.63976f, 8.995358f, 5.545192f),
					localScale = new Vector3(1f, 1f, 1f),
					prefab = Helpers.ClonePrefab(assetBundle.LoadAsset<GameObject>("Assets/SkinAssets/KayokoBandit/Prefabs/HeadModifications.prefab")).WithComponent<InsertBones>((Action<InsertBones>)delegate(InsertBones c)
					{
						c.rendererPaths.AddRange(skinnedRendererPaths);
						c.afterPath = "BanditArmature/ROOT/base/stomach/chest/head/hat";
						Transform transform = ((Component)c).transform;
						c.newBones.Add(transform);
						c.newBones.Add(transform.GetChild(0, out var child));
						c.newBones.Add(child.GetChild(0, out var child2));
						c.newBones.Add(child2.GetChild(0, out var child3));
						c.newBones.Add(child3.GetChild(0, out var _));
						c.newBones.Add(transform.GetChild(2, out var child5));
						c.newBones.Add(child5.GetChild(0, out var child6));
						c.newBones.Add(child6.GetChild(0, out var _));
						c.newBones.Add(transform.GetChild(1, out var child8));
						c.newBones.Add(child8.GetChild(0, out var child9));
						c.newBones.Add(child9.GetChild(0, out var _));
						c.newBones.Add(transform.GetChild(3, out var child11));
						c.newBones.Add(child11.GetChild(0, out var child12));
						c.newBones.Add(child12.GetChild(0, out var _));
						c.newBones.Add(transform.GetChild(4, out var child14));
						c.newBones.Add(child14.GetChild(0, out var child15));
						c.newBones.Add(child15.GetChild(0, out var child16));
						c.newBones.Add(child16.GetChild(0, out var _));
						c.newBones.Add(child15.GetChild(1, out var child18));
						c.newBones.Add(child18.GetChild(0, out var child19));
						c.newBones.Add(child19.GetChild(0, out var _));
					})
				}
			};
		});
		Helpers.TryCatchThrow("Renderer Infos", delegate
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: 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_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[8]
			{
				new RendererInfo
				{
					defaultMaterial = assetBundle.LoadAsset<Material>("Assets/SkinAssets/KayokoBandit/matKayokoBandit.mat"),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false,
					renderer = Helpers.ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Bandit2BodyMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2BodyMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = null,
					defaultShadowCastingMode = (ShadowCastingMode)0,
					ignoreOverlays = true,
					renderer = Helpers.ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Bandit2AccessoriesMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2AccessoriesMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = null,
					defaultShadowCastingMode = (ShadowCastingMode)0,
					ignoreOverlays = true,
					renderer = Helpers.ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Bandit2CoatMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2CoatMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = null,
					defaultShadowCastingMode = (ShadowCastingMode)0,
					ignoreOverlays = true,
					renderer = Helpers.ThrowIfNull<Renderer>(3, "There is no renderer with the name \"Bandit2HatMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2HatMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = null,
					defaultShadowCastingMode = (ShadowCastingMode)0,
					ignoreOverlays = true,
					renderer = Helpers.ThrowIfNull<Renderer>(4, "There is no renderer with the name \"Bandit2ArmsMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2ArmsMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = null,
					defaultShadowCastingMode = (ShadowCastingMode)0,
					ignoreOverlays = true,
					renderer = Helpers.ThrowIfNull<Renderer>(5, "There is no renderer with the name \"Bandit2ArmsMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2ArmsMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = assetBundle.LoadAsset<Material>("Assets/SkinAssets/KayokoBandit/matKayokoPistol.mat"),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false,
					renderer = Helpers.ThrowIfNull<Renderer>(6, "There is no renderer with the name \"BanditPistolMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "BanditPistolMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				},
				new RendererInfo
				{
					defaultMaterial = assetBundle.LoadAsset<Material>("Assets/SkinAssets/KayokoBandit/matHarukaShotgun.mat"),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false,
					renderer = Helpers.ThrowIfNull<Renderer>(7, "There is no renderer with the name \"BanditShotgunMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "BanditShotgunMesh"))),
					hideOnDeath = false,
					ignoresMaterialOverrides = false
				}
			};
		});
		Helpers.TryCatchThrow("MeshReplacements", delegate
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[3]
			{
				new MeshReplacement
				{
					mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\KayokoBandit\\Meshes\\KayokoBody.mesh"),
					renderer = Helpers.ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Bandit2BodyMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Bandit2BodyMesh")))
				},
				new MeshReplacement
				{
					mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\KayokoBandit\\Meshes\\KayokoPistol.mesh"),
					renderer = Helpers.ThrowIfNull<Renderer>(1, "There is no renderer with the name \"BanditPistolMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "BanditPistolMesh")))
				},
				new MeshReplacement
				{
					mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\KayokoBandit\\Meshes\\HarukaShotgun.mesh"),
					renderer = Helpers.ThrowIfNull<Renderer>(2, "There is no renderer with the name \"BanditShotgunMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "BanditShotgunMesh")))
				}
			};
		});
		Helpers.TryCatchThrow("Light Infos", delegate
		{
			skinParams.lightReplacements = Array.Empty<LightInfo>();
		});
		Helpers.TryCatchThrow("Minion Skin Replacements", delegate
		{
			skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
		});
		Helpers.TryCatchThrow("Projectile Ghost Replacements", delegate
		{
			skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
		});
		return skin;
	}

	private static void Bandit2BodyDefKayokoBanditLobbySkinAdded(SkinDef skinDef, GameObject displayPrefab)
	{
		skins[1] = skinDef;
	}

	private static void AddBandit2BodyDefKayokoBanditSkin()
	{
		string text = "Bandit2Body";
		string text2 = "DefKayokoBandit";
		GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(text);
		if (!Object.op_Implicit((Object)(object)bodyPrefab))
		{
			InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
			return;
		}
		try
		{
			ModelLocator component = bodyPrefab.GetComponent<ModelLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
				return;
			}
			GameObject gameObject = ((Component)component.modelTransform).gameObject;
			ModelSkinController val = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
				return;
			}
			SkinDef val2 = CreateBandit2BodyDefKayokoBanditSkin(gameObject, val);
			Array.Resize(ref val.skins, val.skins.Length + 1);
			val.skins[val.skins.Length - 1] = val2;
			Bandit2BodyDefKayokoBanditSkinAdded(val2, bodyPrefab);
		}
		catch (FieldException ex)
		{
			if (ex.InnerException is ElementException ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
				InstanceLogger.LogWarning((object)ex2.Message);
				InstanceLogger.LogError((object)ex.InnerException);
			}
			else
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
				InstanceLogger.LogError((object)ex.InnerException);
			}
		}
		catch (Exception ex3)
		{
			InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
			InstanceLogger.LogError((object)ex3);
		}
		try
		{
			SurvivorDef val3 = ((IEnumerable<SurvivorDef>)ContentManager.survivorDefs).FirstOrDefault((Func<SurvivorDef, bool>)((SurvivorDef d) => (Object)(object)d.bodyPrefab == (Object)(object)bodyPrefab));
			if (!Object.op_Implicit((Object)(object)val3))
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\" because SurvivorDef doesn't exist"));
				return;
			}
			GameObject displayPrefab = val3.displayPrefab;
			ModelSkinController componentInChildren = displayPrefab.GetComponentInChildren<ModelSkinController>();
			if (!Object.op_Implicit((Object)(object)componentInChildren))
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
			}
			else
			{
				SkinDef val4 = CreateBandit2BodyDefKayokoBanditSkin(((Component)componentInChildren).gameObject, componentInChildren);
				Array.Resize(ref componentInChildren.skins, componentInChildren.skins.Length + 1);
				componentInChildren.skins[^1] = val4;
				Bandit2BodyDefKayokoBanditLobbySkinAdded(val4, displayPrefab);
			}
		}
		catch (FieldException ex4)
		{
			if (ex4.InnerException is ElementException ex5)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\""));
				InstanceLogger.LogWarning((object)$"Field causing issue: {ex4.Message}, element: {ex5.Index}");
				InstanceLogger.LogWarning((object)ex5.Message);
				InstanceLogger.LogError((object)ex4.InnerException);
			}
			else
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\""));
				InstanceLogger.LogWarning((object)("Field causing issue: " + ex4.Message));
				InstanceLogger.LogError((object)ex4.InnerException);
			}
		}
		catch (Exception ex6)
		{
			InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\""));
			InstanceLogger.LogError((object)ex6);
		}
	}

	private void Awake()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		eventSub = new EventSub();
		VoiceLines.Init(eventSub);
		BoneTransformations.Init(eventSub);
		Expressions.Init(eventSub);
	}
}
public static class BoneTransformations
{
	private static int cachedSideWeaponLayerIndex = -1;

	public static void Init(EventSub eventSub)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Expected O, but got Unknown
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: 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_00f9: Expected O, but got Unknown
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: 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_012b: Expected O, but got Unknown
		//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_0143: Expected O, but got Unknown
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		BoneTransformation val = new BoneTransformation("BanditArmature/SideWeapon", Vector3.one * 0.8f * 0.68f, new Vector3(-0.25f, -0.02f, -0.05f), "BanditArmature/ROOT/base/pelvis");
		val.OnUpdate = (Action<TransformationInstance>)Delegate.Combine(val.OnUpdate, (Action<TransformationInstance>)delegate(TransformationInstance transformation)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)transformation.animator))
			{
				if (cachedSideWeaponLayerIndex < 0 && Object.op_Implicit((Object)(object)Stage.instance))
				{
					cachedSideWeaponLayerIndex = transformation.animator.GetLayerIndex("Body, SideWeapon");
				}
				if (cachedSideWeaponLayerIndex >= 0 && Object.op_Implicit((Object)(object)Stage.instance))
				{
					float layerWeight = transformation.animator.GetLayerWeight(cachedSideWeaponLayerIndex);
					if (layerWeight != 0f)
					{
						if (layerWeight == 1f && !Object.op_Implicit((Object)(object)transformation.relativeBoneOverride))
						{
							transformation.SetRelativeBoneOverrideByPath("BanditArmature/ROOT/base/stomach/chest/clavicle.l/upper_arm.l/lower_arm.l/hand.l");
							transformation.positionOverride = new Vector3(0.02f, 0.15f, -0.02f);
						}
					}
					else if (Object.op_Implicit((Object)(object)transformation.relativeBoneOverride))
					{
						transformation.RemoveAllOverrides();
					}
				}
			}
		});
		eventSub.options.boneTransformations = (BoneTransformation[])(object)new BoneTransformation[7]
		{
			new BoneTransformation("BanditArmature/ROOT/base/stomach/chest/clavicle.l/upper_arm.l", Vector3.one * 0.68f, Vector3.zero, (string)null),
			new BoneTransformation("BanditArmature/ROOT/base/stomach/chest/clavicle.r/upper_arm.r", Vector3.one * 0.68f, Vector3.zero, (string)null),
			val,
			new BoneTransformation("BanditArmature/ROOT/base/MainWeapon", Vector3.one * 0.68f, new Vector3(-0.05f, -0.08f, 0.05f), (TransformContexts)(-2), (string)null),
			new BoneTransformation("BanditArmature/ROOT/base/MainWeapon", Vector3.one * 0.68f, new Vector3(-0.05f, 0.12f, 0.03f), (TransformContexts)1, (string)null),
			new BoneTransformation("BanditArmature/WeaponHandControl.l", Vector3.one, Vector3.zero, (string)null),
			new BoneTransformation("BanditArmature/ROOT", Vector3.one * 0.9f, Vector3.zero, (string)null)
		};
	}
}
public static class CustomIDRS
{
	public static void Init(SkinDef skinDef)
	{
		//IL_0002: 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_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: 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_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: 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_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: 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_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: 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_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: 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_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: 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_0305: 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_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: 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_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: 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_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03af: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: 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_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		DisplayRuleGroup val = new DisplayRuleGroup
		{
			rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_CritGlasses.DisplayGlasses_prefab).WaitForCompletion(),
					childName = "Head",
					localPos = new Vector3(0.00023f, 0.02465f, 0.07836f),
					localAngles = new Vector3(1.83297f, 3.1377f, 358.5649f),
					localScale = new Vector3(0.19176f, 0.21398f, 0.21879f)
				}
			}
		};
		SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_Base_CritGlasses.CritGlasses_asset).WaitForCompletion(), val);
		DisplayRuleGroup val2 = new DisplayRuleGroup
		{
			rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_CritGlassesVoid.DisplayGlassesVoid_prefab).WaitForCompletion(),
					childName = "Head",
					localPos = new Vector3(-1E-05f, 0.02788f, 0.09597f),
					localAngles = new Vector3(10.62503f, 0f, 0f),
					localScale = new Vector3(0.19879f, 0.19657f, 0.19657f)
				}
			}
		};
		SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC1_CritGlassesVoid.CritGlassesVoid_asset).WaitForCompletion(), val2);
		DisplayRuleGroup val3 = new DisplayRuleGroup
		{
			rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Hoof.DisplayHoof_prefab).WaitForCompletion(),
					childName = "CalfR",
					localPos = new Vector3(-0.02411f, 0.31884f, -0.11307f),
					localAngles = new Vector3(75.75327f, 0f, 0f),
					localScale = new Vector3(0.085f, 0.085f, 0.085f)
				},
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)1,
					limbMask = (LimbFlags)8
				}
			}
		};
		SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_Base_Hoof.Hoof_asset).WaitForCompletion(), val3);
		DisplayRuleGroup val4 = new DisplayRuleGroup
		{
			rules = (ItemDisplayRule[])(object)new ItemDisplayRule[3]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_LunarSun.DisplaySunHead_prefab).WaitForCompletion(),
					childName = "Head",
					localPos = new Vector3(0f, 0.04f, 0.046f),
					localAngles = new Vector3(0f, 0f, 0f),
					localScale = new Vector3(0.71441f, 0.71441f, 0.71441f)
				},
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_LunarSun.DisplaySunHeadNeck_prefab).WaitForCompletion(),
					childName = "Chest",
					localPos = new Vector3(-0.01718f, 0.39261f, 0.02185f),
					localAngles = new Vector3(9.30912f, 48.11956f, 16.11147f),
					localScale = new Vector3(0.8135f, 0.8135f, 0.8135f)
				},
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)1,
					limbMask = (LimbFlags)1
				}
			}
		};
		SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC1_LunarSun.LunarSun_asset).WaitForCompletion(), val4);
	}
}
public static class Expressions
{
	public static void Init(EventSub eventSub)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Expected O, but got Unknown
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Expected O, but got Unknown
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		eventSub.options.blinkAnimations = (BlendShapeAnimation[])(object)new BlendShapeAnimation[1] { (BlendShapeAnimation)new BlinkBlendShapeAnimation("Bandit2BodyMesh", "LowBlink", -1, 0, 0.1f, 0f, 0.1f, false) };
		eventSub.options.conditionalIdleAnimations = (IdleAnimation[])(object)new IdleAnimation[2]
		{
			new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[3]
			{
				new BlendShapeAnimation("Bandit2BodyMesh", "EyesAngry", 0, -1, 0.3f, float.PositiveInfinity, 0.3f, false),
				new BlendShapeAnimation("Bandit2BodyMesh", "BrowsLower", 1, -2, 0.3f, float.PositiveInfinity, 0.3f, false),
				new BlendShapeAnimation("Bandit2BodyMesh", "MouthFrown", 2, -2, 0.3f, float.PositiveInfinity, 0.3f, false)
			}, (Func<ExpressionController, bool>)InCombat, true),
			new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[2]
			{
				new BlendShapeAnimation("Bandit2BodyMesh", "LeftHighWink", 0, -1, 0.3f, float.PositiveInfinity, 0.3f, true),
				new BlendShapeAnimation("Bandit2BodyMesh", "BrowsSad", 1, -1, 0.3f, float.PositiveInfinity, 0.3f, false)
			}, (Func<ExpressionController, bool>)LowHealth, true)
		};
		eventSub.options.useAnimations = true;
		eventSub.TakeDamage = (Action<GameObject, DamageReport>)Delegate.Combine(eventSub.TakeDamage, new Action<GameObject, DamageReport>(ExpressionOnHit));
		eventSub.Death = (Action<GameObject>)Delegate.Combine(eventSub.Death, new Action<GameObject>(ExpressionOnDeath));
		eventSub.ShrineFailure = (Action<GameObject>)Delegate.Combine(eventSub.ShrineFailure, new Action<GameObject>(ExpressionOnShrineFailure));
		eventSub.LevelUp = (Action<GameObject>)Delegate.Combine(eventSub.LevelUp, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
		eventSub.MithrixDefeat = (Action<GameObject>)Delegate.Combine(eventSub.MithrixDefeat, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
		eventSub.HoldoutZoneCharged = (Action<GameObject>)Delegate.Combine(eventSub.HoldoutZoneCharged, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
		eventSub.GetItem = (Action<GameObject, ItemIndex>)Delegate.Combine(eventSub.GetItem, new Action<GameObject, ItemIndex>(ExpressionOnItem));
	}

	private static void ExpressionOnHit(GameObject body, DamageReport damageReport)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		ExpressionController val = default(ExpressionController);
		if (body.TryGetComponent<ExpressionController>(ref val))
		{
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "HighBlink", 0, 0, 0.05f, 0.3f, 0.2f, true));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "BrowsAngry", 1, 0, 0.05f, 0.3f, 0.2f, false));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "MouthO", 2, 0, 0.05f, 0.3f, 0.2f, false));
		}
	}

	private static void ExpressionOnShrineFailure(GameObject body)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		ExpressionController val = default(ExpressionController);
		if (body.TryGetComponent<ExpressionController>(ref val))
		{
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "EyesTeardrops", 0, 0, 0f, 1.2f, 0f, false));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "BrowsLower", 1, 0, 0.2f, 0.8f, 0.2f, false));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "MouthBleh", 2, 0, 0.2f, 0.8f, 0.2f, false));
		}
	}

	private static void ExpressionOnHoldoutOnLevelOnMithrix(GameObject body)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		ExpressionController val = default(ExpressionController);
		if (body.TryGetComponent<ExpressionController>(ref val))
		{
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "EyesHighBlink", 0, 0, 0.2f, 0.8f, 0.2f, true));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "MouthSmile", 2, 0, 0.2f, 0.8f, 0.2f, false));
		}
	}

	private static void ExpressionOnItem(GameObject body, ItemIndex itemIndex)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		ExpressionController val = default(ExpressionController);
		if (body.TryGetComponent<ExpressionController>(ref val))
		{
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "BrowsSlightRaise", 1, 0, 0.2f, 0.8f, 0.2f, false));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "Mouth:P", 2, 0, 0.2f, 0.8f, 0.2f, false));
		}
	}

	private static void ExpressionOnDeath(GameObject body)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		ExpressionController val = default(ExpressionController);
		if (body.TryGetComponent<ExpressionController>(ref val))
		{
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "EyesBewildered", 0, 2, 0f, float.PositiveInfinity, 0.2f, true));
			val.TryPlayAnimation(new BlendShapeAnimation("Bandit2BodyMesh", "MouthBleh", 2, 2, 0.2f, float.PositiveInfinity, 0.2f, false));
		}
	}

	private static bool InCombat(ExpressionController expressionController)
	{
		CharacterBody characterBody = expressionController.characterBody;
		if (Object.op_Implicit((Object)(object)characterBody))
		{
			return !characterBody.outOfCombat;
		}
		return false;
	}

	private static bool LowHealth(ExpressionController expressionController)
	{
		CharacterBody characterBody = expressionController.characterBody;
		if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.healthComponent))
		{
			return characterBody.healthComponent.combinedHealthFraction <= 0.25f;
		}
		return false;
	}
}
public class Options
{
	public static AssetBundle assetBundle;

	private static bool? _rooEnabled;

	public static bool rooEnabled
	{
		get
		{
			if (!_rooEnabled.HasValue)
			{
				_rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			}
			return _rooEnabled.Value;
		}
	}

	public static ConfigEntry<float> kayokoVoiceVolume { get; set; }

	private static void KayokoVoiceVolumeSettingChanged()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		AkSoundEngine.SetRTPCValue("KayokoBanditVoiceVolume", kayokoVoiceVolume.Value * 50f);
	}

	public static void Init(AssetBundle assetBundle)
	{
		Options.assetBundle = assetBundle;
		kayokoVoiceVolume = ((BaseUnityPlugin)KayokoBanditPlugin.Instance).Config.Bind<float>("Sound", "Kayoko Voice Volume", 1f, "How loud Kayoko's voice is relative to other sound effects.");
		kayokoVoiceVolume.SettingChanged += delegate
		{
			KayokoVoiceVolumeSettingChanged();
		};
		if (rooEnabled)
		{
			RoOInit();
		}
		RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(OnLoadFinished));
	}

	public static void OnLoadFinished()
	{
		KayokoVoiceVolumeSettingChanged();
	}

	private static void RoOInit()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		ModSettingsManager.AddOption((BaseOption)new StepSliderOption(kayokoVoiceVolume, new StepSliderConfig
		{
			min = 0f,
			max = 2f,
			increment = 0.01f
		}));
		ModSettingsManager.SetModDescription("Config options relating to the Kayoko Bandit skin mod.");
		ModSettingsManager.SetModIcon(assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\KayokoBandit\\Icons\\DefKayokoBanditIcon.png"));
	}
}
public static class VoiceLines
{
	private static float nextLobbyLineTime;

	public static VoiceArray blockOrHeal = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("KayokoBandit_BlockHeal_1", 1.1f),
		new VoiceInfo("KayokoBandit_BlockHeal_2", 1.5f),
		new VoiceInfo("KayokoBandit_BlockHeal_3", 1f)
	});

	public static VoiceArray damage = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_Damage_1", 1.2f),
		new VoiceInfo("Play_KayokoBandit_Damage_2", 0.9f),
		new VoiceInfo("Play_KayokoBandit_Damage_3", 0.6f)
	});

	public static VoiceArray death = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_Death_1", 2.8f),
		new VoiceInfo("Play_KayokoBandit_Death_2", 4.4f)
	});

	public static VoiceArray defeatBossGroup = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_DefeatBossGroup_1", 1.9f),
		new VoiceInfo("Play_KayokoBandit_DefeatBossGroup_2", 1.8f),
		new VoiceInfo("Play_KayokoBandit_DefeatBossGroup_3", 2.6f)
	});

	public static VoiceArray getItem = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_GetItem_1", 1.6f),
		new VoiceInfo("Play_KayokoBandit_GetItem_2", 1.5f),
		new VoiceInfo("Play_KayokoBandit_GetItem_3", 4.6f)
	});

	public static VoiceArray holdoutZoneCharged = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_HoldoutZoneCharged_1", 2.3f),
		new VoiceInfo("Play_KayokoBandit_HoldoutZoneCharged_2", 4.2f),
		new VoiceInfo("Play_KayokoBandit_HoldoutZoneCharged_3", 2f)
	});

	public static VoiceArray idle = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_Idle_1", 6.2f),
		new VoiceInfo("Play_KayokoBandit_Idle_2", 2.8f),
		new VoiceInfo("Play_KayokoBandit_Idle_3", 2.4f)
	});

	public static VoiceArray leavePod = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_LeavePod_1", 1.7f),
		new VoiceInfo("Play_KayokoBandit_LeavePod_2", 1.8f),
		new VoiceInfo("Play_KayokoBandit_LeavePod_3", 1f)
	});

	public static VoiceArray leaveSpawnTeleporterState = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_LeaveSpawnTeleporterState_1", 3.5f),
		new VoiceInfo("Play_KayokoBandit_LeaveSpawnTeleporterState_2", 3.7f),
		new VoiceInfo("Play_KayokoBandit_LeaveSpawnTeleporterState_3", 4.3f)
	});

	public static VoiceArray leaveStage = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_LeaveStage_1", 5.2f),
		new VoiceInfo("Play_KayokoBandit_LeaveStage_2", 4.4f),
		new VoiceInfo("Play_KayokoBandit_LeaveStage_3", 5.5f)
	});

	public static VoiceArray levelUp = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
	{
		new VoiceInfo("Play_KayokoBandit_LevelUp_1", 3.9f),
		new VoiceInfo("Play_KayokoBandit_LevelUp_2", 1.9f),
		new VoiceInfo("Play_KayokoBandit_LevelUp_3", 5.1f),
		new VoiceInfo("Play_KayokoBandit_LevelUp_4", 6.2f)
	});

	public static VoiceArray skinAppliedLobby = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_SkinAppliedLobby_1", 3.9f),
		new VoiceInfo("Play_KayokoBandit_SkinAppliedLobby_2", 2.8f),
		new VoiceInfo("Play_KayokoBandit_SkinAppliedLobby_3", 3.1f)
	});

	public static VoiceArray mithrixDefeat = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_MithrixDefeat_1", 8.9f),
		new VoiceInfo("Play_KayokoBandit_MithrixDefeat_2", 1.7f),
		new VoiceInfo("Play_KayokoBandit_MithrixDefeat_3", 3.7f)
	});

	public static VoiceArray shrineFailure = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_ShrineFailure_1", 2.9f),
		new VoiceInfo("Play_KayokoBandit_ShrineFailure_2", 1.2f)
	});

	public static VoiceArray shrineSuccess = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_ShrineSuccess_1", 4.6f),
		new VoiceInfo("Play_KayokoBandit_ShrineSuccess_2", 5.2f)
	});

	public static VoiceArray teleporterEnd = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_TeleporterEnd_1", 1.7f),
		new VoiceInfo("Play_KayokoBandit_TeleporterEnd_2", 2f)
	});

	public static VoiceArray teleporterStart = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_TeleporterStart_1", 3.1f),
		new VoiceInfo("Play_KayokoBandit_TeleporterStart_2", 2.9f)
	});

	public static VoiceArray useEquipment = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_UseEquipment_1", 0.9f),
		new VoiceInfo("Play_KayokoBandit_UseEquipment_2", 1.8f)
	});

	public static VoiceArray useSecondary = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
	{
		new VoiceInfo("Play_KayokoBandit_UseSecondary_1", 0.8f),
		new VoiceInfo("Play_KayokoBandit_UseSecondary_2", 0.5f),
		new VoiceInfo("Play_KayokoBandit_UseSecondary_3", 0.4f)
	});

	public static VoiceArray useSpecial = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
	{
		new VoiceInfo("Play_KayokoBandit_UseSpecial_1", 1.2f),
		new VoiceInfo("Play_KayokoBandit_UseSpecial_2", 1.1f)
	});

	public static VoiceArray useUtility = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
	{
		new VoiceInfo("Play_KayokoBandit_UseUtility_1", 1.8f),
		new VoiceInfo("Play_KayokoBandit_UseUtility_2", 1.5f),
		new VoiceInfo("Play_KayokoBandit_UseUtility_3", 1f),
		new VoiceInfo("Play_KayokoBandit_UseUtility_4", 5f)
	});

	public static void Init(EventSub eventSub)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Expected O, but got Unknown
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Expected O, but got Unknown
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Expected O, but got Unknown
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Expected O, but got Unknown
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Expected O, but got Unknown
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Expected O, but got Unknown
		eventSub.options.voiceGroups = (VoiceGroup[])(object)new VoiceGroup[9]
		{
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { idle }, 10f, 20f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[5] { death, leavePod, skinAppliedLobby, leaveSpawnTeleporterState, mithrixDefeat }, 0f, 0f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[2] { shrineFailure, shrineSuccess }, 3f, 3f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { blockOrHeal }, 10f, 20f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { getItem }, 15f, 60f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { levelUp }, 15f, 30f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { useEquipment }, 45f, 100f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[4] { useSecondary, useUtility, useSpecial, damage }, 2f, 8f),
			new VoiceGroup((VoiceArray[])(object)new VoiceArray[5] { teleporterStart, defeatBossGroup, teleporterEnd, holdoutZoneCharged, leaveStage }, 5f, 10f)
		};
		eventSub.BearDamageBlock = (Action<GameObject>)Delegate.Combine(eventSub.BearDamageBlock, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(blockOrHeal, body, 0.8f);
			}
		});
		eventSub.Heal = (Action<GameObject, float>)Delegate.Combine(eventSub.Heal, (Action<GameObject, float>)delegate(GameObject body, float amount)
		{
			VoiceController val = default(VoiceController);
			HealthComponent val2 = default(HealthComponent);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val) && ((Component)val).TryGetComponent<HealthComponent>(ref val2) && amount > val2.fullHealth * 0.25f)
			{
				val.TryPlayRandomUniqueSoundServer(blockOrHeal, body, 1f);
			}
		});
		eventSub.TakeDamage = (Action<GameObject, DamageReport>)Delegate.Combine(eventSub.TakeDamage, (Action<GameObject, DamageReport>)delegate(GameObject body, DamageReport damageReport)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(damage, body, 0.3f);
			}
		});
		eventSub.Death = (Action<GameObject>)Delegate.Combine(eventSub.Death, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomSoundServer(death, body, 1f);
			}
		});
		eventSub.DefeatBossGroup = (Action<GameObject>)Delegate.Combine(eventSub.DefeatBossGroup, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(defeatBossGroup, body, 1f);
			}
		});
		eventSub.GetItem = (Action<GameObject, ItemIndex>)Delegate.Combine(eventSub.GetItem, (Action<GameObject, ItemIndex>)delegate(GameObject body, ItemIndex _)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(getItem, body, 0.7f);
			}
		});
		eventSub.HoldoutZoneCharged = (Action<GameObject>)Delegate.Combine(eventSub.HoldoutZoneCharged, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(holdoutZoneCharged, body, 1f);
			}
		});
		eventSub.Idle = (Action<GameObject>)Delegate.Combine(eventSub.Idle, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(idle, body, 0.9f);
			}
		});
		eventSub.LeavePod = (Action<GameObject>)Delegate.Combine(eventSub.LeavePod, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomSoundServer(leavePod, body, 1f);
			}
		});
		eventSub.LeaveSpawnTeleporterState = (Action<GameObject>)Delegate.Combine(eventSub.LeaveSpawnTeleporterState, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(leaveSpawnTeleporterState, body, 0.8f);
			}
		});
		eventSub.LeaveStage = (Action<GameObject>)Delegate.Combine(eventSub.LeaveStage, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(leaveStage, body, 1f);
			}
		});
		eventSub.LevelUp = (Action<GameObject>)Delegate.Combine(eventSub.LevelUp, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(levelUp, body, 0.65f);
			}
		});
		eventSub.SkinAppliedLobby = (Action<GameObject>)Delegate.Combine(eventSub.SkinAppliedLobby, (Action<GameObject>)delegate(GameObject body)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if (Time.time > nextLobbyLineTime && ((body != null) ? body.GetComponent<VoiceController>() : null) != null)
			{
				object[] voiceLines = skinAppliedLobby.voiceLines;
				VoiceInfo val = (VoiceInfo)MwUtils.RandomChoice(voiceLines);
				nextLobbyLineTime = Time.time + val.approxDuration + 0.5f;
				VoiceController.PlaySound(val, body, (VoiceController)null);
			}
		});
		eventSub.MithrixDefeat = (Action<GameObject>)Delegate.Combine(eventSub.MithrixDefeat, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomSoundServer(mithrixDefeat, body, 1f);
			}
		});
		eventSub.ShrineFailure = (Action<GameObject>)Delegate.Combine(eventSub.ShrineFailure, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(shrineFailure, body, 0.7f);
			}
		});
		eventSub.ShrineSuccess = (Action<GameObject>)Delegate.Combine(eventSub.ShrineSuccess, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(shrineFailure, body, 0.7f);
			}
		});
		eventSub.TeleporterEnd = (Action<GameObject>)Delegate.Combine(eventSub.TeleporterEnd, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(teleporterEnd, body, 1f);
			}
		});
		eventSub.TeleporterStart = (Action<GameObject>)Delegate.Combine(eventSub.TeleporterStart, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(teleporterStart, body, 1f);
			}
		});
		eventSub.UseEquipment = (Action<GameObject>)Delegate.Combine(eventSub.UseEquipment, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(useEquipment, body, 0.85f);
			}
		});
		eventSub.UseSecondary = (Action<GameObject>)Delegate.Combine(eventSub.UseSecondary, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(useSecondary, body, 0.3f);
			}
		});
		eventSub.UseSpecial = (Action<GameObject>)Delegate.Combine(eventSub.UseSpecial, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(useSpecial, body, 0.4f);
			}
		});
		eventSub.UseUtility = (Action<GameObject>)Delegate.Combine(eventSub.UseUtility, (Action<GameObject>)delegate(GameObject body)
		{
			VoiceController val = default(VoiceController);
			if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val))
			{
				val.TryPlayRandomUniqueSoundServer(useUtility, body, 0.3f);
			}
		});
	}
}
public static class Helpers
{
	private static GameObject prefabHolder;

	public static GameObject ClonePrefab(GameObject gameObject)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)prefabHolder))
		{
			prefabHolder = new GameObject("PrefabHolder");
			Object.DontDestroyOnLoad((Object)(object)prefabHolder);
			prefabHolder.SetActive(false);
		}
		GameObject obj = Object.Instantiate<GameObject>(gameObject, prefabHolder.transform);
		obj.AddComponent<RemoveClone>();
		((Object)obj).name = ((Object)gameObject).name;
		return obj;
	}

	public static Transform GetChild(this Transform transform, int index, out Transform child)
	{
		return child = transform.GetChild(index);
	}

	public static GameObject WithComponent<T>(this GameObject gameObject, Action<T> modifier = null) where T : Component
	{
		T obj = gameObject.AddComponent<T>();
		modifier?.Invoke(obj);
		return gameObject;
	}

	public static GameObject WithTryComponent<T>(this GameObject gameObject, Action<T> modifier = null) where T : Component
	{
		if (Object.op_Implicit((Object)(object)gameObject) && !Object.op_Implicit((Object)(object)gameObject.GetComponent<T>()))
		{
			T obj = gameObject.AddComponent<T>();
			modifier?.Invoke(obj);
		}
		return gameObject;
	}

	public static T ThrowIfEquals<T>(int index, string message, T value, T expected) where T : Enum
	{
		if (value.Equals(expected))
		{
			throw new ElementException(index, message);
		}
		return value;
	}

	public static T ThrowIfOutOfBounds<T>(int index, string message, T[] array, int elementIndex) where T : class
	{
		if (array == null || array.Length <= elementIndex)
		{
			throw new ElementException(index, message);
		}
		return array[elementIndex];
	}

	public static T ThrowIfNull<T>(int index, string message, T value) where T : class
	{
		if (value == null)
		{
			throw new ElementException(index, message);
		}
		return value;
	}

	public static void TryCatchThrow(string message, Action action)
	{
		try
		{
			action?.Invoke();
		}
		catch (Exception innerException)
		{
			throw new FieldException(message, innerException);
		}
	}
}
public class RemoveClone : MonoBehaviour
{
	public void Awake()
	{
		((Object)this).name = ((Object)this).name[..^7];
	}
}
public class FieldException : Exception
{
	public FieldException(string message, Exception innerException)
		: base(message, innerException)
	{
	}
}
public class ElementException : Exception
{
	public int Index { get; }

	public ElementException(int index, string message)
		: base(message)
	{
		Index = index;
	}
}
public class InsertBones : MonoBehaviour
{
	private readonly List<SkinnedMeshRenderer> modifiedRenderers = new List<SkinnedMeshRenderer>();

	public List<string> rendererPaths = new List<string>();

	public List<Transform> newBones = new List<Transform>();

	public string afterPath;

	public void Awake()
	{
		Transform transform = ((Component)((Component)this).GetComponentInParent<ModelSkinController>()).transform;
		Transform value = ((Component)transform).transform.Find(afterPath);
		foreach (string rendererPath in rendererPaths)
		{
			Transform obj = transform.Find(rendererPath);
			SkinnedMeshRenderer val = ((obj != null) ? ((Component)obj).GetComponent<SkinnedMeshRenderer>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				Transform[] array = val.bones;
				int num = Array.IndexOf(array, value) + 1;
				if (num != 0)
				{
					Array.Resize(ref array, array.Length + newBones.Count);
					Array.Copy(array, num, array, num + newBones.Count, array.Length - newBones.Count - num);
					newBones.CopyTo(array, num);
					val.bones = array;
					modifiedRenderers.Add(val);
				}
			}
		}
	}

	public void OnDestroy()
	{
		foreach (SkinnedMeshRenderer modifiedRenderer in modifiedRenderers)
		{
			if (Object.op_Implicit((Object)(object)modifiedRenderer))
			{
				Transform[] array = modifiedRenderer.bones;
				int num = Array.IndexOf(array, ((Component)this).transform);
				Array.Copy(array, num + newBones.Count, array, num, array.Length - num - newBones.Count);
				Array.Resize(ref array, array.Length - newBones.Count);
				modifiedRenderer.bones = array;
			}
		}
		modifiedRenderers.Clear();
	}
}
public class AddDynamicColliders : MonoBehaviour
{
	public List<string> paths = new List<string>();

	public void Awake()
	{
		Transform transform = ((Component)((Component)this).GetComponentInParent<ModelSkinController>()).transform;
		List<DynamicBoneCollider> list = new List<DynamicBoneCollider>();
		foreach (string path in paths)
		{
			Transform val = transform.Find(path);
			if (Object.op_Implicit((Object)(object)val))
			{
				list.AddRange(((Component)val).GetComponents<DynamicBoneCollider>());
			}
		}
		DynamicBone[] components = ((Component)this).GetComponents<DynamicBone>();
		for (int i = 0; i < components.Length; i++)
		{
			components[i].m_Colliders.AddRange(list);
		}
	}
}