Decompiled source of Mari Track Commando v1.0.1
TrackMariCommando.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates.Missions.BrotherEncounter; using HG; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.RuntimeDetour.HookGen; using On.EntityStates; using On.EntityStates.Missions.BrotherEncounter; using On.RoR2; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.ContentManagement; using RuneFoxMods.DynamicSkins; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TrackMariCommando")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TrackMariCommando")] [assembly: AssemblyTitle("TrackMariCommando")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace MariCommando { [BepInPlugin("com.Schale.TrackMariCommando", "Track Mari Commando Skin", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MariCommandoPlugin : BaseUnityPlugin { public class DynamicSkinExtension { private Modification DefMariCommandoDZLModification; private Modification DefMariCommandoDZRModification; private Modification DefMariCommandoed001LModification; private Modification DefMariCommandoed001RModification; private Modification DefMariCommandofs001Modification; private Modification DefMariCommandofs002Modification; private Modification DefMariCommandoHFModification; private Modification DefMariCommandolhModification; private Modification DefMariCommandoqfLModification; private Modification DefMariCommandoqfRModification; internal void BeforeStart() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) _DynamicSkinManager.InstanceLogger = ((BaseUnityPlugin)Instance).Logger; new Hook((MethodBase)typeof(SkinDef).GetMethod("ApplyAsync"), (Delegate)new Func<Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>, SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>(_DynamicSkinManager.SkinDefApply)).Apply(); } internal void AfterStart() { InitializeModifications(); InitializeDynamicBones(); AddModificationsToList(); } internal void BeforeBodyCatalogInit() { CommandoBodyDefMariCommandoSkinAddedEvent += onSkinAdded; } internal void AfterBodyCatalogInit() { } private void InitializeModifications() { DefMariCommandoDZLModification = new Modification("DZL.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 78, AffectsBaseModel: true, assetBundle); DefMariCommandoDZRModification = new Modification("DZR.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 76, AffectsBaseModel: true, assetBundle); DefMariCommandoed001LModification = new Modification("ed001L.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 85, AffectsBaseModel: true, assetBundle); DefMariCommandoed001RModification = new Modification("ed001R.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 82, AffectsBaseModel: true, assetBundle); DefMariCommandofs001Modification = new Modification("fs001.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 81, AffectsBaseModel: true, assetBundle); DefMariCommandofs002Modification = new Modification("fs002.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 80, AffectsBaseModel: true, assetBundle); DefMariCommandoHFModification = new Modification("HF.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 71, AffectsBaseModel: true, assetBundle); DefMariCommandolhModification = new Modification("lh.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 88, AffectsBaseModel: true, assetBundle); DefMariCommandoqfLModification = new Modification("qfL.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 66, AffectsBaseModel: true, assetBundle); DefMariCommandoqfRModification = new Modification("qfR.prefab", "head", "CommandoBody", "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 61, AffectsBaseModel: true, assetBundle); } private void InitializeDynamicBones() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: 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_0312: 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_0346: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: 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_0746: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) DefMariCommandoDZLModification.dynamicBoneData = new DynamicBoneData("DZL", 0.02f, null, 0.005f, null, 0.55f, null, 0.85f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0.1f, 0.03f), (Bound)0, 0.15f, 0.66f), new DynamicBoneColliderData("upper_arm.l", (Direction)1, new Vector3(0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f) }, new List<string>(), (FreezeAxis)0); DefMariCommandoDZRModification.dynamicBoneData = new DynamicBoneData("DZR", 0.02f, null, 0.005f, null, 0.55f, null, 0.85f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0.1f, 0.03f), (Bound)0, 0.15f, 0.66f), new DynamicBoneColliderData("upper_arm.r", (Direction)1, new Vector3(-0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f) }, new List<string>(), (FreezeAxis)0); DefMariCommandoed001LModification.dynamicBoneData = new DynamicBoneData("ed001L", 0.8f, null, 0.2f, null, 0.9f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); DefMariCommandoed001RModification.dynamicBoneData = new DynamicBoneData("ed001R", 0.8f, null, 0.2f, null, 0.8f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); DefMariCommandofs001Modification.dynamicBoneData = new DynamicBoneData("fs001", 0.2f, null, 0.05f, null, 0.8f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0.19f, 0f), (Bound)0, 0.15f, 0f) }, new List<string>(), (FreezeAxis)0); DefMariCommandofs002Modification.dynamicBoneData = new DynamicBoneData("fs002", 0.2f, null, 0.05f, null, 0.8f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0.19f, 0f), (Bound)0, 0.15f, 0f) }, new List<string>(), (FreezeAxis)0); DefMariCommandoHFModification.dynamicBoneData = new DynamicBoneData("HF", 0.894f, null, 0.1f, null, 0.783f, null, 0.713f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0.1f, 0.03f), (Bound)0, 0.15f, 0.66f), new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0.19f, 0f), (Bound)0, 0.15f, 0f), new DynamicBoneColliderData("upper_arm.l", (Direction)1, new Vector3(0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f), new DynamicBoneColliderData("upper_arm.r", (Direction)1, new Vector3(-0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f) }, new List<string>(), (FreezeAxis)0); DefMariCommandolhModification.dynamicBoneData = new DynamicBoneData("lh", 0.2f, null, 0.05f, null, 0.9f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0.19f, 0f), (Bound)0, 0.15f, 0f) }, new List<string>(), (FreezeAxis)0); DefMariCommandoqfLModification.dynamicBoneData = new DynamicBoneData("qfL", 0.894f, null, 0.1f, null, 0.783f, null, 0.713f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0.1f, 0.03f), (Bound)0, 0.15f, 0.66f), new DynamicBoneColliderData("upper_arm.l", (Direction)1, new Vector3(0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f) }, new List<string>(), (FreezeAxis)0); DefMariCommandoqfRModification.dynamicBoneData = new DynamicBoneData("qfR", 0.894f, null, 0.1f, null, 0.783f, null, 0.713f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0.1f, 0.03f), (Bound)0, 0.15f, 0.66f), new DynamicBoneColliderData("upper_arm.r", (Direction)1, new Vector3(-0.06f, 0.28f, -0.04f), (Bound)0, 0.09f, 0.63f) }, new List<string>(), (FreezeAxis)0); } private void AddModificationsToList() { _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 78, DefMariCommandoDZLModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 76, DefMariCommandoDZRModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 85, DefMariCommandoed001LModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 82, DefMariCommandoed001RModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 81, DefMariCommandofs001Modification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 80, DefMariCommandofs002Modification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 71, DefMariCommandoHFModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 88, DefMariCommandolhModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 66, DefMariCommandoqfLModification); _DynamicSkinManager.AddModification("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", 61, DefMariCommandoqfRModification); } private static void onSkinAdded(object sender, SkinAddedArgs e) { _DynamicSkinManager.AddSkinDef(e.skinDef); } } public delegate void VoidDelegate(); public class SkinAddedArgs : EventArgs { public SkinDef skinDef { get; } public GameObject bodyPrefab { get; } public SkinAddedArgs(SkinDef newSkinDef, GameObject newGameObject) { skinDef = newSkinDef; bodyPrefab = newGameObject; } } private class FieldException : Exception { public FieldException(string message, Exception innerException) : base(message, innerException) { } } private static DynamicSkinExtension _DynamicSkinExtension = new DynamicSkinExtension(); private static DynamicSkinManager _DynamicSkinManager = new DynamicSkinManager(); private static VoidDelegate BeforeStartDelegate; private static VoidDelegate AfterStartDelegate; private static VoidDelegate BeforeBodyCatalogDelegate; private static VoidDelegate AfterBodyCatalogDelegate; private static AssetBundle assetBundle; private static readonly List<Material> materialsWithRoRShader = new List<Material>(); internal static MariCommandoPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { MariCommandoPlugin instance = Instance; return (instance != null) ? ((BaseUnityPlugin)instance).Logger : null; } } private static event EventHandler<SkinAddedArgs> CommandoBodyDefMariCommandoSkinAddedEvent; private void Start() { Instance = this; BeforeStart(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrackMariCommando.moffeinmaricommando")) { 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 BeforeStart() { BeforeStartDelegate = (VoidDelegate)Delegate.Combine(BeforeStartDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeStart)); BeforeStartDelegate?.Invoke(); } private void AfterStart() { AfterStartDelegate = (VoidDelegate)Delegate.Combine(AfterStartDelegate, new VoidDelegate(_DynamicSkinExtension.AfterStart)); AfterStartDelegate?.Invoke(); } private static void BeforeBodyCatalogInit() { BeforeBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(BeforeBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeBodyCatalogInit)); BeforeBodyCatalogDelegate?.Invoke(); } private static void AfterBodyCatalogInit() { AfterBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(AfterBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.AfterBodyCatalogInit)); AfterBodyCatalogDelegate?.Invoke(); } private static void ReplaceShaders() { LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Skins/MariCommando/Skin/matMariCommando.mat", "Assets/Skins/MariCommando/Skin/matMariWeapon.mat"); } private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) 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("MOFFEIN_SKIN_DEFMARICOMMANDO_NAME", "Mari (Track)"); } private static void BodyCatalogInit() { BeforeBodyCatalogInit(); AddCommandoBodyDefMariCommandoSkin(); AfterBodyCatalogInit(); } private static void CommandoBodyDefMariCommandoSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { MariCommandoPlugin.CommandoBodyDefMariCommandoSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddCommandoBodyDefMariCommandoSkin() { string text = "CommandoBody"; string text2 = "DefTrackMariCommando"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.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 skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); Light[] componentsInChildren = gameObject.GetComponentsInChildren<Light>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>(); skin.skinDefParams = skinParams; TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\MariCommando\\Icons\\DefMariCommandoIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "MOFFEIN_SKIN_DEFMARICOMMANDO_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = null; }); TryCatchThrow("Game Object Activations", delegate { skinParams.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: 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_006e: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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) skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[3] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/MariCommando/Skin/matMariCommando.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "CommandoMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/MariCommando/Skin/matMariWeapon.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "GunMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/MariCommando/Skin/matMariWeapon.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "GunMesh.001") } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_005f: 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_00b5: 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_00bf: 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_010d: 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\\MariCommando\\Meshes\\MariMesh.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "CommandoMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\MariCommando\\Meshes\\Mari_Original_Weapon.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "GunMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\MariCommando\\Meshes\\Mari_Original_Weapon.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "GunMesh.001") } }; }); TryCatchThrow("Light Infos", delegate { skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0]; }); TryCatchThrow("Minion Skin Replacements", delegate { skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; MwSkinEvents.Init(skin); CommandoBodyDefMariCommandoSkinAdded(skin, val); } catch (FieldException ex) { 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 ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void TryCatchThrow(string message, Action action) { try { action?.Invoke(); } catch (Exception innerException) { throw new FieldException(message, innerException); } } private static void TryAddComponent<T>(GameObject obj) where T : Component { if (!Object.op_Implicit((Object)(object)obj.GetComponent<T>())) { obj.AddComponent<T>(); } } } public class MwExpressionController : MonoBehaviour { private enum Feature { Eyes, Brows, Mouth } private enum Priority { Default, DefaultHigh, Standard, StandardHigh, Marginal, MarginalHigh } private enum Label { Default, InCombat, LowHealth } private class ExpressionState { public Coroutine coroutine; public Feature feature; public int blendShapeIndex; public Priority priority; public Label label; public float time; } [CompilerGenerated] private sealed class <BlendToZero>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int index; public float time; public MwExpressionController <>4__this; private float <interpolationTime>5__1; private float <startWeight>5__2; private float <stopwatch>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlendToZero>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <interpolationTime>5__1 = GetInterpolationTime(time); <startWeight>5__2 = <>4__this.skinnedMeshRenderer.GetBlendShapeWeight(index); <stopwatch>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<stopwatch>5__3 < <interpolationTime>5__1) { <stopwatch>5__3 += Time.deltaTime; <>4__this.skinnedMeshRenderer.SetBlendShapeWeight(index, Mathf.Lerp(<startWeight>5__2, 0f, <stopwatch>5__3 / <interpolationTime>5__1)); <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ExpressionRoutine>d__41 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Feature feature; public SkinnedMeshRenderer renderer; public int index; public float time; public MwExpressionController <>4__this; private float <interpolationTime>5__1; private float <stopwatch>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExpressionRoutine>d__41(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <interpolationTime>5__1 = GetInterpolationTime(time); <stopwatch>5__2 = 0f; <>4__this.featureActive[feature] = true; goto IL_00c9; case 1: <>1__state = -1; goto IL_00c9; case 2: <>1__state = -1; <stopwatch>5__2 += time - <interpolationTime>5__1 * 2f; break; case 3: { <>1__state = -1; break; } IL_00c9: if (<stopwatch>5__2 < <interpolationTime>5__1) { <stopwatch>5__2 += Time.deltaTime; renderer.SetBlendShapeWeight(index, Mathf.Lerp(0f, 100f, <stopwatch>5__2 / <interpolationTime>5__1)); <>2__current = null; <>1__state = 1; return true; } renderer.SetBlendShapeWeight(index, 100f); <>2__current = (object)new WaitForSeconds(time - <interpolationTime>5__1 * 2f); <>1__state = 2; return true; } if (<stopwatch>5__2 < time) { <stopwatch>5__2 += Time.deltaTime; renderer.SetBlendShapeWeight(index, Mathf.Lerp(100f, 0f, (<stopwatch>5__2 - (time - <interpolationTime>5__1)) / <interpolationTime>5__1)); <>2__current = null; <>1__state = 3; return true; } renderer.SetBlendShapeWeight(index, 0f); <>4__this.featureActive[feature] = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <InstantExpressionRoutine>d__43 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Feature feature; public SkinnedMeshRenderer renderer; public int index; public float time; public MwExpressionController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InstantExpressionRoutine>d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.featureActive[feature] = true; renderer.SetBlendShapeWeight(index, 100f); <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; case 1: <>1__state = -1; renderer.SetBlendShapeWeight(index, 0f); <>4__this.featureActive[feature] = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LerpExpressionRoutine>d__44 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Feature feature; public SkinnedMeshRenderer renderer; public int index; public float time; public MwExpressionController <>4__this; private float <stopwatch>5__1; private float <middle>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LerpExpressionRoutine>d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stopwatch>5__1 = 0f; <middle>5__2 = time / 2f; <>4__this.featureActive[feature] = true; break; case 1: <>1__state = -1; break; } if (<stopwatch>5__1 < time) { <stopwatch>5__1 += Time.deltaTime; if (<stopwatch>5__1 < <middle>5__2) { renderer.SetBlendShapeWeight(index, Mathf.Lerp(0f, 100f, <stopwatch>5__1 / <middle>5__2)); } else { renderer.SetBlendShapeWeight(index, Mathf.Lerp(100f, 0f, (<stopwatch>5__1 - <middle>5__2) / <middle>5__2)); } <>2__current = null; <>1__state = 1; return true; } renderer.SetBlendShapeWeight(index, 0f); <>4__this.featureActive[feature] = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string meshName = "CommandoMesh"; private Dictionary<Feature, ExpressionState> featureCoroutines = new Dictionary<Feature, ExpressionState> { { Feature.Eyes, null }, { Feature.Brows, null }, { Feature.Mouth, null } }; private Dictionary<Feature, bool> featureActive = new Dictionary<Feature, bool> { { Feature.Eyes, false }, { Feature.Brows, false }, { Feature.Mouth, false } }; private bool inDeathState; private float blinkInterval; private float blinkStopwatch; private bool doubleBlink; private CharacterBody _characterBody; private SkinnedMeshRenderer _skinnedMeshRenderer; private static bool hasLoadedBlendShapes; private static int browHurtIndex; private static int browAngryIndex; private static int eyesLowBlinkIndex; private static int eyesHighBlinkIndex; private static int eyesSquintIndex; private static int mouthFrownIndex; private static int mouthGrimaceIndex; private static int mouthDisappointedIndex; private static int mouthHurtIndex; private static int defaultExpressionIndex; private static int hideHaloIndex; private static HashSet<string> badItemsSet = new HashSet<string> { "SlowOnHit", "Squid", "Firework" }; private CharacterBody characterBody { get { if ((Object)(object)_characterBody != (Object)null) { return _characterBody; } _characterBody = ((Component)this).GetComponent<CharacterBody>(); return _characterBody; } } private SkinnedMeshRenderer skinnedMeshRenderer { get { if ((Object)(object)_skinnedMeshRenderer != (Object)null) { return _skinnedMeshRenderer; } _skinnedMeshRenderer = GetSkinnedMeshRenderer(characterBody, "CommandoMesh"); return _skinnedMeshRenderer; } } public static void Init() { SubscribeEvents(); } private static void SubscribeEvents() { MwSkinEvents.SkinAppliedRun += AddExpressionController; MwSkinEvents.SkinAppliedRun += LoadBlendShapes; MwSkinEvents.TakeDamage += ExpressionOnHit; MwSkinEvents.Death += ExpressionOnDeath; MwSkinEvents.ShrineFailure += ExpressionOnShrineFailure; MwSkinEvents.LevelUp += ExpressionOnHoldoutOnLevelOnMithrix; MwSkinEvents.MithrixDefeat += ExpressionOnHoldoutOnLevelOnMithrix; MwSkinEvents.HoldoutZoneCharged += ExpressionOnHoldoutOnLevelOnMithrix; MwSkinEvents.GetItem += ExpressionOnItem; } private static void LoadBlendShapes(GameObject body) { if (!hasLoadedBlendShapes) { GetBlendShapesIndexes(body); } } private void CancelCurrentExpressions(SkinnedMeshRenderer renderer) { foreach (ExpressionState value in featureCoroutines.Values) { if (value != null) { CancelExpression(value); } } } private void CancelExpression(ExpressionState expressionState) { ((MonoBehaviour)this).StopCoroutine(expressionState.coroutine); featureActive[expressionState.feature] = false; ((MonoBehaviour)this).StartCoroutine(BlendToZero(expressionState.blendShapeIndex, expressionState.time)); } [IteratorStateMachine(typeof(<BlendToZero>d__35))] private IEnumerator BlendToZero(int index, float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlendToZero>d__35(0) { <>4__this = this, index = index, time = time }; } private static void GetBlendShapesIndexes(GameObject body) { SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if ((Object)(object)val != (Object)null) { browHurtIndex = val.sharedMesh.GetBlendShapeIndex("browHurt"); browAngryIndex = val.sharedMesh.GetBlendShapeIndex("browAngry"); eyesLowBlinkIndex = val.sharedMesh.GetBlendShapeIndex("eyeLowBlink"); eyesHighBlinkIndex = val.sharedMesh.GetBlendShapeIndex("eyeHighBlink"); eyesSquintIndex = val.sharedMesh.GetBlendShapeIndex("eyeSquint"); mouthFrownIndex = val.sharedMesh.GetBlendShapeIndex("mouthFrown"); mouthGrimaceIndex = val.sharedMesh.GetBlendShapeIndex("mouthGrimace"); mouthDisappointedIndex = val.sharedMesh.GetBlendShapeIndex("mouthDisappointed"); mouthHurtIndex = val.sharedMesh.GetBlendShapeIndex("mouthHurt"); hideHaloIndex = val.sharedMesh.GetBlendShapeIndex("haloHide"); defaultExpressionIndex = val.sharedMesh.GetBlendShapeIndex("Basis.001"); hasLoadedBlendShapes = true; } } private static void AddExpressionController(GameObject body) { MwExpressionController mwExpressionController = body.AddComponent<MwExpressionController>(); } private static SkinnedMeshRenderer GetSkinnedMeshRenderer(GameObject body, string meshName) { object result; if (body == null) { result = null; } else { CharacterBody component = body.GetComponent<CharacterBody>(); if (component == null) { result = null; } else { ModelLocator modelLocator = component.modelLocator; if (modelLocator == null) { result = null; } else { Transform modelTransform = modelLocator.modelTransform; if (modelTransform == null) { result = null; } else { Transform obj = modelTransform.Find(meshName); result = ((obj != null) ? ((Component)obj).GetComponent<SkinnedMeshRenderer>() : null); } } } } return (SkinnedMeshRenderer)result; } private static SkinnedMeshRenderer GetSkinnedMeshRenderer(CharacterBody body, string meshName) { object result; if (body == null) { result = null; } else { ModelLocator modelLocator = body.modelLocator; if (modelLocator == null) { result = null; } else { Transform modelTransform = modelLocator.modelTransform; if (modelTransform == null) { result = null; } else { Transform obj = modelTransform.Find(meshName); result = ((obj != null) ? ((Component)obj).GetComponent<SkinnedMeshRenderer>() : null); } } } return (SkinnedMeshRenderer)result; } private void SetExpressionRoutine(Func<Feature, SkinnedMeshRenderer, int, float, IEnumerator> Routine, Feature feature, int index, float time, Priority priority = Priority.Standard, Label label = Label.Default) { ExpressionState expressionState = featureCoroutines[feature]; if (expressionState != null && priority > expressionState.priority) { CancelExpression(expressionState); } if (!featureActive[feature]) { featureCoroutines[feature] = new ExpressionState { coroutine = ((MonoBehaviour)this).StartCoroutine(Routine(feature, skinnedMeshRenderer, index, time)), feature = feature, blendShapeIndex = index, priority = priority, label = label, time = time }; } } [IteratorStateMachine(typeof(<ExpressionRoutine>d__41))] private IEnumerator ExpressionRoutine(Feature feature, SkinnedMeshRenderer renderer, int index, float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ExpressionRoutine>d__41(0) { <>4__this = this, feature = feature, renderer = renderer, index = index, time = time }; } private static float GetInterpolationTime(float time) { return Mathf.Min(time / 4f, 0.15f); } [IteratorStateMachine(typeof(<InstantExpressionRoutine>d__43))] private IEnumerator InstantExpressionRoutine(Feature feature, SkinnedMeshRenderer renderer, int index, float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InstantExpressionRoutine>d__43(0) { <>4__this = this, feature = feature, renderer = renderer, index = index, time = time }; } [IteratorStateMachine(typeof(<LerpExpressionRoutine>d__44))] private IEnumerator LerpExpressionRoutine(Feature feature, SkinnedMeshRenderer renderer, int index, float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LerpExpressionRoutine>d__44(0) { <>4__this = this, feature = feature, renderer = renderer, index = index, time = time }; } private static void ExpressionOnHit(GameObject body, DamageDealtMessage damageMessage) { SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if (Object.op_Implicit((Object)(object)val) && damageMessage != null) { GameObject victim = damageMessage.victim; if (((victim != null) ? new float?(victim.GetComponent<HealthComponent>().combinedHealthFraction) : null) > 0.25f) { MwExpressionController component = body.GetComponent<MwExpressionController>(); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesHighBlinkIndex, 0.3f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, browHurtIndex, 0.3f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, mouthHurtIndex, 0.3f, Priority.Marginal); } } } private static void ExpressionOnShrineFailure(GameObject body) { SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if (Object.op_Implicit((Object)(object)val)) { MwExpressionController component = body.GetComponent<MwExpressionController>(); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesLowBlinkIndex, 0.8f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, browHurtIndex, 0.8f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, mouthDisappointedIndex, 0.8f, Priority.Marginal); } } private static void ExpressionOnHoldoutOnLevelOnMithrix(GameObject body) { SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if (Object.op_Implicit((Object)(object)val)) { MwExpressionController component = body.GetComponent<MwExpressionController>(); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesHighBlinkIndex, 1f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, defaultExpressionIndex, 1f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, defaultExpressionIndex, 1f, Priority.Marginal); } } private static void ExpressionOnItem(GameObject body, ItemIndex itemIndex) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if (Object.op_Implicit((Object)(object)val)) { MwExpressionController component = body.GetComponent<MwExpressionController>(); HashSet<string> hashSet = badItemsSet; ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (hashSet.Contains((itemDef != null) ? ((Object)itemDef).name : null)) { component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesLowBlinkIndex, 0.8f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, browHurtIndex, 0.8f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, mouthDisappointedIndex, 0.8f, Priority.Marginal); } else { component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesHighBlinkIndex, 1f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, defaultExpressionIndex, 1f, Priority.Marginal); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, defaultExpressionIndex, 1f, Priority.Marginal); } } } private static void ExpressionOnDeath(GameObject body) { SkinnedMeshRenderer val = GetSkinnedMeshRenderer(body, "CommandoMesh"); if ((Object)(object)val != (Object)null) { MwExpressionController component = body.GetComponent<MwExpressionController>(); val.SetBlendShapeWeight(hideHaloIndex, 100f); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, browHurtIndex, float.PositiveInfinity, Priority.MarginalHigh); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, eyesHighBlinkIndex, float.PositiveInfinity, Priority.MarginalHigh); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, mouthHurtIndex, float.PositiveInfinity, Priority.MarginalHigh); component.inDeathState = true; } } private void Update() { BlinkUpdate(); HurtUpdate(); CombatUpdate(); } private void HurtUpdate() { if ((Object)(object)characterBody == (Object)null || inDeathState) { return; } HealthComponent healthComponent = characterBody.healthComponent; if ((double?)((healthComponent != null) ? new float?(healthComponent.combinedHealthFraction) : null) <= 0.25) { if (featureActive[Feature.Brows]) { ExpressionState expressionState = featureCoroutines[Feature.Brows]; if (expressionState == null || expressionState.priority >= Priority.Standard) { goto IL_00e7; } } SetExpressionRoutine(ExpressionRoutine, Feature.Brows, browHurtIndex, float.PositiveInfinity, Priority.Standard, Label.LowHealth); goto IL_00e7; } if (featureActive[Feature.Brows] && featureCoroutines[Feature.Brows].label == Label.LowHealth) { CancelExpression(featureCoroutines[Feature.Brows]); } if (featureActive[Feature.Eyes] && featureCoroutines[Feature.Eyes].label == Label.LowHealth) { CancelExpression(featureCoroutines[Feature.Eyes]); } if (featureActive[Feature.Mouth] && featureCoroutines[Feature.Mouth].label == Label.LowHealth) { CancelExpression(featureCoroutines[Feature.Mouth]); } return; IL_00e7: if (featureActive[Feature.Eyes]) { ExpressionState expressionState2 = featureCoroutines[Feature.Eyes]; if (expressionState2 == null || expressionState2.priority >= Priority.Standard) { goto IL_013b; } } SetExpressionRoutine(ExpressionRoutine, Feature.Eyes, eyesHighBlinkIndex, float.PositiveInfinity, Priority.Standard, Label.LowHealth); goto IL_013b; IL_013b: if (featureActive[Feature.Mouth]) { ExpressionState expressionState3 = featureCoroutines[Feature.Mouth]; if (expressionState3 == null || expressionState3.priority >= Priority.Standard) { return; } } SetExpressionRoutine(ExpressionRoutine, Feature.Mouth, mouthHurtIndex, float.PositiveInfinity, Priority.Standard, Label.LowHealth); } private void CombatUpdate() { if ((Object)(object)characterBody == (Object)null || inDeathState) { return; } if (!characterBody.outOfCombat) { if (!featureActive[Feature.Brows]) { SetExpressionRoutine(ExpressionRoutine, Feature.Brows, browAngryIndex, float.PositiveInfinity, Priority.Default, Label.InCombat); } if (!featureActive[Feature.Eyes]) { SetExpressionRoutine(ExpressionRoutine, Feature.Eyes, eyesSquintIndex, float.PositiveInfinity, Priority.Default, Label.InCombat); } if (!featureActive[Feature.Mouth]) { SetExpressionRoutine(ExpressionRoutine, Feature.Mouth, mouthFrownIndex, float.PositiveInfinity, Priority.Default, Label.InCombat); } } else { if (featureActive[Feature.Brows] && featureCoroutines[Feature.Brows].label == Label.InCombat) { CancelExpression(featureCoroutines[Feature.Brows]); } if (featureActive[Feature.Eyes] && featureCoroutines[Feature.Eyes].label == Label.InCombat) { CancelExpression(featureCoroutines[Feature.Eyes]); } if (featureActive[Feature.Mouth] && featureCoroutines[Feature.Mouth].label == Label.InCombat) { CancelExpression(featureCoroutines[Feature.Mouth]); } } } private void BlinkUpdate() { blinkStopwatch += Time.deltaTime; if (!(blinkStopwatch >= blinkInterval)) { return; } if (!inDeathState && (Object)(object)skinnedMeshRenderer != (Object)null) { SetExpressionRoutine(LerpExpressionRoutine, Feature.Eyes, eyesLowBlinkIndex, 0.2f, Priority.DefaultHigh); if (doubleBlink) { doubleBlink = false; } else if (Random.value <= 0.1f) { doubleBlink = true; } } else { doubleBlink = false; } blinkStopwatch = 0f; if (doubleBlink) { blinkInterval = 0.3f; } else { blinkInterval = Random.Range(3f, 8f); } } } public static class MwSkinEvents { [CompilerGenerated] private sealed class <HoldBodyFromIdleUpdate>d__89 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CharacterBody body; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HoldBodyFromIdleUpdate>d__89(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; HoldOffIdleInvocation?.Add(body); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; HoldOffIdleInvocation?.Remove(body); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnSkinAppliedBody>d__83 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public orig_ApplySkinAsync orig; public ModelSkinController self; public int skinIndex; public AsyncReferenceHandleUnloadType unloadType; private GameObject <bodyObject>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnSkinAppliedBody>d__83(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <bodyObject>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = orig.Invoke(self, skinIndex, unloadType); <>1__state = 1; return true; case 1: { <>1__state = -1; ModelSkinController obj = self; object obj2; if (obj == null) { obj2 = null; } else { CharacterModel characterModel = obj.characterModel; if (characterModel == null) { obj2 = null; } else { CharacterBody body = characterModel.body; obj2 = ((body != null) ? ((Component)body).gameObject : null); } } <bodyObject>5__1 = (GameObject)obj2; if ((Object)(object)<bodyObject>5__1 != (Object)null && HasEventSkin(<bodyObject>5__1)) { MwSkinEvents.SkinAppliedRun?.Invoke(<bodyObject>5__1); } else if ((Object)(object)<bodyObject>5__1 == (Object)null && (Object)(object)ArrayUtils.GetSafe<SkinDef>(self.skins, self.currentSkinIndex) == (Object)(object)eventSkin) { MwSkinEvents.SkinAppliedLobby?.Invoke(((Component)self).gameObject); } else if ((Object)(object)<bodyObject>5__1 != (Object)null) { MwSkinEvents.DifferentSkinApplied?.Invoke(<bodyObject>5__1); } else { MwSkinEvents.DifferentSkinApplied?.Invoke(((Component)self).gameObject); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static SkinDef _eventSkin; private static HashSet<CharacterBody> HoldOffIdleInvocation = new HashSet<CharacterBody>(); public static SkinDef eventSkin => _eventSkin; public static event Action<GameObject> SkinAppliedLobby; public static event Action<GameObject> SkinAppliedRun; public static event Action<GameObject> DifferentSkinApplied; public static event Action<GameObject> LeavePod; public static event Action<GameObject> Idle; public static event Action<GameObject> TeleporterStart; public static event Action<GameObject> DefeatBossGroup; public static event Action<GameObject> TeleporterEnd; public static event Action<GameObject> UsePrimary; public static event Action<GameObject> UseSecondary; public static event Action<GameObject> UseUtility; public static event Action<GameObject> UseSpecial; public static event Action<GameObject> UseEquipment; public static event Action<GameObject, DamageDealtMessage> TakeDamage; public static event Action<GameObject, float> Heal; public static event Action<GameObject> Death; public static event Action<GameObject> Jump; public static event Action<GameObject> LeaveStage; public static event Action<GameObject> ShrineSuccess; public static event Action<GameObject> ShrineFailure; public static event Action<GameObject, ItemIndex> GetItem; public static event Action<GameObject> HoldoutZoneCharged; public static event Action<GameObject> LevelUp; public static event Action<GameObject> MithrixDefeat; public static void Init(SkinDef skin) { _eventSkin = skin; RegisterNetMessages(); MwExpressionController.Init(); MwTransformController.Init(); SubscribeEvents(); } private static void RegisterNetMessages() { NetworkingAPI.RegisterMessageType<SyncGetItem>(); NetworkingAPI.RegisterMessageType<SyncUseShrine>(); NetworkingAPI.RegisterMessageType<SyncHoldoutZoneCharged>(); } private static void SubscribeEvents() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown ModelSkinController.ApplySkinAsync += new hook_ApplySkinAsync(OnSkinAppliedBody); TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnTeleporterStart); CharacterBody.OnDeathStart += new hook_OnDeathStart(OnDeath); GenericCharacterMain.ApplyJumpVelocity += new hook_ApplyJumpVelocity(OnJump); VehicleSeat.EjectPassenger_GameObject += new hook_EjectPassenger_GameObject(OnLeavePod); CharacterBody.Update += new hook_Update(OnBodyUpdate); SceneExitController.Begin += new hook_Begin(OnLeaveStage); CharacterBody.OnSkillActivated += new hook_OnSkillActivated(OnSkillActivated); ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(OnChanceShrineInteract); HoldoutZoneController.Start += new hook_Start(OnHoldoutZoneCharged); EncounterFinished.OnEnter += new hook_OnEnter(OnMithrixDefeat); GenericPickupController.AttemptGrant += new Manipulator(OnPickupAttemptGrant); EquipmentSlot.onServerEquipmentActivated += OnUseEquipment; BossGroup.onBossGroupDefeatedServer += OnDefeatBossGroup; TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterEnd; GlobalEventManager.onClientDamageNotified += OnTakeDamage; HealthComponent.onCharacterHealServer += OnHeal; GlobalEventManager.onCharacterLevelUp += OnLevelUp; } public static bool HasEventSkin(GameObject obj) { return (Object)(object)eventSkin == (Object)(object)SkinCatalog.FindCurrentSkinDefForBodyInstance(obj); } public static void InvokeGetItem(GameObject body, int itemIndex) { MwSkinEvents.GetItem?.Invoke(body.gameObject, (ItemIndex)itemIndex); } public static void InvokeUseShrine(GameObject body, bool success) { if (success) { MwSkinEvents.ShrineSuccess?.Invoke(body); } else { MwSkinEvents.ShrineFailure?.Invoke(body); } } public static void InvokeHoldoutZoneCharged() { foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.HoldoutZoneCharged?.Invoke(val); } } } [IteratorStateMachine(typeof(<OnSkinAppliedBody>d__83))] private static IEnumerator OnSkinAppliedBody(orig_ApplySkinAsync orig, ModelSkinController self, int skinIndex, AsyncReferenceHandleUnloadType unloadType) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnSkinAppliedBody>d__83(0) { orig = orig, self = self, skinIndex = skinIndex, unloadType = unloadType }; } private static void OnTeleporterStart(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { orig.Invoke(self, activator); TeleporterInteraction instance = TeleporterInteraction.instance; if (instance != null && !instance.isCharged && HasEventSkin(((Component)activator).gameObject)) { MwSkinEvents.TeleporterStart?.Invoke(((Component)activator).gameObject); } } private static void OnDeath(orig_OnDeathStart orig, CharacterBody self) { orig.Invoke(self); if (HasEventSkin(((Component)self).gameObject)) { MwSkinEvents.Death?.Invoke(((Component)self).gameObject); } } private static void OnJump(orig_ApplyJumpVelocity orig, CharacterMotor characterMotor, CharacterBody characterBody, float horizontalBonus, float verticalBonus, bool vault) { orig.Invoke(characterMotor, characterBody, horizontalBonus, verticalBonus, vault); if (HasEventSkin(((Component)characterBody).gameObject)) { MwSkinEvents.Jump?.Invoke(((Component)characterBody).gameObject); } } private static void OnLeavePod(orig_EjectPassenger_GameObject orig, VehicleSeat self, GameObject body) { orig.Invoke(self, body); if (self.isSurvivorPod && HasEventSkin(body)) { MwSkinEvents.LeavePod?.Invoke(body); } } private static void OnBodyUpdate(orig_Update orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && self.notMovingStopwatch > 10f && HasEventSkin(((Component)self).gameObject) && self.notMovingStopwatch % 10f < 0.1f && !HoldOffIdleInvocation.Contains(self)) { MwSkinEvents.Idle?.Invoke(((Component)self).gameObject); ((MonoBehaviour)RoR2Application.instance).StartCoroutine(HoldBodyFromIdleUpdate(self)); } } [IteratorStateMachine(typeof(<HoldBodyFromIdleUpdate>d__89))] private static IEnumerator HoldBodyFromIdleUpdate(CharacterBody body) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HoldBodyFromIdleUpdate>d__89(0) { body = body }; } private static void OnLeaveStage(orig_Begin orig, SceneExitController self) { orig.Invoke(self); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.LeaveStage?.Invoke(val); } } } private static void OnSkillActivated(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill) { orig.Invoke(self, skill); if (HasEventSkin(((Component)self).gameObject)) { if ((Object)(object)skill == (Object)(object)self.skillLocator.primary) { MwSkinEvents.UsePrimary?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.secondary) { MwSkinEvents.UseSecondary?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.utility) { MwSkinEvents.UseUtility?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.special) { MwSkinEvents.UseSpecial?.Invoke(((Component)self).gameObject); } } } private static void OnChanceShrineInteract(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) int successfulPurchaseCount = self.successfulPurchaseCount; orig.Invoke(self, activator); if (HasEventSkin(((Component)activator).gameObject)) { bool success = successfulPurchaseCount < self.successfulPurchaseCount; NetMessageExtensions.Send((INetMessage)(object)new SyncUseShrine(((Component)activator).GetComponent<CharacterBody>().master.bodyInstanceId, success), (NetworkDestination)1); } } private static void OnHoldoutZoneCharged(orig_Start orig, HoldoutZoneController self) { orig.Invoke(self); ((UnityEvent<HoldoutZoneController>)(object)self.onCharged).AddListener((UnityAction<HoldoutZoneController>)delegate { NetMessageExtensions.Send((INetMessage)(object)new SyncHoldoutZoneCharged(), (NetworkDestination)1); }); } private static void OnMithrixDefeat(orig_OnEnter orig, EncounterFinished self) { orig.Invoke(self); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.MithrixDefeat?.Invoke(val); } } } private static void OnPickupAttemptGrant(ILContext il) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) Action<CharacterBody, PickupDef> action = delegate(CharacterBody body, PickupDef pickupDef) { //IL_0017: 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_0027: Expected I4, but got Unknown if (HasEventSkin(((Component)body).gameObject)) { NetMessageExtensions.Send((INetMessage)(object)new SyncGetItem(body.master.bodyInstanceId, (int)pickupDef.itemIndex), (NetworkDestination)1); } }; ILCursor c = new ILCursor(il); if (c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2) }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<GrantContext>(x, "shouldDestroy") && c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<GenericPickupController>(x, "consumed") }) })) { c.Emit(OpCodes.Ldarg_1); c.Emit(OpCodes.Ldloc_1); c.EmitDelegate<Action<CharacterBody, PickupDef>>(action); } else { MariCommandoPlugin.InstanceLogger.LogError((object)"OnPickupAttemptGrant ILHook failed. Pickup interaction related events will not occur"); } } private static void OnUseEquipment(EquipmentSlot self, EquipmentIndex index) { if (HasEventSkin(((Component)self.characterBody).gameObject)) { MwSkinEvents.UseEquipment?.Invoke(((Component)self.characterBody).gameObject); } } private static void OnDefeatBossGroup(BossGroup bossGroup) { foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.DefeatBossGroup?.Invoke(val); } } } private static void OnTeleporterEnd(TeleporterInteraction teleporterInteraction) { foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.TeleporterEnd?.Invoke(val); } } } private static void OnTakeDamage(DamageDealtMessage damageMessage) { if (!((Object)(object)damageMessage?.victim != (Object)null)) { return; } SkinDef val = SkinCatalog.FindCurrentSkinDefForBodyInstance(damageMessage?.victim); if (!((Object)(object)eventSkin == (Object)(object)val)) { return; } Action<GameObject, DamageDealtMessage> takeDamage = MwSkinEvents.TakeDamage; if (takeDamage != null) { object arg; if (damageMessage == null) { arg = null; } else { GameObject victim = damageMessage.victim; arg = ((victim != null) ? victim.gameObject : null); } takeDamage((GameObject)arg, damageMessage); } } private static void OnHeal(HealthComponent self, float amount, ProcChainMask procChainMask) { object obj; if (self == null) { obj = null; } else { CharacterBody body = self.body; obj = ((body != null) ? ((Component)body).gameObject : null); } GameObject val = (GameObject)obj; if (HasEventSkin(val)) { MwSkinEvents.Heal?.Invoke(val, amount); } } private static void OnLevelUp(CharacterBody characterBody) { GameObject obj = ((characterBody != null) ? ((Component)characterBody).gameObject : null); if (HasEventSkin(obj)) { MwSkinEvents.LevelUp?.Invoke(obj); } } } public class SyncGetItem : INetMessage, ISerializableObject { private NetworkInstanceId netInstanceId; private int itemIndex; public SyncGetItem() { } public SyncGetItem(NetworkInstanceId netInstanceId, int itemIndex) { //IL_0009: 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) this.netInstanceId = netInstanceId; this.itemIndex = itemIndex; } public void Serialize(NetworkWriter writer) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) writer.Write(netInstanceId); writer.Write(itemIndex); } public void Deserialize(NetworkReader reader) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) netInstanceId = reader.ReadNetworkId(); itemIndex = reader.ReadInt32(); } public void OnReceived() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(netInstanceId); if ((Object)(object)val != (Object)null) { MwSkinEvents.InvokeGetItem(val, itemIndex); } } } public class SyncUseShrine : INetMessage, ISerializableObject { private NetworkInstanceId netInstanceId; private bool success; public SyncUseShrine() { } public SyncUseShrine(NetworkInstanceId netInstanceId, bool success) { //IL_0009: 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) this.netInstanceId = netInstanceId; this.success = success; } public void Serialize(NetworkWriter writer) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) writer.Write(netInstanceId); writer.Write(success); } public void Deserialize(NetworkReader reader) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) netInstanceId = reader.ReadNetworkId(); success = reader.ReadBoolean(); } public void OnReceived() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(netInstanceId); if ((Object)(object)val != (Object)null) { MwSkinEvents.InvokeUseShrine(val, success); } } } public class SyncHoldoutZoneCharged : INetMessage, ISerializableObject { public void Serialize(NetworkWriter writer) { } public void Deserialize(NetworkReader reader) { } public void OnReceived() { MwSkinEvents.InvokeHoldoutZoneCharged(); } } public class MwTransformController : MonoBehaviour { public float armInwardMult = 0.04f; public float armForwardMult = 0.06f; public float armScaleFactor = 0.6092f; public bool isInRun; private Transform leftArm; private Transform rightArm; public static void Init() { SubscribeEvents(); } private static void SubscribeEvents() { MwSkinEvents.SkinAppliedRun += AddTransformControllerRun; MwSkinEvents.SkinAppliedLobby += AddTransformControllerLobby; MwSkinEvents.Death += SetIsDead; MwSkinEvents.DifferentSkinApplied += RemoveTransformController; } private static void AddTransformControllerRun(GameObject body) { MwTransformController mwTransformController = body.AddComponent<MwTransformController>(); mwTransformController.isInRun = true; } private static void RemoveTransformController(GameObject body) { MwTransformController mwTransformController = ((body != null) ? body.GetComponent<MwTransformController>() : null); if ((Object)(object)mwTransformController != (Object)null) { Object.Destroy((Object)(object)mwTransformController); } } private static void AddTransformControllerLobby(GameObject body) { MwTransformController mwTransformController = body.GetComponent<MwTransformController>(); if ((Object)(object)mwTransformController == (Object)null) { mwTransformController = body.AddComponent<MwTransformController>(); } mwTransformController.isInRun = false; } private void Start() { if (isInRun) { AssignLimbsRun(); } else { AssignLimbsLobby(); } } private void AssignLimbsRun() { leftArm = ((Component)((Component)((Component)this).GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>().FindChild("UpperArmL")).transform; rightArm = ((Component)((Component)((Component)this).GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>().FindChild("UpperArmR")).transform; } private void AssignLimbsLobby() { leftArm = ((Component)this).transform.Find("CommandoArmature/ROOT/base/stomach/chest/upper_arm.l"); rightArm = ((Component)this).transform.Find("CommandoArmature/ROOT/base/stomach/chest/upper_arm.r"); } private void LateUpdate() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) ApplyScale(); ApplyPosition(); leftArm.localScale = Vector3.one * armScaleFactor; Transform obj = leftArm; obj.localPosition += Vector3.right * armInwardMult + Vector3.forward * armForwardMult; rightArm.localScale = Vector3.one * armScaleFactor; Transform obj2 = rightArm; obj2.localPosition += Vector3.left * armInwardMult + Vector3.forward * armForwardMult; } private void ApplyScale() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) leftArm.localScale = Vector3.one * armScaleFactor; rightArm.localScale = Vector3.one * armScaleFactor; } private void ApplyPosition() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0028: 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_0032: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Transform obj = leftArm; obj.localPosition += Vector3.right * armInwardMult + Vector3.forward * armForwardMult; Transform obj2 = rightArm; obj2.localPosition += Vector3.left * armInwardMult + Vector3.forward * armForwardMult; } private static void SetIsDead(GameObject body) { MwTransformController mwTransformController = ((body != null) ? body.GetComponent<MwTransformController>() : null); if ((Object)(object)mwTransformController != (Object)null) { ((Behaviour)mwTransformController).enabled = false; } } } public static class MwUtils { [CompilerGenerated] private sealed class <ExecuteWhenNearPosition>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action action; public GameObject gameObject; public Vector3 position; public float maxWait; private float <stopwatch>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExecuteWhenNearPosition>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0063: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stopwatch>5__1 = 0f; break; case 1: <>1__state = -1; break; } if (Vector3.Distance(gameObject.transform.position, position) > 0.5f && <stopwatch>5__1 < maxWait) { <stopwatch>5__1 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } action?.Invoke(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Random rand = new Random(); public static object RandomChoices(IEnumerable<object> choices, IEnumerable<float> weights) { List<float> list = new List<float>(); float num = 0f; foreach (float weight in weights) { num += weight; list.Add(num); } float num2 = (float)rand.NextDouble() * num; int num3 = 0; foreach (object choice in choices) { if (num2 <= list[num3]) { return choice; } num3++; } MariCommandoPlugin.InstanceLogger.LogWarning((object)"RandomChoices: Couldn't make a choice - returning null!"); return null; } public static object RandomChoice(IEnumerable<object> choices) { IList<object> list = (choices as IList<object>) ?? choices.ToList(); if (list.Count > 0) { return list[rand.Next(list.Count)]; } MariCommandoPlugin.InstanceLogger.LogWarning((object)"RandomChoice: Got passed an empty enumerable - returning null!"); return null; } public static object RandomChoice(object[] choices) { if (choices.Length != 0) { return choices[rand.Next(choices.Length)]; } MariCommandoPlugin.InstanceLogger.LogWarning((object)"RandomChoice: Got passed an empty enumerable - returning null!"); return null; } [IteratorStateMachine(typeof(<ExecuteWhenNearPosition>d__4))] public static IEnumerator ExecuteWhenNearPosition(Action action, GameObject gameObject, Vector3 position, float maxWait = 1f) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ExecuteWhenNearPosition>d__4(0) { action = action, gameObject = gameObject, position = position, maxWait = maxWait }; } } } namespace RuneFoxMods { internal class Utils { public static void PrintBodyCatalog() { Debug.Log((object)"\nBodyCatalog"); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { Debug.Log((object)((Object)allBodyPrefab).name); } Debug.Log((object)"\n"); } public static void ReadChildren(GameObject parent, int tabs, bool includecomponents = true) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } for (int j = 0; j < parent.transform.childCount; j++) { Transform child = parent.transform.GetChild(j); if ((Object)(object)child == (Object)null) { break; } string text2 = ((Component)child).gameObject.activeInHierarchy.ToString(); string[] obj = new string[6] { text, ((Object)child).name, " ", text2, " ", null }; Vector3 position = ((Component)child).transform.position; obj[5] = ((object)(Vector3)(ref position)).ToString(); Debug.Log((object)string.Concat(obj)); if (includecomponents) { ReadComponents(((Component)child).gameObject, tabs + 1); Debug.Log((object)""); } ReadChildren(((Component)child).gameObject, tabs + 1, includecomponents); } } public static void readheiarchy(GameObject parent, bool includeComponents = true) { Debug.Log((object)((Object)parent).name); if (includeComponents) { ReadComponents(parent, 1); Debug.Log((object)""); } ReadChildren(parent, 1, includeComponents); } public static void ReadComponents(GameObject obj, int tabs) { string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } Component[] components = obj.GetComponents(typeof(Component)); Component[] array = components; foreach (Component val in array) { string text2 = ""; Debug.Log((object)(text + "Comp: " + ((object)val).GetType().ToString() + " " + text2)); } } public static void PrintAllPaths(GameObject parent) { Debug.Log((object)((Object)parent).name); PrintAllPathsInner(parent, ((Object)parent).name); } private static void PrintAllPathsInner(GameObject parent, string parent_string) { int childCount = parent.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = parent.transform.GetChild(i); if (((Object)child).name.EndsWith("_end")) { break; } string text = parent_string + "/" + ((Object)child).name; Debug.Log((object)(" " + ((Object)child).name + "\t\t" + text)); PrintAllPathsInner(((Component)child).gameObject, text); } } public static void PrintDynamicBone(DynamicBone DB) { //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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Root: " + (object)DB.m_Root)); Debug.Log((object)("Damping: " + DB.m_Damping)); Debug.Log((object)("Damping Dist: " + (object)DB.m_DampingDistrib)); Debug.Log((object)("Elasticity: " + DB.m_Elasticity)); Debug.Log((object)("Elasticity Dist: " + (object)DB.m_ElasticityDistrib)); Debug.Log((object)("Stiffness: " + DB.m_Stiffness)); Debug.Log((object)("Stiffness Dist: " + (object)DB.m_StiffnessDistrib)); Debug.Log((object)("Inert: " + DB.m_Inert)); Debug.Log((object)("Inert Dist: " + (object)DB.m_InertDistrib)); Debug.Log((object)("Radius: " + DB.m_Radius)); Debug.Log((object)("Radius Dist: " + (object)DB.m_RadiusDistrib)); Debug.Log((object)("End Length: " + DB.m_EndLength)); Vector3 val = DB.m_EndOffset; Debug.Log((object)("End Offset: " + ((object)(Vector3)(ref val)).ToString())); val = DB.m_Gravity; Debug.Log((object)("Gravity: " + ((object)(Vector3)(ref val)).ToString())); val = DB.m_Force; Debug.Log((object)("Force: " + ((object)(Vector3)(ref val)).ToString())); Debug.Log((object)("FreezeAxis: " + ((object)(FreezeAxis)(ref DB.m_FreezeAxis)).ToString())); Debug.Log((object)("Colliders: " + DB.m_Colliders.Count)); foreach (DynamicBoneCollider collider in DB.m_Colliders) { Debug.Log((object)("\t Parent: " + ((Object)((Component)collider).transform).name)); Debug.Log((object)("\t Direction: " + ((object)(Direction)(ref collider.m_Direction)).ToString())); val = collider.m_Center; Debug.Log((object)("\t Center " + ((object)(Vector3)(ref val)).ToString())); Debug.Log((object)("\t Bound " + ((object)(Bound)(ref collider.m_Bound)).ToString())); Debug.Log((object)("\t Radius " + collider.m_Radius)); Debug.Log((object)("\t Height " + collider.m_Height)); } Debug.Log((object)("Exclusions: " + DB.m_Exclusions.Count)); foreach (Transform exclusion in DB.m_Exclusions) { Debug.Log((object)("\t Transform: " + ((Object)exclusion).name)); } } public static ChildLocator GetChildLocator(GameObject body) { ChildLocator val = null; Transform child = body.transform.GetChild(0); if (Object.op_Implicit((Object)(object)child)) { Transform child2 = child.GetChild(0); if (Object.op_Implicit((Object)(object)child2)) { val = ((Component)child2).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)val)) { Debug.Log((object)"Locator Found"); } } } return val; } public static Transform FindChildInTree(Transform Root, string name) { Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(Root); while (queue.Count != 0) { Transform val = queue.Dequeue(); if (((Object)val).name == name) { return val; } for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); queue.Enqueue(child); } } return null; } public static string RemoveCloneNaming(string str) { return str.Remove(str.Length - 7); } } } namespace RuneFoxMods.DynamicSkins { public static class DynamicSkinHelpers { public static SkinnedMeshRenderer[] GetBaseSkinRenderers(GameObject modelObject) { SkinnedMeshRenderer[] componentsInChildren = modelObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if ((Object)(object)((Component)val).transform.parent == (Object)(object)modelObject.transform) { list.Add(val); } } return list.ToArray(); } public static Transform[] BoneArrayBuilder(Transform NewBoneRoot) { List<Transform> list = new List<Transform>(); BoneArrayBuilderHelper(NewBoneRoot, list); return list.ToArray(); } public static void BoneArrayBuilderHelper(Transform parent, List<Transform> list) { if (!((Object)parent).name.EndsWith("_end")) { list.Add(parent); } for (int i = 0; i < parent.childCount; i++) { BoneArrayBuilderHelper(parent.GetChild(i), list); } } public static Transform GetArmature(GameObject obj) { return GetArmatureHelper(obj); } public static Transform GetArmatureHelper(GameObject obj) { if (((Object)obj).name.ToLower().Contains("armature")) { return obj.transform; } for (int i = 0; i < obj.transform.childCount; i++) { Transform armatureHelper = GetArmatureHelper(((Component)obj.transform.GetChild(i)).gameObject); if (Object.op_Implicit((Object)(object)armatureHelper)) { return armatureHelper; } } return null; } public static Transform GetTopParent(Transform obj) { Transform val = obj; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } return val; } public static string GetPrevBoneInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return ((Object)bones[i]).name; } } return null; } public static int GetBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length; i++) { if (((Object)bones[i]).name == ((Object)targetBone).name) { return i; } } return -1; } public static int GetPrevBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return i; } } return -1; } } internal class DynamicSkinManager { internal Dictionary<string, SkinDef> SkinDefs = new Dictionary<string, SkinDef>(); private GameObject LastModelObject; internal Dictionary<string, SortedList<int, Modification>> ModificationList = new Dictionary<string, SortedList<int, Modification>>(); private Dictionary<GameObject, AppliedModifications> ModifiedObjects = new Dictionary<GameObject, AppliedModifications>(); internal ManualLogSource InstanceLogger; internal void AddModification(string skinNameToken, int boneIndex, Modification modification) { if (!ModificationList.TryGetValue(skinNameToken, out var value)) { value = new SortedList<int, Modification>(); ModificationList.Add(skinNameToken, value); } value.Add(boneIndex, modification); } internal void AddSkinDef(SkinDef skinDef) { SkinDefs.Add(skinDef.nameToken, skinDef); } internal IEnumerator SkinDefApply(Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator> orig, SkinDef self, GameObject modelObject, List<AssetReferenceT<Material>> loadedMaterials, List<AssetReferenceT<Mesh>> loadedMeshes, int unloadType) { IEnumerator result = orig(self, modelObject, loadedMaterials, loadedMeshes, unloadType); RemoveInvalidModelObjects(); ModifiedObjects.TryGetValue(modelObject, out var value); try { if (!SkinDefs.TryGetValue(self.nameToken, out var _)) { if (value != null) { ClearSkinModifications(LastModelObject, value); } return result; } if (value == null) { AppliedModifications appliedModifications = new AppliedModifications(); ModifiedObjects.Add(modelObject, appliedModifications); ApplySkinModifications(self, modelObject, appliedModifications); } } catch (Exception ex) { InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin"); InstanceLogger.LogError((object)ex); } return result; } private void RemoveInvalidModelObjects() { foreach (GameObject item in ModifiedObjects.Keys.Where((GameObject el) => !Object.op_Implicit((Object)(object)el)).ToList()) { ModifiedObjects.Remove(item); } } private void ClearSkinModifications(GameObject modelObject, AppliedModifications modifications) { while (modifications.BaseModelModifications.Count != 0) { Modification modification = modifications.BaseModelModifications.Pop(); clearModification(modification, modelObject, modifications); } while (modifications.OtherModifications.Count != 0) { clearModification(modifications.OtherModifications[0], modelObject, modifications); } ModifiedObjects.Remove(modelObject); } private void ApplySkinModifications(SkinDef skindef, GameObject modelObject, AppliedModifications modifications) { CharacterModel component = modelObject.GetComponent<CharacterModel>(); LastModelObject = modelObject; if (!ModificationList.TryGetValue(skindef.nameToken, out var value)) { return; } foreach (KeyValuePair<int, Modification> item in value) { ApplyModification(modelObject, component, item.Value, modifications); } } private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications) { string bodyname = modification.bodyname; string parentname = modification.parentname; Transform val = Utils.FindChildInTree(modelObject.transform, parentname); GameObject val2; if (modification.affectsbasemodel) { val2 = Object.Instantiate<GameObject>(modification.prefab, val, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; modification.inst_armature = val2; ModificationApplyBones(modelObject, modification, modifications); } else { val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; Transform armature = DynamicSkinHelpers.GetArmature(val2); ((Component)armature).transform.SetParent(val, false); modification.inst_armature = ((Component)armature).gameObject; } modification.instance = val2; if (modification.dynamicBoneData != null) { ModificationApplyDynamicBones(modelObject, modification); } ModificationAddRenderers(val2, characterModel); modifications.OtherModifications.Add(modification); } private static void ModificationApplyBones(GameObject modelObject, Modification modification, AppliedModifications modifications) { SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject); List<Transform> list = baseSkinRenderers[0].bones.ToList(); Transform[] array = DynamicSkinHelpers.BoneArrayBuilder(modification.instance.transform); list.InsertRange(modification.boneIndex, array); modification.boneCount = array.Length; SkinnedMeshRenderer[] array2 = baseSkinRenderers; foreach (SkinnedMeshRenderer val in array2) { val.bones = list.ToArray(); } modifications.BaseModelModifications.Push(modification); } private static void ModificationApplyDynamicBones(GameObject modelObject, Modification modification) { //IL_005e: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) DynamicBone val = (modification.inst_dynamicBone = modification.instance.AddComponent<DynamicBone>()); List<DynamicBoneCollider> list = new List<DynamicBoneCollider>(); foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders) { Transform val2 = Utils.FindChildInTree(modelObject.transform, collider.m_parent_name); DynamicBoneCollider val3 = ((Component)val2).gameObject.AddComponent<DynamicBoneCollider>(); val3.m_Direction = collider.m_Direction; val3.m_Center = collider.m_Center; val3.m_Bound = collider.m_Bound; val3.m_Radius = collider.m_Radius; val3.m_Height = collider.m_Height; list.Add(val3); } modification.inst_DB_colliders = list; Transform root = (val.m_Root = Utils.FindChildInTree(modification.inst_armature.transform, modification.dynamicBoneData.m_Root)); val.m_Damping = modification.dynamicBoneData.m_Damping; val.m_DampingDistrib = modification.dynamicBoneData.m_DampingDistrib; val.m_Elasticity = modification.dynamicBoneData.m_Elasticity; val.m_ElasticityDistrib = modification.dynamicBoneData.m_ElasticityDistrib; val.m_Stiffness = modification.dynamicBoneData.m_Stiffness; val.m_StiffnessDistrib = modification.dynamicBoneData.m_StiffnessDistrib; val.m_Inert = modification.dynamicBoneData.m_Inert; val.m_InertDistrib = modification.dynamicBoneData.m_InertDistrib; val.m_Radius = modification.dynamicBoneData.m_Radius; val.m_RadiusDistrib = modification.dynamicBoneData.m_RadiusDistrib; val.m_EndLength = modification.dynamicBoneData.m_EndLength; val.m_EndOffset = modification.dynamicBoneData.m_EndOffset; val.m_Gravity = modification.dynamicBoneData.m_Gravity; val.m_Force = modification.dynamicBoneData.m_Force; val.m_Colliders = list; val.m_Exclusions = new List<Transform>(); foreach (string exclusion in modification.dynamicBoneData.m_Exclusions) { Transform val4 = Utils.FindChildInTree(root, exclusion); if ((Object)(object)val4 != (Object)null) { val.m_Exclusions.Add(val4); } else { Debug.LogWarning((object)"Tried to exclude a transform that could not be found"); } } val.m_FreezeAxis = modification.dynamicBoneData.m_FreezeAxis; } private static void ModificationAddRenderers(GameObject newPart, CharacterModel characterModel) { //IL_0050: Unknown result type (
TrackMariCommandoVoiceover.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BaseVoiceoverLib; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using R2API; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using TrackMariCommandoVoiceover.Components; using TrackMariCommandoVoiceover.Modules; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TrackMariCommandoVoiceover")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a74fa81e8d61cbb2c92cb75cfe0e2a7a25a9e64e")] [assembly: AssemblyProduct("TrackMariCommandoVoiceover")] [assembly: AssemblyTitle("TrackMariCommandoVoiceover")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace TrackMariCommandoVoiceover { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Schale.TrackMariCommandoVoiceover", "TrackMariCommandoVoiceover", "1.0.0")] public class TrackMariCommandoVoiceoverPlugin : BaseUnityPlugin { public class NSEInfo { public NetworkSoundEventDef nse; public uint akId = 0u; public string eventName = string.Empty; public NSEInfo(NetworkSoundEventDef source) { nse = source; akId = source.akId; eventName = source.eventName; } private void DisableSound() { nse.akId = 0u; nse.eventName = string.Empty; } private void EnableSound() { nse.akId = akId; nse.eventName = eventName; } public void ValidateParams() { if (akId == 0) { akId = nse.akId; } if (eventName == string.Empty) { eventName = nse.eventName; } if (!enableVoicelines.Value) { DisableSound(); } else { EnableSound(); } } } public static ConfigEntry<bool> enableVoicelines; public static bool playedSeasonalVoiceline = false; public static AssetBundle assetBundle; public static SurvivorDef survivorDef = Addressables.LoadAssetAsync<SurvivorDef>((object)"RoR2/Base/Commando/Commando.asset").WaitForCompletion(); public static ConfigEntry<KeyboardShortcut> btnTitle; public static ConfigEntry<KeyboardShortcut> btnThanks; public static ConfigEntry<KeyboardShortcut> btnHurt; public static ConfigEntry<KeyboardShortcut> btnEx1; public static ConfigEntry<KeyboardShortcut> btnEx2; public static ConfigEntry<KeyboardShortcut> btnEx3; public static ConfigEntry<KeyboardShortcut> btnExL1; public static ConfigEntry<KeyboardShortcut> btnExL2; public static ConfigEntry<KeyboardShortcut> btnExL3; public static ConfigEntry<KeyboardShortcut> btnExN1; public static ConfigEntry<KeyboardShortcut> btnExN2; public static ConfigEntry<KeyboardShortcut> btnExN3; public static ConfigEntry<KeyboardShortcut> btnExNL1; public static ConfigEntry<KeyboardShortcut> btnExNL2; public static ConfigEntry<KeyboardShortcut> btnExNL3; public static ConfigEntry<KeyboardShortcut> btnCommon; public static ConfigEntry<KeyboardShortcut> btnTactical; public static List<NSEInfo> nseList = new List<NSEInfo>(); public void Awake() { //IL_007e: 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_0099: Expected O, but got Unknown //IL_0099: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //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_011f: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0159: 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_0169: Expected O, but got Unknown //IL_017e: 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_018e: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //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_01d8: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //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_0247: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Expected O, but got Unknown //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02cb: 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_02db: Expected O, but got Unknown //IL_02f0: 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_0300: Expected O, but got Unknown //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_0325: Expected O, but got Unknown Files.PluginInfo = ((BaseUnityPlugin)this).Info; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad)); new Content().Initialize(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrackMariCommandoVoiceover.trackmaricommandovoiceoverbundle")) { assetBundle = AssetBundle.LoadFromStream(stream); } SoundBanks.Init(); InitNSE(); enableVoicelines = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Settings", "Enable Voicelines"), true, new ConfigDescription("Enable voicelines when using the Track Mari Commando Skin.", (AcceptableValueBase)null, Array.Empty<object>())); enableVoicelines.SettingChanged += EnableVoicelines_SettingChanged; btnHurt = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Hurt"), KeyboardShortcut.Empty, (ConfigDescription)null); btnThanks = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Thanks"), KeyboardShortcut.Empty, (ConfigDescription)null); btnCommon = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Common Skill"), KeyboardShortcut.Empty, (ConfigDescription)null); btnTactical = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Tactical Action"), KeyboardShortcut.Empty, (ConfigDescription)null); btnTitle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Blue Archive"), KeyboardShortcut.Empty, (ConfigDescription)null); btnEx1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX 1"), KeyboardShortcut.Empty, (ConfigDescription)null); btnEx2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX 2"), KeyboardShortcut.Empty, (ConfigDescription)null); btnEx3 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX 3"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExL1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX Level 1"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExL2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX Level 2"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExL3 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "EX Level 3"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExN1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX 1"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExN2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX 2"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExN3 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX 3"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExNL1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX Level 1"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExNL2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX Level 2"), KeyboardShortcut.Empty, (ConfigDescription)null); btnExNL3 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("Keybinds", "Normal EX Level 3"), KeyboardShortcut.Empty, (ConfigDescription)null); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat(); } } private void EnableVoicelines_SettingChanged(object sender, EventArgs e) { RefreshNSE(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void RiskOfOptionsCompat() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableVoicelines)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnTitle)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnThanks)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnTactical)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnCommon)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnHurt)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnEx1)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnEx2)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnEx3)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExL1)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExL2)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExL3)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExN1)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExN2)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExN3)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExNL1)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExNL2)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(btnExNL3)); ModSettingsManager.SetModIcon(assetBundle.LoadAsset<Sprite>("trackmariicon")); } private void OnLoad() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown SkinDef val = null; SkinDef[] array = SkinCatalog.FindSkinsForBody(BodyCatalog.FindBodyIndex("CommandoBody")); SkinDef[] array2 = array; foreach (SkinDef val2 in array2) { if (((Object)val2).name == "DefTrackMariCommando") { val = val2; break; } } if (!Object.op_Implicit((Object)(object)val)) { Debug.LogError((object)"TrackMariCommandoVoiceover: Track Mari Commando SkinDef not found. Voicelines will not work!"); } else { VoiceoverInfo val3 = new VoiceoverInfo(typeof(TrackMariCommandoVoiceoverComponent), val, "CommandoBody"); val3.selectActions = (LobbySelectActions)Delegate.Combine((Delegate?)(object)val3.selectActions, (Delegate?)new LobbySelectActions(TrackMariSelect)); } RefreshNSE(); } private void TrackMariSelect(GameObject mannequinObject) { if (!enableVoicelines.Value) { return; } bool flag = false; if (!playedSeasonalVoiceline) { if ((DateTime.Today.Month == 1 && DateTime.Today.Day == 1) || (DateTime.Today.Month == 12 && DateTime.Today.Day == 31)) { Util.PlaySound("Play_TrackMariCommando_Lobby_Newyear", mannequinObject); flag = true; } else if (DateTime.Today.Month == 9 && DateTime.Today.Day == 12) { Util.PlaySound("Play_TrackMariCommando_Lobby_bday", mannequinObject); flag = true; } else if (DateTime.Today.Month == 10 && DateTime.Today.Day == 31) { Util.PlaySound("Play_TrackMariCommando_Lobby_Halloween", mannequinObject); flag = true; } else if (DateTime.Today.Month == 12 && (DateTime.Today.Day == 24 || DateTime.Today.Day == 25)) { Util.PlaySound("Play_TrackMariCommando_Lobby_xmas", mannequinObject); flag = true; } if (flag) { playedSeasonalVoiceline = true; } } if (!flag) { if (Util.CheckRoll(5f, 0f, (CharacterMaster)null)) { Util.PlaySound("Play_TrackMariCommando_Title", mannequinObject); } else { Util.PlaySound("Play_TrackMariCommando_Lobby", mannequinObject); } } } private void InitNSE() { TrackMariCommandoVoiceoverComponent.nseShout = RegisterNSE("Play_TrackMariCommando_Shout"); TrackMariCommandoVoiceoverComponent.nseBlock = RegisterNSE("Play_TrackMariCommando_Block"); TrackMariCommandoVoiceoverComponent.nseDisappoint = RegisterNSE("Play_TrackMariCommando_Covered"); TrackMariCommandoVoiceoverComponent.nseTacticalAction = RegisterNSE("Play_TrackMariCommando_TacticalAction"); TrackMariCommandoVoiceoverComponent.nseCommonSkill = RegisterNSE("Play_TrackMariCommando_CommonSkill"); TrackMariCommandoVoiceoverComponent.nseHurt = RegisterNSE("Play_TrackMariCommando_Hurt"); TrackMariCommandoVoiceoverComponent.nseThanks = RegisterNSE("Play_TrackMariCommando_Recovery"); TrackMariCommandoVoiceoverComponent.nseTitle = RegisterNSE("Play_TrackMariCommando_Title"); TrackMariCommandoVoiceoverComponent.nseEx1 = RegisterNSE("Play_TrackMariCommando_EX_1"); TrackMariCommandoVoiceoverComponent.nseEx2 = RegisterNSE("Play_TrackMariCommando_EX_2"); TrackMariCommandoVoiceoverComponent.nseEx3 = RegisterNSE("Play_TrackMariCommando_EX_3"); TrackMariCommandoVoiceoverComponent.nseExL1 = RegisterNSE("Play_TrackMariCommando_EX_Level_1"); TrackMariCommandoVoiceoverComponent.nseExL2 = RegisterNSE("Play_TrackMariCommando_EX_Level_2"); TrackMariCommandoVoiceoverComponent.nseExL3 = RegisterNSE("Play_TrackMariCommando_EX_Level_3"); TrackMariCommandoVoiceoverComponent.nseExN1 = RegisterNSE("Play_TrackMariCommando_Normal_EX_1"); TrackMariCommandoVoiceoverComponent.nseExN2 = RegisterNSE("Play_TrackMariCommando_Normal_EX_2"); TrackMariCommandoVoiceoverComponent.nseExN3 = RegisterNSE("Play_TrackMariCommando_Normal_EX_3"); TrackMariCommandoVoiceoverComponent.nseExNL1 = RegisterNSE("Play_TrackMariCommando_Normal_EX_Level_1"); TrackMariCommandoVoiceoverComponent.nseExNL2 = RegisterNSE("Play_TrackMariCommando_Normal_EX_Level_2"); TrackMariCommandoVoiceoverComponent.nseExNL3 = RegisterNSE("Play_TrackMariCommando_Normal_EX_Level_3"); } private NetworkSoundEventDef RegisterNSE(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.eventName = eventName; Content.networkSoundEventDefs.Add(val); nseList.Add(new NSEInfo(val)); return val; } public void RefreshNSE() { foreach (NSEInfo nse in nseList) { nse.ValidateParams(); } } } } namespace TrackMariCommandoVoiceover.Modules { public class Content : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; public Content <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; public Content <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(<>4__this.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public Content <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.contentPack.identifier = <>4__this.identifier; <>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal ContentPack contentPack = new ContentPack(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.Schale.TrackMariCommandoVoiceover"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__6))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__6(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__7))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__7(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__8))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__8(0) { <>4__this = this, args = args }; } } public static class Files { public static PluginInfo PluginInfo; internal static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location); internal static void Init(PluginInfo info) { PluginInfo = info; } internal static string GetPathToFile(string folderName, string fileName) { return Path.Combine(assemblyDir, folderName, fileName); } } public static class SoundBanks { private static bool initialized; public static string SoundBankDirectory => Files.assemblyDir; public static void Init() { if (initialized) { return; } initialized = true; using Stream stream = new FileStream(SoundBankDirectory + "\\TrackMariCommandoSoundbank.bnk", FileMode.Open); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); SoundBanks.Add(array); } } } namespace TrackMariCommandoVoiceover.Components { public class TrackMariCommandoVoiceoverComponent : BaseVoiceoverComponent { public static NetworkSoundEventDef nseShout; public static NetworkSoundEventDef nseBlock; public static NetworkSoundEventDef nseDisappoint; public static NetworkSoundEventDef nseCommonSkill; public static NetworkSoundEventDef nseTacticalAction; public static NetworkSoundEventDef nseHurt; public static NetworkSoundEventDef nseTitle; public static NetworkSoundEventDef nseThanks; public static NetworkSoundEventDef nseEx1; public static NetworkSoundEventDef nseEx2; public static NetworkSoundEventDef nseEx3; public static NetworkSoundEventDef nseExL1; public static NetworkSoundEventDef nseExL2; public static NetworkSoundEventDef nseExL3; public static NetworkSoundEventDef nseExN1; public static NetworkSoundEventDef nseExN2; public static NetworkSoundEventDef nseExN3; public static NetworkSoundEventDef nseExNL1; public static NetworkSoundEventDef nseExNL2; public static NetworkSoundEventDef nseExNL3; private float levelCooldown = 0f; private float blockedCooldown = 0f; private float lowHealthCooldown = 0f; private float shrineFailCooldown = 0f; private float specialCooldown = 0f; private float utilityCooldown = 0f; private bool acquiredScepter = false; protected override void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) ((BaseVoiceoverComponent)this).Start(); if (Object.op_Implicit((Object)(object)base.inventory) && base.inventory.GetItemCount(BaseVoiceoverComponent.scepterIndex) > 0) { acquiredScepter = true; } } protected override void FixedUpdate() { ((BaseVoiceoverComponent)this).FixedUpdate(); if (levelCooldown > 0f) { levelCooldown -= Time.fixedDeltaTime; } if (blockedCooldown > 0f) { blockedCooldown -= Time.fixedDeltaTime; } if (lowHealthCooldown > 0f) { lowHealthCooldown -= Time.fixedDeltaTime; } if (shrineFailCooldown > 0f) { shrineFailCooldown -= Time.fixedDeltaTime; } if (utilityCooldown > 0f) { utilityCooldown -= Time.fixedDeltaTime; } if (specialCooldown > 0f) { specialCooldown -= Time.fixedDeltaTime; } } public override void PlayDamageBlockedServer() { if (NetworkServer.active && !(blockedCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseBlock, 1.8f, false)) { blockedCooldown = 60f; } } public override void PlayDeath() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Defeat", 4f, true); } public override void PlayHurt(float percentHPLost) { if (percentHPLost >= 0.1f) { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Hurt", 0f, false); } } public override void PlayLevelUp() { if (!(levelCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Levelup", 5.3f, false)) { levelCooldown = 60f; } } public override void PlayLowHealth() { if (!(lowHealthCooldown > 0f) && Random.Range(0, 3) switch { 0 => ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Memorial_1_1", 5.3f, false), 1 => ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Memorial_2_2", 3.5f, false), _ => ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_EX_3", 2f, false), }) { lowHealthCooldown = 60f; } } public override void PlaySpawn() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Spawn", 2.35f, true); } public override void PlayTeleporterFinish() { switch (Random.Range(0, 4)) { case 0: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Victory_1", 3f, false); break; case 1: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Victory_2", 4f, false); break; case 2: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Victory_3", 3.2f, false); break; default: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Victory_4", 2.25f, false); break; } } public override void PlayTeleporterStart() { switch (Random.Range(0, 7)) { case 0: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_CommonSkill", 1.6f, false); break; case 1: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_1", 1.2f, false); break; case 2: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_2", 1.7f, false); break; case 3: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_3", 1.3f, false); break; case 4: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_Level_1", 2.2f, false); break; case 5: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_Level_2", 2f, false); break; default: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Normal_EX_Level_3", 2.2f, false); break; } } public override void PlayUtilityAuthority(GenericSkill skill) { if (!(utilityCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseShout, 0f, false)) { utilityCooldown = 20f; } } public override void PlayVictory() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Memorial_5", 24.5f, true); } protected override void Inventory_onItemAddedClient(ItemIndex itemIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 ((BaseVoiceoverComponent)this).Inventory_onItemAddedClient(itemIndex); if ((int)BaseVoiceoverComponent.scepterIndex != -1 && itemIndex == BaseVoiceoverComponent.scepterIndex) { PlayAcquireScepter(); return; } ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if ((Object)(object)itemDef == (Object)(object)Items.Squid || (Object)(object)itemDef == (Object)(object)Items.Plant || (Object)(object)itemDef == (Object)(object)Items.SlowOnHit) { PlayBadItem(); } else if (Object.op_Implicit((Object)(object)itemDef) && (int)itemDef.deprecatedTier == 2) { PlayAcquireLegendary(); } } public override void PlaySpecialAuthority(GenericSkill skill) { if (!(specialCooldown > 0f)) { bool flag = false; if ((!Util.CheckRoll(50f, 0f, (CharacterMaster)null)) ? ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseTacticalAction, 1.3f, false) : ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseCommonSkill, 1.9f, false)) { specialCooldown = 20f; } } } public void PlayAcquireScepter() { if (!acquiredScepter) { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_ExWeapon_Get", 8.5f, true); acquiredScepter = true; } } public void PlayBadItem() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Covered", 1f, false); } public void PlayAcquireLegendary() { switch (Random.Range(0, 4)) { case 0: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Relationship_1", 5.9f, false); break; case 1: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Relationship_2", 6.1f, false); break; case 2: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Relationship_3", 5.5f, false); break; default: ((BaseVoiceoverComponent)this).TryPlaySound("Play_TrackMariCommando_Relationship_4", 4.6f, false); break; } } public override void PlayShrineOfChanceFailServer() { if (!(shrineFailCooldown > 0f) && Util.CheckRoll(15f, 0f, (CharacterMaster)null) && ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseDisappoint, 1f, false)) { shrineFailCooldown = 60f; } } protected override void CheckInputs() { if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnTitle)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseTitle, 1.1f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnThanks)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseThanks, 2.75f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnHurt)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseHurt, 0.1f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnTactical)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseTacticalAction, 1.3f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnCommon)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseCommonSkill, 1.9f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnEx1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseEx1, 1.7f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnEx2)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseEx2, 2.1f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnEx1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseEx3, 2f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExL1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExL1, 1.6f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExL2)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExL2, 2.2f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExL3)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExL3, 2.9f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExN1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExN1, 1.25f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExN2)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExN2, 1.7f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExN1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExN3, 1.3f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExNL1)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExNL1, 2.2f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExNL2)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExNL2, 2f, false); } else if (Utils.GetKeyPressed(TrackMariCommandoVoiceoverPlugin.btnExNL3)) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseExNL3, 2.2f, false); } } public override bool ComponentEnableVoicelines() { return TrackMariCommandoVoiceoverPlugin.enableVoicelines.Value; } } }