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.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using MonoMod.RuntimeDetour; using MonoMod.RuntimeDetour.HookGen; using MwSkinAdditions; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RuneFoxMods.DynamicSkins; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace MioHuntress { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Miyowi.MioHuntress", "MioHuntress", "1.0.4")] public class MioHuntressPlugin : BaseUnityPlugin { public class DynamicSkinExtension { private Modification DefMioHuntressBreastLModification; private Modification DefMioHuntressBreastRModification; private Modification DefMioHuntressCoatBackLModification; private Modification DefMioHuntressCoatBackRModification; private Modification DefMioHuntressCoatFrontLModification; private Modification DefMioHuntressCoatFrontRModification; private Modification DefMioHuntressEarLModification; private Modification DefMioHuntressEarRModification; private Modification DefMioHuntressHairBackLModification; private Modification DefMioHuntressHairBackMModification; private Modification DefMioHuntressHairBackRModification; private Modification DefMioHuntressHairFrontModification; internal void BeforeStart() { //IL_0038: 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>, List>, int, IEnumerator>, SkinDef, GameObject, List>, List>, int, IEnumerator>(_DynamicSkinManager.SkinDefApply)).Apply(); } internal void AfterStart() { InitializeModifications(); InitializeDynamicBones(); AddModificationsToList(); } internal void BeforeBodyCatalogInit() { HuntressBodyDefMioHuntressSkinAddedEvent += onSkinAdded; } internal void AfterBodyCatalogInit() { } private void InitializeModifications() { DefMioHuntressBreastLModification = new Modification("BreastL.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 60, AffectsBaseModel: true, assetBundle); DefMioHuntressBreastRModification = new Modification("BreastR.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 62, AffectsBaseModel: true, assetBundle); DefMioHuntressCoatBackLModification = new Modification("CoatBackL.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 64, AffectsBaseModel: true, assetBundle); DefMioHuntressCoatBackRModification = new Modification("CoatBackR.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 69, AffectsBaseModel: true, assetBundle); DefMioHuntressCoatFrontLModification = new Modification("CoatFrontL.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 74, AffectsBaseModel: true, assetBundle); DefMioHuntressCoatFrontRModification = new Modification("CoatFrontR.prefab", "chest", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 79, AffectsBaseModel: true, assetBundle); DefMioHuntressEarLModification = new Modification("EarL.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 54, AffectsBaseModel: true, assetBundle); DefMioHuntressEarRModification = new Modification("EarR.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 57, AffectsBaseModel: true, assetBundle); DefMioHuntressHairBackLModification = new Modification("HairBackL.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 43, AffectsBaseModel: true, assetBundle); DefMioHuntressHairBackMModification = new Modification("HairBackM.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 39, AffectsBaseModel: true, assetBundle); DefMioHuntressHairBackRModification = new Modification("HairBackR.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 47, AffectsBaseModel: true, assetBundle); DefMioHuntressHairFrontModification = new Modification("HairFront.prefab", "head", "HuntressBody", "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 51, AffectsBaseModel: true, assetBundle); } private void InitializeDynamicBones() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_024d: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) DefMioHuntressBreastLModification.dynamicBoneData = new DynamicBoneData("BreastL", 0.314f, null, 0.149f, null, 0.847f, null, 0.461f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressBreastRModification.dynamicBoneData = new DynamicBoneData("BreastR", 0.314f, null, 0.149f, null, 0.847f, null, 0.461f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressCoatBackLModification.dynamicBoneData = new DynamicBoneData("CoatBackL", 0.204f, null, 0.149f, null, 0.94f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressCoatBackRModification.dynamicBoneData = new DynamicBoneData("CoatBackR", 0.204f, null, 0.149f, null, 0.94f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressCoatFrontLModification.dynamicBoneData = new DynamicBoneData("CoatFrontL", 0.204f, null, 0.149f, null, 0.94f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressCoatFrontRModification.dynamicBoneData = new DynamicBoneData("CoatFrontR", 0.204f, null, 0.149f, null, 0.94f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressEarLModification.dynamicBoneData = new DynamicBoneData("EarL1", 0.59f, null, 0.082f, null, 0.75f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressEarRModification.dynamicBoneData = new DynamicBoneData("EarR1", 0.59f, null, 0.082f, null, 0.75f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List(), new List(), (FreezeAxis)0); DefMioHuntressHairBackLModification.dynamicBoneData = new DynamicBoneData("HairBackL", 0.468f, null, 0.058f, 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(), new List(), (FreezeAxis)0); DefMioHuntressHairBackMModification.dynamicBoneData = new DynamicBoneData("HairBackM", 0.468f, null, 0.058f, 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(), new List(), (FreezeAxis)0); DefMioHuntressHairBackRModification.dynamicBoneData = new DynamicBoneData("HairBackR", 0.468f, null, 0.058f, 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(), new List(), (FreezeAxis)0); DefMioHuntressHairFrontModification.dynamicBoneData = new DynamicBoneData("HairFront", 0.468f, null, 0.058f, 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(), new List(), (FreezeAxis)0); } private void AddModificationsToList() { _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 60, DefMioHuntressBreastLModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 62, DefMioHuntressBreastRModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 64, DefMioHuntressCoatBackLModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 69, DefMioHuntressCoatBackRModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 74, DefMioHuntressCoatFrontLModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 79, DefMioHuntressCoatFrontRModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 54, DefMioHuntressEarLModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 57, DefMioHuntressEarRModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 43, DefMioHuntressHairBackLModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 39, DefMioHuntressHairBackMModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 47, DefMioHuntressHairBackRModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", 51, DefMioHuntressHairFrontModification); } 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 class ElementException : Exception { public int Index { get; } public ElementException(int index, string message) : base(message) { Index = index; } } 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; public static AssetBundle assetBundle; public static ConfigFile config; private static readonly List materialsWithRoRShader = new List(); internal static MioHuntressPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { MioHuntressPlugin instance = Instance; if (instance == null) { return null; } return ((BaseUnityPlugin)instance).Logger; } } private static event EventHandler HuntressBodyDefMioHuntressSkinAddedEvent; private void Awake() { config = ((BaseUnityPlugin)this).Config; MwSkinEvents.CreateVoiceGroups(); Assets.Init(); } private void Start() { Instance = this; BeforeStart(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MioHuntress.miyowimiohuntress")) { assetBundle = AssetBundle.LoadFromStream(stream); } ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit); HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action, Language>(LanguageLoadStrings)); ReplaceShaders(); Options.Init(); 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/MioHuntress/Assets/matMio.mat", "Assets/Skins/MioHuntress/Assets/matMioBow.mat"); } private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Shader shader = Addressables.LoadAssetAsync((object)shaderPath).WaitForCompletion(); foreach (string text in materialPaths) { Material val = assetBundle.LoadAsset(text); val.shader = shader; materialsWithRoRShader.Add(val); } } private static void LanguageLoadStrings(Action orig, Language self) { orig(self); self.SetStringByToken("MIYOWI_SKIN_DEFMIOHUNTRESS_NAME", "Mio"); } private static void BodyCatalogInit() { BeforeBodyCatalogInit(); AddHuntressBodyDefMioHuntressSkin(); AfterBodyCatalogInit(); } private static void HuntressBodyDefMioHuntressSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { MioHuntressPlugin.HuntressBodyDefMioHuntressSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddHuntressBodyDefMioHuntressSkin() { string text = "HuntressBody"; string text2 = "DefMioHuntress"; 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(); 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() : 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(true); gameObject.GetComponentsInChildren(true); SkinDef skin = ScriptableObject.CreateInstance(); SkinDefParams skinParams = ScriptableObject.CreateInstance(); skin.skinDefParams = skinParams; TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset("Assets\\SkinMods\\MioHuntress\\Icons\\DefMioHuntressIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "MIYOWI_SKIN_DEFMIOHUNTRESS_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { ThrowIfOutOfBounds(0, "Index 0 is out of bounds of skins array", skinController.skins, 0) }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = null; }); TryCatchThrow("Game Object Activations", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[1] { new GameObjectActivation { gameObject = ((Component)ThrowIfNull(0, "There is no renderer with the name \"HuntressScarfMesh\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "HuntressScarfMesh")))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = false } }; }); 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_0079: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[10] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset("Assets/Skins/MioHuntress/Assets/matMio.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = ThrowIfNull(0, "There is no renderer with the name \"HuntressMesh\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "HuntressMesh"))) }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset("Assets/Skins/MioHuntress/Assets/matMioBow.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = ThrowIfNull(1, "There is no renderer with the name \"BowMesh\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "BowMesh"))) }, new RendererInfo { defaultMaterial = Assets.bowStringMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(2, "There is no renderer with the name \"BowString\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "BowString"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(3, "There is no renderer with the name \"Quad 1\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad 1"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(4, "There is no renderer with the name \"Quad 2\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad 2"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(5, "There is no renderer with the name \"Quad Cluster 1\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad Cluster 1"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(6, "There is no renderer with the name \"Quad Cluster 2\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad Cluster 2"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(7, "There is no renderer with the name \"Quad Cluster 3\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad Cluster 3"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(8, "There is no renderer with the name \"Quad Cluster 4\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad Cluster 4"))) }, new RendererInfo { defaultMaterial = Assets.arrowMat, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = true, renderer = ThrowIfNull(9, "There is no renderer with the name \"Quad Cluster 5\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "Quad Cluster 5"))) } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2] { new MeshReplacement { mesh = assetBundle.LoadAsset("Assets\\SkinMods\\MioHuntress\\Meshes\\Body.mesh"), renderer = ThrowIfNull(0, "There is no renderer with the name \"HuntressMesh\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "HuntressMesh"))) }, new MeshReplacement { mesh = assetBundle.LoadAsset("Assets\\SkinMods\\MioHuntress\\Meshes\\JuniperBowMesh.mesh"), renderer = ThrowIfNull(1, "There is no renderer with the name \"BowMesh\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "BowMesh"))) } }; }); TryCatchThrow("Light Infos", delegate { skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0]; }); TryCatchThrow("Minion Skin Replacements", delegate { skinParams.minionSkinReplacements = Array.Empty(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skinParams.projectileGhostReplacements = Array.Empty(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; MwSkinEvents.Init(skin); HuntressBodyDefMioHuntressSkinAdded(skin, val); } catch (FieldException ex) { if (ex.InnerException is ElementException ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}"); InstanceLogger.LogWarning((object)ex2.Message); InstanceLogger.LogError((object)ex.InnerException); } else { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } } catch (Exception ex3) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex3); } } private static T ThrowIfEquals(int index, string message, T value, T expected) where T : Enum { if (value.Equals(expected)) { throw new ElementException(index, message); } return value; } private static T ThrowIfOutOfBounds(int index, string message, T[] array, int elementIndex) where T : class { if (array == null || array.Length <= elementIndex) { throw new ElementException(index, message); } return array[elementIndex]; } private static T ThrowIfNull(int index, string message, T value) where T : class { if (value == null) { throw new ElementException(index, message); } return value; } private static void TryCatchThrow(string message, Action action) { try { action?.Invoke(); } catch (Exception innerException) { throw new FieldException(message, innerException); } } private static void TryAddComponent(GameObject obj) where T : Component { if (Object.op_Implicit((Object)(object)obj) && !Object.op_Implicit((Object)(object)obj.GetComponent())) { obj.AddComponent(); } } } public class Assets { public static Material bowStringMat; public static Material arrowMat; public static void Init() { CreateBowStringMat(); CreateArrowMat(); } private static void CreateBowStringMat() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002b: 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) bowStringMat = new Material(Addressables.LoadAssetAsync((object)RoR2_Base_Huntress.matBowString_mat).WaitForCompletion()); bowStringMat.SetTexture("_RemapTex", Addressables.LoadAssetAsync((object)RoR2_Base_Common_ColorRamps.texRampEngi_png).WaitForCompletion()); } private static void CreateArrowMat() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002b: 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) arrowMat = new Material(Addressables.LoadAssetAsync((object)RoR2_Base_Huntress.matHuntressArrow_mat).WaitForCompletion()); arrowMat.SetTexture("_RemapTex", Addressables.LoadAssetAsync((object)RoR2_Base_Common_ColorRamps.texRampEngi_png).WaitForCompletion()); } } public static class MwSkinEvents { public static VoiceGroup[] voiceGroups; public static VoiceArray blockDamage = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2] { new VoiceInfo("Play_MioHuntress_Block_1", 1.1f), new VoiceInfo("Play_MioHuntress_Block_2", 1.7f) }); public static VoiceArray damage = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[7] { new VoiceInfo("Play_MioHuntress_Damage_1", 0.6f), new VoiceInfo("Play_MioHuntress_Damage_2", 0.8f), new VoiceInfo("Play_MioHuntress_Damage_3", 0.9f), new VoiceInfo("Play_MioHuntress_Damage_4", 0.6f), new VoiceInfo("Play_MioHuntress_Damage_5", 0.5f), new VoiceInfo("Play_MioHuntress_Damage_6", 0.5f), new VoiceInfo("Play_MioHuntress_Damage_7", 0.5f) }); public static VoiceArray death = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3] { new VoiceInfo("Play_MioHuntress_Death_1", 2.7f), new VoiceInfo("Play_MioHuntress_Death_2", 2.1f), new VoiceInfo("Play_MioHuntress_Death_3", 1f) }); public static VoiceArray defeatBossGroup = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4] { new VoiceInfo("Play_MioHuntress_Defeat_Boss_Group_1", 1.5f), new VoiceInfo("Play_MioHuntress_Defeat_Boss_Group_2", 1.3f), new VoiceInfo("Play_MioHuntress_Defeat_Boss_Group_3", 1.8f), new VoiceInfo("Play_MioHuntress_Defeat_Boss_Group_4", 1.3f) }); public static VoiceArray getItem = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5] { new VoiceInfo("Play_MioHuntress_Get_Item_1", 1f), new VoiceInfo("Play_MioHuntress_Get_Item_2", 2.5f), new VoiceInfo("Play_MioHuntress_Get_Item_3", 1.4f), new VoiceInfo("Play_MioHuntress_Get_Item_4", 1.6f), new VoiceInfo("Play_MioHuntress_Get_Item_5", 1.6f) }); public static VoiceArray heal = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2] { new VoiceInfo("Play_MioHuntress_Heal_1", 1.7f), new VoiceInfo("Play_MioHuntress_Heal_2", 1.5f) }); public static VoiceArray leavePod = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2] { new VoiceInfo("Play_MioHuntress_Leave_Pod_1", 1f), new VoiceInfo("Play_MioHuntress_Leave_Pod_2", 1.1f) }); public static VoiceArray levelUp = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3] { new VoiceInfo("Play_MioHuntress_Level_Up_1", 1.5f), new VoiceInfo("Play_MioHuntress_Level_Up_2", 1.3f), new VoiceInfo("Play_MioHuntress_Level_Up_3", 1.6f) }); public static VoiceArray lowHealth = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2] { new VoiceInfo("Play_MioHuntress_Low_Health_1", 3.4f), new VoiceInfo("Play_MioHuntress_Low_Health_2", 1.6f) }); public static VoiceArray secondary = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5] { new VoiceInfo("Play_MioHuntress_Secondary_1", 1f), new VoiceInfo("Play_MioHuntress_Secondary_2", 0.8f), new VoiceInfo("Play_MioHuntress_Secondary_3", 1.1f), new VoiceInfo("Play_MioHuntress_Secondary_4", 1.3f), new VoiceInfo("Play_MioHuntress_Secondary_5", 1.6f) }); public static VoiceArray shrineFailure = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2] { new VoiceInfo("Play_MioHuntress_Shrine_Failure_1", 0.7f), new VoiceInfo("Play_MioHuntress_Shrine_Failure_2", 0.7f) }); public static VoiceArray shrineSuccess = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3] { new VoiceInfo("Play_MioHuntress_Shrine_Success_1", 1.5f), new VoiceInfo("Play_MioHuntress_Shrine_Success_2", 0.8f), new VoiceInfo("Play_MioHuntress_Shrine_Success_3", 0.6f) }); public static VoiceArray special = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5] { new VoiceInfo("Play_MioHuntress_Special_1", 1.8f), new VoiceInfo("Play_MioHuntress_Special_2", 1.2f), new VoiceInfo("Play_MioHuntress_Special_3", 1.2f), new VoiceInfo("Play_MioHuntress_Special_4", 1.3f), new VoiceInfo("Play_MioHuntress_Special_5", 1f) }); public static VoiceArray endTP = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[8] { new VoiceInfo("Play_MioHuntress_TP_End_1", 2.6f), new VoiceInfo("Play_MioHuntress_TP_End_2", 2.3f), new VoiceInfo("Play_MioHuntress_TP_End_3", 2.2f), new VoiceInfo("Play_MioHuntress_TP_End_4", 3.2f), new VoiceInfo("Play_MioHuntress_TP_End_5", 3f), new VoiceInfo("Play_MioHuntress_TP_End_6", 3f), new VoiceInfo("Play_MioHuntress_TP_End_7", 2.1f), new VoiceInfo("Play_MioHuntress_TP_End_8", 1.6f) }); public static VoiceArray startTP = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[10] { new VoiceInfo("Play_MioHuntress_TP_Start_1", 2f), new VoiceInfo("Play_MioHuntress_TP_Start_2", 2.2f), new VoiceInfo("Play_MioHuntress_TP_Start_3", 1.6f), new VoiceInfo("Play_MioHuntress_TP_Start_4", 3.4f), new VoiceInfo("Play_MioHuntress_TP_Start_5", 2.8f), new VoiceInfo("Play_MioHuntress_TP_Start_6", 3f), new VoiceInfo("Play_MioHuntress_TP_Start_7", 1.6f), new VoiceInfo("Play_MioHuntress_TP_Start_8", 1.9f), new VoiceInfo("Play_MioHuntress_TP_Start_9", 1.4f), new VoiceInfo("Play_MioHuntress_TP_Start_10", 2.7f) }); private static void UpdateIDRS(SkinDef skinDef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) DisplayRuleGroup val = default(DisplayRuleGroup); val.rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = "Head", followerPrefab = Addressables.LoadAssetAsync((object)RoR2_Base_CritGlasses.DisplayGlasses_prefab).WaitForCompletion(), limbMask = (LimbFlags)0, localPos = new Vector3(-0.00485f, 0.21612f, 0.08035f), localAngles = new Vector3(321.617f, 359.8309f, 0.12017f), localScale = new Vector3(0.23337f, 0.23337f, 0.23337f) } }; DisplayRuleGroup val2 = val; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_Base_CritGlasses.CritGlasses_asset).WaitForCompletion(), val2); val = default(DisplayRuleGroup); val.rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = "Head", followerPrefab = Addressables.LoadAssetAsync((object)RoR2_DLC1_CritGlassesVoid.DisplayGlassesVoid_prefab).WaitForCompletion(), limbMask = (LimbFlags)0, localPos = new Vector3(-0.00485f, 0.21612f, 0.08035f), localAngles = new Vector3(321.617f, 359.8309f, 0.12017f), localScale = new Vector3(0.23337f, 0.23337f, 0.23337f) } }; DisplayRuleGroup val3 = val; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_DLC1_CritGlassesVoid.CritGlassesVoid_asset).WaitForCompletion(), val3); } public static void Init(SkinDef skinDef) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) UpdateIDRS(skinDef); EventSubOptions val = new EventSubOptions(); val.boneTransformations = (BoneTransformation[])(object)new BoneTransformation[3] { new BoneTransformation("HuntressArmature/ROOT/base/stomach/chest/upper_arm.l", Vector3.one * 0.822f, Vector3.zero, (string)null), new BoneTransformation("HuntressArmature/ROOT/base/stomach/chest/upper_arm.r", Vector3.one * 0.822f, Vector3.zero, (string)null), new BoneTransformation("HuntressArmature/ROOT/base/BowRoot", Vector3.one * 0.822f, Vector3.zero, (string)null) }; val.useAnimations = true; val.blinkAnimations = (BlendShapeAnimation[])(object)new BlendShapeAnimation[1] { (BlendShapeAnimation)new BlinkBlendShapeAnimation("HuntressMesh", "LowBlink", -1, 0, 0.1f, 0f, 0.1f, false) }; val.voiceGroups = voiceGroups; val.conditionalIdleAnimations = (IdleAnimation[])(object)new IdleAnimation[2] { new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[1] { new BlendShapeAnimation("HuntressMesh", "EyesTense", 0, -2, 0.3f, float.PositiveInfinity, 0.3f, false) }, (Func)InCombat, true), new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[1] { new BlendShapeAnimation("HuntressMesh", "BrowHurt", 1, -1, 0.3f, float.PositiveInfinity, 0.3f, false) }, (Func)IsLowHealth, true) }; EventSub val2 = new EventSub(skinDef, val); val2.TakeDamage = (Action)Delegate.Combine(val2.TakeDamage, new Action(ExpressionOnHit)); val2.Death = (Action)Delegate.Combine(val2.Death, new Action(ExpressionOnDeath)); val2.ShrineFailure = (Action)Delegate.Combine(val2.ShrineFailure, new Action(ExpressionOnShrineFailure)); val2.LevelUp = (Action)Delegate.Combine(val2.LevelUp, new Action(ExpressionOnHoldoutOnLevelOnMithrix)); val2.MithrixDefeat = (Action)Delegate.Combine(val2.MithrixDefeat, new Action(ExpressionOnHoldoutOnLevelOnMithrix)); val2.HoldoutZoneCharged = (Action)Delegate.Combine(val2.HoldoutZoneCharged, new Action(ExpressionOnHoldoutOnLevelOnMithrix)); val2.GetItem = (Action)Delegate.Combine(val2.GetItem, new Action(ExpressionOnItem)); val2.TakeDamage = (Action)Delegate.Combine(val2.TakeDamage, new Action(LowHealthLine)); val2.Heal = (Action)Delegate.Combine(val2.Heal, new Action(HeavyHealLine)); val2.TakeDamage = (Action)Delegate.Combine(val2.TakeDamage, (Action)delegate(GameObject body, DamageReport damageReport) { if (body != null) { VoiceController component13 = body.GetComponent(); if (component13 != null) { component13.TryPlayRandomUniqueSoundServer(damage, body, 0.4f); } } }); val2.Death = (Action)Delegate.Combine(val2.Death, (Action)delegate(GameObject body) { if (body != null) { VoiceController component12 = body.GetComponent(); if (component12 != null) { component12.TryPlayRandomSoundServer(death, body, 1f); } } }); val2.DefeatBossGroup = (Action)Delegate.Combine(val2.DefeatBossGroup, (Action)delegate(GameObject body) { if (body != null) { VoiceController component11 = body.GetComponent(); if (component11 != null) { component11.TryPlayRandomUniqueSoundServer(defeatBossGroup, body, 1f); } } }); val2.TeleporterStart = (Action)Delegate.Combine(val2.TeleporterStart, (Action)delegate(GameObject body) { if (body != null) { VoiceController component10 = body.GetComponent(); if (component10 != null) { component10.TryPlayRandomUniqueSoundServer(startTP, body, 1f); } } }); val2.TeleporterEnd = (Action)Delegate.Combine(val2.TeleporterEnd, (Action)delegate(GameObject body) { if (body != null) { VoiceController component9 = body.GetComponent(); if (component9 != null) { component9.TryPlayRandomUniqueSoundServer(endTP, body, 1f); } } }); val2.LeavePod = (Action)Delegate.Combine(val2.LeavePod, (Action)delegate(GameObject body) { if (body != null) { VoiceController component8 = body.GetComponent(); if (component8 != null) { component8.TryPlayRandomUniqueSoundServer(leavePod, body, 1f); } } }); val2.GetItem = (Action)Delegate.Combine(val2.GetItem, (Action)delegate(GameObject body, ItemIndex itemIndex) { if (body != null) { VoiceController component7 = body.GetComponent(); if (component7 != null) { component7.TryPlayRandomUniqueSoundServer(getItem, body, 0.75f); } } }); val2.ShrineSuccess = (Action)Delegate.Combine(val2.ShrineSuccess, (Action)delegate(GameObject body) { if (body != null) { VoiceController component6 = body.GetComponent(); if (component6 != null) { component6.TryPlayRandomUniqueSoundServer(shrineSuccess, body, 1f); } } }); val2.ShrineFailure = (Action)Delegate.Combine(val2.ShrineFailure, (Action)delegate(GameObject body) { if (body != null) { VoiceController component5 = body.GetComponent(); if (component5 != null) { component5.TryPlayRandomUniqueSoundServer(shrineFailure, body, 1f); } } }); val2.LevelUp = (Action)Delegate.Combine(val2.LevelUp, (Action)delegate(GameObject body) { if (body != null) { VoiceController component4 = body.GetComponent(); if (component4 != null) { component4.TryPlayRandomUniqueSoundServer(levelUp, body, 0.25f); } } }); val2.BearDamageBlock = (Action)Delegate.Combine(val2.BearDamageBlock, (Action)delegate(GameObject body) { if (body != null) { VoiceController component3 = body.GetComponent(); if (component3 != null) { component3.TryPlayRandomUniqueSoundServer(blockDamage, body, 0.6f); } } }); val2.UseSpecial = (Action)Delegate.Combine(val2.UseSpecial, (Action)delegate(GameObject body) { if (body != null) { VoiceController component2 = body.GetComponent(); if (component2 != null) { component2.TryPlayRandomUniqueSoundServer(special, body, 0.45f); } } }); val2.UseSecondary = (Action)Delegate.Combine(val2.UseSecondary, (Action)delegate(GameObject body) { if (body != null) { VoiceController component = body.GetComponent(); if (component != null) { component.TryPlayRandomUniqueSoundServer(secondary, body, 0.4f); } } }); val2.Init(); } private static bool InCombat(ExpressionController expressionController) { CharacterBody characterBody = expressionController.characterBody; if ((Object)(object)characterBody != (Object)null) { return !characterBody.outOfCombat; } return false; } private static bool IsLowHealth(ExpressionController expressionController) { CharacterBody characterBody = expressionController.characterBody; if ((Object)(object)characterBody != (Object)null) { if (characterBody == null) { return false; } HealthComponent healthComponent = characterBody.healthComponent; return ((healthComponent != null) ? new float?(healthComponent.combinedHealthFraction) : null) <= 0.25f; } return false; } private static void LowHealthLine(GameObject body, DamageReport damageReport) { if (damageReport == null) { return; } HealthComponent victim = damageReport.victim; if (((victim != null) ? new float?(((Component)victim).GetComponent().combinedHealthFraction) : null) <= 0.25f && body != null) { VoiceController component = body.GetComponent(); if (component != null) { component.TryPlayRandomUniqueSoundServer(lowHealth, body, 0.8f); } } } private static void HeavyHealLine(GameObject body, float amount) { VoiceController val = ((body != null) ? body.GetComponent() : null); if (val != null) { object obj; if (body == null) { obj = null; } else { CharacterBody component = body.GetComponent(); obj = ((component != null) ? component.healthComponent : null); } HealthComponent val2 = (HealthComponent)obj; if (val2 != null && amount >= 0.5f * val2.fullCombinedHealth && val2.combinedHealth < 0.5f * val2.fullCombinedHealth) { val.TryPlayRandomSoundServer(heal, body, 1f); } } } private static void ExpressionOnHit(GameObject body, DamageReport damageReport) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown if (damageReport == null) { return; } HealthComponent victim = damageReport.victim; if (((victim != null) ? new float?(((Component)victim).GetComponent().combinedHealthFraction) : null) > 0.25f) { ExpressionController component = body.GetComponent(); if (component != null) { component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "HighBlink", 0, 0, 0.1f, 0.1f, 0.1f, true)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "BrowHurt", 1, 0, 0.1f, 0.1f, 0.1f, false)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "MouthHurt", 2, 0, 0.1f, 0.1f, 0.1f, false)); } } } private static void ExpressionOnShrineFailure(GameObject body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown ExpressionController component = body.GetComponent(); if (component != null) { component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "EyesDisappointed", 0, 0, 0.2f, 0.4f, 0.2f, true)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "MouthFrown", 2, 0, 0.2f, 0.4f, 0.2f, false)); } } private static void ExpressionOnHoldoutOnLevelOnMithrix(GameObject body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown ExpressionController component = body.GetComponent(); if (component != null) { component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "BrowHappy", 1, 0, 0.2f, 0.6f, 0.2f, false)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "mouth_smile_A", 2, 0, 0.2f, 0.6f, 0.2f, false)); } } private static void ExpressionOnItem(GameObject body, ItemIndex itemIndex) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown ExpressionController component = body.GetComponent(); if (component != null) { component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "HighBlink", 0, 0, 0.2f, 0.6f, 0.2f, true)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "BrowHappy", 1, 0, 0.2f, 0.6f, 0.2f, false)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "mouth_smile_A", 2, 0, 0.2f, 0.6f, 0.2f, false)); } } private static void ExpressionOnDeath(GameObject body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown ExpressionController component = body.GetComponent(); if (component != null) { component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "HighBlink", 0, 2, 0.2f, float.PositiveInfinity, 0.2f, true)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "BrowHurt", 1, 2, 0.2f, float.PositiveInfinity, 0.2f, false)); component.TryPlayAnimation(new BlendShapeAnimation("HuntressMesh", "mouth_i_B", 2, 2, 0.2f, float.PositiveInfinity, 0.2f, false)); } } public static void CreateVoiceGroups() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(Options.OnLoadFinished)); voiceGroups = (VoiceGroup[])(object)new VoiceGroup[7] { new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { leavePod }, 0.5f, 0.5f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { death }, 5f, 5f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { getItem }, 15f, 60f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[2] { shrineSuccess, shrineFailure }, 10f, 20f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { levelUp }, 10f, 30f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[6] { damage, secondary, special, blockDamage, heal, lowHealth }, 0.5f, 8f), new VoiceGroup((VoiceArray[])(object)new VoiceArray[3] { startTP, defeatBossGroup, endTP }, 5f, 10f) }; } } public class Options { private static bool? _rooEnabled; public static bool rooEnabled { get { if (!_rooEnabled.HasValue) { _rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _rooEnabled.Value; } } public static ConfigEntry mioVoiceVolume { get; set; } private static void MioVoiceVolumeSettingChanged() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.SetRTPCValue("MioHuntressVoiceVolume", mioVoiceVolume.Value * 50f); } public static void Init() { mioVoiceVolume = MioHuntressPlugin.config.Bind("Sound", "Mio Voice Volume", 1f, "How loud Mio's voice is relative to other sound effects."); mioVoiceVolume.SettingChanged += delegate { MioVoiceVolumeSettingChanged(); }; if (rooEnabled) { RoOInit(); } } public static void OnLoadFinished() { MioVoiceVolumeSettingChanged(); } private static void RoOInit() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StepSliderOption(mioVoiceVolume, new StepSliderConfig { min = 0f, max = 2f, increment = 0.01f })); ModSettingsManager.SetModDescription("Config options relating to the Mio Huntress skin mod."); ModSettingsManager.SetModIcon(MioHuntressPlugin.assetBundle.LoadAsset("Assets\\SkinMods\\MioHuntress\\Icons\\DefMioHuntressIcon.png")); } } } 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) 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)); foreach (Component val in components) { 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")) { string text = parent_string + "/" + ((Object)child).name; Debug.Log((object)(" " + ((Object)child).name + "\t\t" + text)); PrintAllPathsInner(((Component)child).gameObject, text); continue; } break; } } public static void PrintDynamicBone(DynamicBone DB) { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) 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(); if (Object.op_Implicit((Object)(object)val)) { Debug.Log((object)"Locator Found"); } } } return val; } public static Transform FindChildInTree(Transform Root, string name) { Queue queue = new Queue(); 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(true); List list = new List(); 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 list = new List(); BoneArrayBuilderHelper(NewBoneRoot, list); return list.ToArray(); } public static void BoneArrayBuilderHelper(Transform parent, List 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 SkinDefs = new Dictionary(); private GameObject LastModelObject; internal Dictionary> ModificationList = new Dictionary>(); private Dictionary ModifiedObjects = new Dictionary(); internal ManualLogSource InstanceLogger; internal void AddModification(string skinNameToken, int boneIndex, Modification modification) { if (!ModificationList.TryGetValue(skinNameToken, out var value)) { value = new SortedList(); ModificationList.Add(skinNameToken, value); } value.Add(boneIndex, modification); } internal void AddSkinDef(SkinDef skinDef) { SkinDefs.Add(skinDef.nameToken, skinDef); } internal IEnumerator SkinDefApply(Func>, List>, int, IEnumerator> orig, SkinDef self, GameObject modelObject, List> loadedMaterials, List> 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(); LastModelObject = modelObject; if (!ModificationList.TryGetValue(skindef.nameToken, out var value)) { return; } foreach (KeyValuePair item in value) { ApplyModification(modelObject, component, item.Value, modifications); } } private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications) { _ = modification.bodyname; string parentname = modification.parentname; Transform val = Utils.FindChildInTree(modelObject.transform, parentname); GameObject val2; if (modification.affectsbasemodel) { val2 = Object.Instantiate(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(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 list = baseSkinRenderers[0].bones.ToList(); Transform[] array = DynamicSkinHelpers.BoneArrayBuilder(modification.instance.transform); list.InsertRange(modification.boneIndex, array); modification.boneCount = array.Length; SkinnedMeshRenderer[] array2 = baseSkinRenderers; for (int i = 0; i < array2.Length; i++) { array2[i].bones = list.ToArray(); } modifications.BaseModelModifications.Push(modification); } private static void ModificationApplyDynamicBones(GameObject modelObject, Modification modification) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) DynamicBone val = (modification.inst_dynamicBone = modification.instance.AddComponent()); List list = new List(); foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders) { DynamicBoneCollider val2 = ((Component)Utils.FindChildInTree(modelObject.transform, collider.m_parent_name)).gameObject.AddComponent(); val2.m_Direction = collider.m_Direction; val2.m_Center = collider.m_Center; val2.m_Bound = collider.m_Bound; val2.m_Radius = collider.m_Radius; val2.m_Height = collider.m_Height; list.Add(val2); } 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(); foreach (string exclusion in modification.dynamicBoneData.m_Exclusions) { Transform val3 = Utils.FindChildInTree(root, exclusion); if ((Object)(object)val3 != (Object)null) { val.m_Exclusions.Add(val3); } 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_0044: 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_0076: 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) SkinnedMeshRenderer[] componentsInChildren = newPart.GetComponentsInChildren(true); Array.Resize(ref characterModel.baseRendererInfos, characterModel.baseRendererInfos.Length + componentsInChildren.Length); if (componentsInChildren.Length != 0) { int num = componentsInChildren.Length; SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { characterModel.baseRendererInfos[characterModel.baseRendererInfos.Length - num] = new RendererInfo { renderer = (Renderer)(object)componentsInChildren[^num], ignoreOverlays = false, defaultShadowCastingMode = (ShadowCastingMode)1, defaultMaterial = ((Renderer)val).sharedMaterial }; num--; } } } private void clearModification(Modification modification, GameObject modelObject, AppliedModifications modifications) { if (modification.inst_DB_colliders != null) { foreach (DynamicBoneCollider inst_DB_collider in modification.inst_DB_colliders) { Object.Destroy((Object)(object)inst_DB_collider); } } if (modification.affectsbasemodel) { SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject); List list = baseSkinRenderers[0].bones.ToList(); list.RemoveRange(modification.boneIndex, modification.boneCount); SkinnedMeshRenderer[] array = baseSkinRenderers; for (int i = 0; i < array.Length; i++) { array[i].bones = list.ToArray(); } } Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_dynamicBone); Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_armature); Object.Destroy((Object)(object)modifications.OtherModifications[0].instance); if (!modifications.OtherModifications.Remove(modification)) { InstanceLogger.LogError((object)"Skin Modification was not removed"); } } } internal class Modification { public string prefabpath; public string bodyname; public string parentname; public GameObject prefab; public bool affectsbasemodel; public DynamicBoneData dynamicBoneData; public string parentSkinToken; public int boneIndex; public int boneCount; public GameObject instance; public GameObject inst_armature; public DynamicBone inst_dynamicBone; public List inst_DB_colliders = new List(); public Modification(string PrefabPath, string ParentName, string BodyName, string ParentSkinToken, int BoneIndex, bool AffectsBaseModel, AssetBundle assetBundle) { bodyname = BodyName; prefabpath = PrefabPath; parentname = ParentName; parentSkinToken = ParentSkinToken; affectsbasemodel = AffectsBaseModel; boneIndex = BoneIndex; prefab = assetBundle.LoadAsset(prefabpath); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("Asset at " + PrefabPath + " was not loaded")); } } } internal class AppliedModifications { public Stack BaseModelModifications = new Stack(); public List OtherModifications = new List(); } internal class DynamicBoneData { public string m_Root; public float m_Damping; public AnimationCurve m_DampingDistrib; public float m_Elasticity; public AnimationCurve m_ElasticityDistrib; public float m_Stiffness; public AnimationCurve m_StiffnessDistrib; public float m_Inert; public AnimationCurve m_InertDistrib; public float m_Radius; public AnimationCurve m_RadiusDistrib; public float m_EndLength; public Vector3 m_EndOffset; public Vector3 m_Gravity; public Vector3 m_Force; public List m_Colliders; public List m_Exclusions; public FreezeAxis m_FreezeAxis; public DynamicBoneData(string root, float damping, AnimationCurve damping_dist, float elasticity, AnimationCurve elasticity_dist, float stiffness, AnimationCurve stiffness_dist, float inert, AnimationCurve inert_dist, float radius, AnimationCurve radius_dist, float end_length, Vector3 end_offset, Vector3 gravity, Vector3 force, List colliders, List exclusions, FreezeAxis freeze_axis) { //IL_0064: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) m_Root = root; m_Damping = damping; m_DampingDistrib = damping_dist; m_Elasticity = elasticity; m_ElasticityDistrib = elasticity_dist; m_Stiffness = stiffness; m_StiffnessDistrib = stiffness_dist; m_Inert = inert; m_InertDistrib = inert_dist; m_Radius = radius; m_RadiusDistrib = radius_dist; m_EndLength = end_length; m_EndOffset = end_offset; m_Gravity = gravity; m_Force = force; m_Colliders = colliders; m_Exclusions = exclusions; m_FreezeAxis = freeze_axis; } } internal class DynamicBoneColliderData { public string m_parent_name; public Direction m_Direction; public Vector3 m_Center; public Bound m_Bound; public float m_Radius; public float m_Height; public DynamicBoneColliderData(string parent_name, Direction direction, Vector3 Center, Bound bound, float radius, float heaight) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) m_parent_name = parent_name; m_Direction = direction; m_Center = Center; m_Bound = bound; m_Radius = radius; m_Height = heaight; } } }