using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using TooManyEmotes.Patches; using TooManyEmotes.UI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ExtendedCosmetics")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MelanieMelicious")] [assembly: AssemblyProduct("Extended Cosmetics")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MelMelExtendedCosmetics { [Serializable] public class CosmeticType { public GameObject cosmetic; public CosmeticTypes cosmeticType; public string typeByPathToBone; } public enum CosmeticTypes { Head, Chest, Waist, Hip, L_Shoulder, L_Upper_Arm, L_Lower_Arm, L_Hand, L_Thigh, L_Shin, L_Foot, R_Shoulder, R_Upper_Arm, R_Lower_Arm, R_Hand, R_Thigh, R_Shin, R_Foot, Other } internal class HarmonyPatches { [HarmonyPostfix] [HarmonyPatch(typeof(CosmeticApplication), "Awake")] private static void AddMelMelCosmeticManager(CosmeticApplication __instance) { ((Component)__instance).gameObject.AddComponent(); } } public class MelMelCosmetic : MonoBehaviour { public CosmeticType[] cosmetics; internal static List spawnedCosmetics = new List(); private void Start() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) spawnedCosmetics.Add(this); MelMelCosmeticManager componentInParent = ((Component)this).GetComponentInParent(); for (int i = 0; i < cosmetics.Length; i++) { if (cosmetics[i].cosmeticType != CosmeticTypes.Other && (Object)(object)componentInParent.cosmeticPoint[(int)cosmetics[i].cosmeticType] != (Object)null) { cosmetics[i].cosmetic.transform.SetParent(componentInParent.cosmeticPoint[(int)cosmetics[i].cosmeticType]); } else { if (!((Object)(object)componentInParent.spine != (Object)null) || !Object.op_Implicit((Object)(object)componentInParent.spine.Find(cosmetics[i].typeByPathToBone))) { continue; } cosmetics[i].cosmetic.transform.SetParent(componentInParent.spine.Find(cosmetics[i].typeByPathToBone)); } cosmetics[i].cosmetic.transform.localPosition = Vector3.zero; cosmetics[i].cosmetic.transform.localRotation = Quaternion.identity; cosmetics[i].cosmetic.transform.localScale = Vector3.one; } } private void OnDestroy() { spawnedCosmetics.Remove(this); CosmeticType[] array = cosmetics; foreach (CosmeticType cosmeticType in array) { Object.Destroy((Object)(object)cosmeticType.cosmetic); } } } public class MelMelCosmeticManager : MonoBehaviour { internal Transform spine; internal Transform[] cosmeticPoint = (Transform[])(object)new Transform[18]; private void Awake() { spine = ((Component)this).transform.Find("spine"); if ((Object)(object)spine == (Object)null) { spine = ((Component)this).transform; } cosmeticPoint[3] = spine.Find("spine.001"); cosmeticPoint[2] = cosmeticPoint[3].Find("spine.002"); cosmeticPoint[1] = cosmeticPoint[2].Find("spine.003"); cosmeticPoint[0] = cosmeticPoint[1].Find("spine.004"); cosmeticPoint[4] = cosmeticPoint[1].Find("shoulder.L"); cosmeticPoint[5] = cosmeticPoint[4].Find("arm.L_upper"); cosmeticPoint[6] = cosmeticPoint[5].Find("arm.L_lower"); cosmeticPoint[7] = cosmeticPoint[6].Find("hand.L"); cosmeticPoint[8] = spine.Find("thigh.L"); cosmeticPoint[9] = cosmeticPoint[8].Find("shin.L"); cosmeticPoint[10] = cosmeticPoint[9].Find("foot.L"); cosmeticPoint[11] = cosmeticPoint[1].Find("shoulder.R"); cosmeticPoint[12] = cosmeticPoint[11].Find("arm.R_upper"); cosmeticPoint[13] = cosmeticPoint[12].Find("arm.R_lower"); cosmeticPoint[14] = cosmeticPoint[13].Find("hand.R"); cosmeticPoint[15] = spine.Find("thigh.R"); cosmeticPoint[16] = cosmeticPoint[15].Find("shin.R"); cosmeticPoint[17] = cosmeticPoint[16].Find("foot.R"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MelanieMelicious.ExtendedCosmetics", "Melanie Melicious - Extended Cosmetics", "1.0.1")] internal class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.ExtendedCosmetics"; private const string NAME = "Melanie Melicious - Extended Cosmetics"; private const string VERSION = "1.0.1"; private readonly Harmony harmony = new Harmony("MelanieMelicious.ExtendedCosmetics"); internal static ManualLogSource mls; private void Awake() { mls = Logger.CreateLogSource("MelanieMelicious - Pocket Room Library"); mls = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(typeof(HarmonyPatches)); if (Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes")) { harmony.PatchAll(typeof(TooManyEmotePatch)); } } } internal class TooManyEmotePatch { [HarmonyPostfix] [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStartCustomEmoteLocal")] private static void StartEmotePatch() { LayerChange(); } [HarmonyPostfix] [HarmonyPatch(typeof(ThirdPersonEmoteController), "OnStopCustomEmoteLocal")] private static void StopEmotePatch() { LayerChange(); } [HarmonyPostfix] [HarmonyPatch(typeof(AnimationPreviewer), "InitializePlayerCloneRenderObject")] private static void PlayerClonePatch() { LayerChange(); } private static void LayerChange() { if (ThirdPersonEmoteController.firstPersonEmotesEnabled) { return; } for (int i = 0; i < MelMelCosmetic.spawnedCosmetics.Count; i++) { int layer = ((Component)MelMelCosmetic.spawnedCosmetics[i]).gameObject.layer; for (int j = 0; j < MelMelCosmetic.spawnedCosmetics[i].cosmetics.Length; j++) { Transform[] componentsInChildren = MelMelCosmetic.spawnedCosmetics[i].cosmetics[j].cosmetic.GetComponentsInChildren(); foreach (Transform val in componentsInChildren) { ((Component)val).gameObject.layer = layer; } } } } } }