using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using MonoMod.RuntimeDetour.HookGen; using MwSkinAdditions; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace EulaFalseSon; [BepInPlugin("com.Miyowi.EulaFalseSon", "EulaFalseSon", "1.0.0")] public class EulaFalseSonPlugin : BaseUnityPlugin { private static AssetBundle assetBundle; private static readonly List materialsWithRoRShader = new List(); private static EventSub eventSub; private static SkinDef[] skins = (SkinDef[])(object)new SkinDef[2]; internal static EulaFalseSonPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { EulaFalseSonPlugin instance = Instance; if (instance == null) { return null; } return ((BaseUnityPlugin)instance).Logger; } } private void Start() { Instance = this; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EulaFalseSon.miyowieulafalseson")) { assetBundle = AssetBundle.LoadFromStream(stream); } ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit); HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action, Language>(LanguageLoadStrings)); ReplaceShaders(); } private static void AfterBodyCatalogInit() { eventSub.skinDefs = skins; eventSub.Init(); } private static void ReplaceShaders() { LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/SkinAssets/EulaFalseSon/matEulaBody.mat", "Assets/SkinAssets/EulaFalseSon/matEulaCape.mat", "Assets/SkinAssets/EulaFalseSon/matEulaClaymore.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_DEFEULAFALSESON_NAME", "Eula"); } private static void BodyCatalogInit() { AddFalseSonBodyDefEulaFalseSonSkin(); AfterBodyCatalogInit(); } private static void FalseSonBodyDefEulaFalseSonSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { skins[0] = skinDef; CustomIDRS.Init(skinDef); } private static SkinDef CreateFalseSonBodyDefEulaFalseSonSkin(GameObject mdl, ModelSkinController skinController) { Renderer[] renderers = mdl.GetComponentsInChildren(true); mdl.GetComponentsInChildren(true); List skinnedRendererPaths = new List(); Renderer[] array = renderers; foreach (Renderer val in array) { if (val is SkinnedMeshRenderer) { skinnedRendererPaths.Add(Util.BuildPrefabTransformPath(mdl.transform, ((Component)val).transform, false, false)); } } SkinDef skin = ScriptableObject.CreateInstance(); SkinDefParams skinParams = ScriptableObject.CreateInstance(); skin.skinDefParams = skinParams; ((Object)skin).name = "DefEulaFalseSon"; skin.nameToken = "MIYOWI_SKIN_DEFEULAFALSESON_NAME"; skin.rootObject = mdl; Helpers.TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset("Assets\\SkinMods\\EulaFalseSon\\Icons\\DefEulaFalseSonIcon.png"); }); Helpers.TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = null; }); Helpers.TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { Helpers.ThrowIfOutOfBounds(0, "Index 0 is out of bounds of skins array", skinController.skins, 0) }; }); Helpers.TryCatchThrow("Game Object Activations", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_04af: 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_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[6] { new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(0, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(0f, 0f, 0f), localRotation = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/StomachAdditions.prefab")) }, new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(1, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2/Spine3\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2/Spine3"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(0.001042158f, 0.05909157f, 0.01170562f), localRotation = new Vector3(-0.0002001566f, 270.0002f, 1.340859f), localScale = new Vector3(0.9999999f, 0.9999999f, 0.9999999f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/ChestAdditions.prefab")).WithComponent((Action)delegate(InsertBones c) { c.rendererPaths.AddRange(skinnedRendererPaths); c.afterPath = "FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/Cape01/Cape02/Cape03/R_Cape01/R_Cape04"; Transform transform = ((Component)c).transform; c.newBones.Add(transform); c.newBones.Add(transform.GetChild(0, out var child)); c.newBones.Add(child.GetChild(0, out var child2)); c.newBones.Add(child2.GetChild(0, out var child3)); c.newBones.Add(child3.GetChild(0, out var child4)); c.newBones.Add(child4.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(1, out var child6)); c.newBones.Add(child6.GetChild(0, out var child7)); c.newBones.Add(child7.GetChild(0, out var child8)); c.newBones.Add(child8.GetChild(0, out var child9)); c.newBones.Add(child9.GetChild(0, out var _)); c.newBones.Add(child6.GetChild(1, out var child11)); c.newBones.Add(child11.GetChild(0, out var child12)); c.newBones.Add(child12.GetChild(0, out var child13)); c.newBones.Add(child13.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(2, out var child15)); c.newBones.Add(child15.GetChild(0, out var child16)); c.newBones.Add(child16.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(3, out var child18)); c.newBones.Add(child18.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(4, out var child20)); c.newBones.Add(child20.GetChild(0, out var _)); }).WithComponent((Action)delegate(AddDynamicColliders c) { c.pathPairs.Add(new PathPair { path1 = "+AmiceB R B11", path2 = "FSArmature/Root/Hips/Spine1/Spine2/StomachAdditions" }); }) }, new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(2, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/L_Clav/L_Upperarm/L_Forearm\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/L_Clav/L_Upperarm/L_Forearm"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(0.01110915f, 0.06368355f, 0.02378401f), localRotation = new Vector3(16.65094f, 204.6968f, 346.7148f), localScale = new Vector3(0.9999999f, 1f, 0.9999999f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/ForearmLAdditions.prefab")).WithComponent((Action)delegate(InsertBones c) { c.rendererPaths.AddRange(skinnedRendererPaths); c.afterPath = "FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/L_Clav/L_Upperarm/L_Forearm/L_Hand/L_Hand_Object/L_Weapon"; Transform transform = ((Component)c).transform; c.newBones.Add(transform); c.newBones.Add(transform.GetChild(0, out var child)); c.newBones.Add(child.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(1, out var child3)); c.newBones.Add(child3.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(2, out var child5)); c.newBones.Add(child5.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(3, out var child7)); c.newBones.Add(child7.GetChild(0, out var _)); }) }, new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(3, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/Neck/Head\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/Neck/Head"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(2.51936E-05f, 0.1097873f, -0.02317066f), localRotation = new Vector3(0.4092193f, 270.576f, 357.3492f), localScale = new Vector3(0.9999999f, 0.9999999f, 1f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/HeadAdditions.prefab")).WithComponent((Action)delegate(InsertBones c) { c.rendererPaths.AddRange(skinnedRendererPaths); c.afterPath = "FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/Neck/Head"; Transform transform = ((Component)c).transform; c.newBones.Add(transform); c.newBones.Add(transform.GetChild(0, out var child)); c.newBones.Add(child.GetChild(0, out var child2)); c.newBones.Add(child2.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(1, out var child4)); c.newBones.Add(child4.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(2, out var child6)); c.newBones.Add(child6.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(3, out var child8)); c.newBones.Add(child8.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(4, out var child10)); c.newBones.Add(child10.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(5, out var child12)); c.newBones.Add(child12.GetChild(0, out var _)); }) }, new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(4, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav/R_Upperarm/R_Forearm\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav/R_Upperarm/R_Forearm"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(0.01107549f, 0.06368698f, -0.02380037f), localRotation = new Vector3(352.7493f, 122.9113f, 353.8036f), localScale = new Vector3(1f, 1f, 1f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/ForearmRAdditions.prefab")).WithComponent((Action)delegate(InsertBones c) { c.rendererPaths.AddRange(skinnedRendererPaths); c.afterPath = "FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav/R_Upperarm/R_Forearm/R_Hand/R_Hand_Object"; Transform transform = ((Component)c).transform; c.newBones.Add(transform); c.newBones.Add(transform.GetChild(0, out var child)); c.newBones.Add(child.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(1, out var child3)); c.newBones.Add(child3.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(2, out var child5)); c.newBones.Add(child5.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(3, out var child7)); c.newBones.Add(child7.GetChild(0, out var _)); }) }, new GameObjectActivation { gameObject = ((Component)Helpers.ThrowIfNull(5, "There is no renderer at path \"FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav\"", mdl.transform.Find("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav"))).gameObject, shouldActivate = false, spawnPrefabOnModelObject = true, localPosition = new Vector3(-0.07160889f, 0.29588f, 0.0394353f), localRotation = new Vector3(15.61729f, 212.5372f, 10.24386f), localScale = new Vector3(0.9999999f, 0.9999999f, 1f), prefab = Helpers.ClonePrefab(assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/Prefabs/ClavRAdditions.prefab")).WithComponent((Action)delegate(InsertBones c) { c.rendererPaths.AddRange(skinnedRendererPaths); c.afterPath = "FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav/R_Upperarm/R_Forearm/ForearmRAdditions/+Sleeve R F05/+Sleeve R F05.001"; Transform transform = ((Component)c).transform; c.newBones.Add(transform); c.newBones.Add(transform.GetChild(0, out var child)); c.newBones.Add(child.GetChild(0, out var child2)); c.newBones.Add(child2.GetChild(0, out var child3)); c.newBones.Add(child3.GetChild(0, out var child4)); c.newBones.Add(child4.GetChild(0, out var _)); c.newBones.Add(child4.GetChild(1, out var child6)); c.newBones.Add(child6.GetChild(0, out var _)); c.newBones.Add(child.GetChild(1, out var child8)); c.newBones.Add(child8.GetChild(0, out var child9)); c.newBones.Add(child9.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(1, out var child11)); c.newBones.Add(child11.GetChild(0, out var child12)); c.newBones.Add(child12.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(2, out var child14)); c.newBones.Add(child14.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(3, out var child16)); c.newBones.Add(child16.GetChild(0, out var _)); c.newBones.Add(transform.GetChild(4, out var child18)); c.newBones.Add(child18.GetChild(0, out var _)); }).WithComponent((Action)delegate(AddDynamicColliders c) { c.pathPairs.Add(new PathPair { path1 = "+AmiceB R B01", path2 = "FSArmature/Root/Hips/Spine1/Spine2/StomachAdditions" }); }) } }; }); Helpers.TryCatchThrow("Renderer Infos", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_010b: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[3] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/matEulaBody.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = Helpers.ThrowIfNull(0, "There is no renderer with the name \"FalseSon_Body\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "FalseSon_Body"))), hideOnDeath = false, ignoresMaterialOverrides = false }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/matEulaCape.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = Helpers.ThrowIfNull(1, "There is no renderer with the name \"FalseSon_Cloth\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "FalseSon_Cloth"))), hideOnDeath = false, ignoresMaterialOverrides = false }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset("Assets/SkinAssets/EulaFalseSon/matEulaClaymore.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = Helpers.ThrowIfNull(2, "There is no renderer with the name \"L_FalseSon_Weapon\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "L_FalseSon_Weapon"))), hideOnDeath = false, ignoresMaterialOverrides = false } }; }); Helpers.TryCatchThrow("MeshReplacements", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[3] { new MeshReplacement { mesh = assetBundle.LoadAsset("Assets\\SkinMods\\EulaFalseSon\\Meshes\\EulaBody.mesh"), renderer = Helpers.ThrowIfNull(0, "There is no renderer with the name \"FalseSon_Body\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "FalseSon_Body"))) }, new MeshReplacement { mesh = assetBundle.LoadAsset("Assets\\SkinMods\\EulaFalseSon\\Meshes\\EulaCape.mesh"), renderer = Helpers.ThrowIfNull(1, "There is no renderer with the name \"FalseSon_Cloth\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "FalseSon_Cloth"))) }, new MeshReplacement { mesh = assetBundle.LoadAsset("Assets\\SkinMods\\EulaFalseSon\\Meshes\\EulaClaymore.mesh"), renderer = Helpers.ThrowIfNull(2, "There is no renderer with the name \"L_FalseSon_Weapon\"", ((IEnumerable)renderers).FirstOrDefault((Func)((Renderer r) => ((Object)r).name == "L_FalseSon_Weapon"))) } }; }); Helpers.TryCatchThrow("Light Infos", delegate { skinParams.lightReplacements = Array.Empty(); }); Helpers.TryCatchThrow("Minion Skin Replacements", delegate { skinParams.minionSkinReplacements = Array.Empty(); }); Helpers.TryCatchThrow("Projectile Ghost Replacements", delegate { skinParams.projectileGhostReplacements = Array.Empty(); }); return skin; } private static void FalseSonBodyDefEulaFalseSonLobbySkinAdded(SkinDef skinDef, GameObject displayPrefab) { skins[1] = skinDef; } private static void AddFalseSonBodyDefEulaFalseSonSkin() { string text = "FalseSonBody"; string text2 = "DefEulaFalseSon"; GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)bodyPrefab)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } try { ModelLocator component = bodyPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController val = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } SkinDef val2 = CreateFalseSonBodyDefEulaFalseSonSkin(gameObject, val); Array.Resize(ref val.skins, val.skins.Length + 1); val.skins[val.skins.Length - 1] = val2; FalseSonBodyDefEulaFalseSonSkinAdded(val2, bodyPrefab); } catch (FieldException ex) { if (ex.InnerException is ElementException ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}"); InstanceLogger.LogWarning((object)ex2.Message); InstanceLogger.LogError((object)ex.InnerException); } else { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } } catch (Exception ex3) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex3); } try { SurvivorDef val3 = ((IEnumerable)ContentManager.survivorDefs).FirstOrDefault((Func)((SurvivorDef d) => (Object)(object)d.bodyPrefab == (Object)(object)bodyPrefab)); if (!Object.op_Implicit((Object)(object)val3)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\" because SurvivorDef doesn't exist")); return; } GameObject displayPrefab = val3.displayPrefab; ModelSkinController componentInChildren = displayPrefab.GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); } else { SkinDef val4 = CreateFalseSonBodyDefEulaFalseSonSkin(((Component)componentInChildren).gameObject, componentInChildren); Array.Resize(ref componentInChildren.skins, componentInChildren.skins.Length + 1); componentInChildren.skins[^1] = val4; FalseSonBodyDefEulaFalseSonLobbySkinAdded(val4, displayPrefab); } } catch (FieldException ex4) { if (ex4.InnerException is ElementException ex5) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)$"Field causing issue: {ex4.Message}, element: {ex5.Index}"); InstanceLogger.LogWarning((object)ex5.Message); InstanceLogger.LogError((object)ex4.InnerException); } else { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex4.Message)); InstanceLogger.LogError((object)ex4.InnerException); } } catch (Exception ex6) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" lobby skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex6); } } private void Awake() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown eventSub = new EventSub(); BoneTransformations.Init(eventSub); } } public static class BoneTransformations { public static void Init(EventSub eventSub) { //IL_0013: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0097: 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_00a6: 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_00b2: Expected O, but got Unknown //IL_00c8: 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) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0116: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown eventSub.options.boneTransformations = (BoneTransformation[])(object)new BoneTransformation[8] { new BoneTransformation("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/L_Clav", Vector3.one * 0.78f, new Vector3(0f, -0.3f, 0f), (string)null), new BoneTransformation("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/L_Clav/L_Upperarm/L_Forearm/L_Hand", Vector3.one * 0.8f, Vector3.zero, (string)null), new BoneTransformation("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav", Vector3.one * 0.78f, new Vector3(0f, -0.3f, 0f), (string)null), new BoneTransformation("FSArmature/Root/Hips/Spine1/Spine2/Spine3/SpineEnd/R_Clav/R_Upperarm/R_Forearm/R_Hand", Vector3.one * 0.8f, Vector3.zero, (string)null), new BoneTransformation("FSArmature/Root/Hips/L_Thigh/L_Shin", new Vector3(1f, 1.5f, 1f), new Vector3(0.06f, 0.06f, 0f), (string)null), new BoneTransformation("FSArmature/Root/Hips/R_Thigh/R_Shin", new Vector3(1f, 1.5f, 1f), Vector3.zero, (string)null), new BoneTransformation("FSArmature/Root/Hips/Spine1", Vector3.one, new Vector3(0f, -0.3f, 0f), "FSArmature/Root/Hips"), new BoneTransformation("FSArmature/Root", Vector3.one * 0.7f, new Vector3(0f, 0.3f, 0f), (string)null) }; } } public static class CustomIDRS { public static void Init(SkinDef skinDef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) DisplayRuleGroup val = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = Addressables.LoadAssetAsync((object)RoR2_Base_CritGlasses.DisplayGlasses_prefab).WaitForCompletion(), childName = "Head", localPos = new Vector3(0f, 0.10936f, 0.18025f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.35325f, 0.28104f, 0.38981f) } } }; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_Base_CritGlasses.CritGlasses_asset).WaitForCompletion(), val); DisplayRuleGroup val2 = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = Addressables.LoadAssetAsync((object)RoR2_DLC1_CritGlassesVoid.DisplayGlassesVoid_prefab).WaitForCompletion(), childName = "Head", localPos = new Vector3(0f, 0.11455f, 0.21335f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.33802f, 0.33288f, 0.33288f) } } }; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_DLC1_CritGlassesVoid.CritGlassesVoid_asset).WaitForCompletion(), val2); DisplayRuleGroup val3 = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = Addressables.LoadAssetAsync((object)RoR2_Base_Hoof.DisplayHoof_prefab).WaitForCompletion(), childName = "CalfR", localPos = new Vector3(0.04724f, 0.50981f, -0.08234f), localAngles = new Vector3(78.04988f, 255.8448f, 344.5464f), localScale = new Vector3(0.1182f, 0.1182f, 0.1182f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = (LimbFlags)8 } } }; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_Base_Hoof.Hoof_asset).WaitForCompletion(), val3); DisplayRuleGroup val4 = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[3] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = Addressables.LoadAssetAsync((object)RoR2_DLC1_LunarSun.DisplaySunHead_prefab).WaitForCompletion(), childName = "Head", localPos = new Vector3(0.001f, 0.187f, 0.021f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1.43f, 1.43f, 1.43f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = Addressables.LoadAssetAsync((object)RoR2_DLC1_LunarSun.DisplaySunHeadNeck_prefab).WaitForCompletion(), childName = "Chest", localPos = new Vector3(-0.0335f, 0.44599f, -0.06942f), localAngles = new Vector3(356.6249f, 294.6834f, 10.02648f), localScale = new Vector3(1.57491f, 1.23561f, 1.57491f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = (LimbFlags)1 } } }; SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync((object)RoR2_DLC1_LunarSun.LunarSun_asset).WaitForCompletion(), val4); } } public static class Helpers { private static GameObject prefabHolder; public static GameObject ClonePrefab(GameObject gameObject) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)prefabHolder)) { prefabHolder = new GameObject("PrefabHolder"); Object.DontDestroyOnLoad((Object)(object)prefabHolder); prefabHolder.SetActive(false); } GameObject obj = Object.Instantiate(gameObject, prefabHolder.transform); obj.AddComponent(); ((Object)obj).name = ((Object)gameObject).name; return obj; } public static Transform GetChild(this Transform transform, int index, out Transform child) { return child = transform.GetChild(index); } public static GameObject WithComponent(this GameObject gameObject, Action modifier = null) where T : Component { T obj = gameObject.AddComponent(); modifier?.Invoke(obj); return gameObject; } public static GameObject WithTryComponent(this GameObject gameObject, Action modifier = null) where T : Component { if (Object.op_Implicit((Object)(object)gameObject) && !Object.op_Implicit((Object)(object)gameObject.GetComponent())) { T obj = gameObject.AddComponent(); modifier?.Invoke(obj); } return gameObject; } public 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; } public 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]; } public static T ThrowIfNull(int index, string message, T value) where T : class { if (value == null) { throw new ElementException(index, message); } return value; } public static void TryCatchThrow(string message, Action action) { try { action?.Invoke(); } catch (Exception innerException) { throw new FieldException(message, innerException); } } } public class RemoveClone : MonoBehaviour { public void Awake() { ((Object)this).name = ((Object)this).name[..^7]; } } public class FieldException : Exception { public FieldException(string message, Exception innerException) : base(message, innerException) { } } public class ElementException : Exception { public int Index { get; } public ElementException(int index, string message) : base(message) { Index = index; } } public class InsertBones : MonoBehaviour { private readonly List modifiedRenderers = new List(); public List rendererPaths = new List(); public List newBones = new List(); public string afterPath; public void Awake() { Transform transform = ((Component)((Component)this).GetComponentInParent()).transform; Transform value = ((Component)transform).transform.Find(afterPath); foreach (string rendererPath in rendererPaths) { Transform obj = transform.Find(rendererPath); SkinnedMeshRenderer val = ((obj != null) ? ((Component)obj).GetComponent() : null); if (Object.op_Implicit((Object)(object)val)) { Transform[] array = val.bones; int num = Array.IndexOf(array, value) + 1; if (num != 0) { Array.Resize(ref array, array.Length + newBones.Count); Array.Copy(array, num, array, num + newBones.Count, array.Length - newBones.Count - num); newBones.CopyTo(array, num); val.bones = array; modifiedRenderers.Add(val); } } } } public void OnDestroy() { foreach (SkinnedMeshRenderer modifiedRenderer in modifiedRenderers) { if (Object.op_Implicit((Object)(object)modifiedRenderer)) { Transform[] array = modifiedRenderer.bones; int num = Array.IndexOf(array, ((Component)this).transform); Array.Copy(array, num + newBones.Count, array, num, array.Length - num - newBones.Count); Array.Resize(ref array, array.Length - newBones.Count); modifiedRenderer.bones = array; } } modifiedRenderers.Clear(); } } public class AddDynamicColliders : MonoBehaviour { public List pathPairs = new List(); public void Awake() { Transform transform = ((Component)((Component)this).GetComponentInParent()).transform; DynamicBone val3 = default(DynamicBone); DynamicBoneCollider item = default(DynamicBoneCollider); foreach (PathPair pathPair in pathPairs) { Transform val = ((pathPair.path1 == string.Empty) ? ((Component)this).transform : ((Component)this).transform.Find(pathPair.path1)); Transform val2 = transform.Find(pathPair.path2); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && ((Component)val).TryGetComponent(ref val3) && ((Component)val2).TryGetComponent(ref item)) { val3.m_Colliders.Add(item); } } } } [Serializable] public struct PathPair { public string path1; public string path2; }