The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of Personal Wardrobe v0.3.1
plugins/com.github.Kirshoo.PersonalWardrobe.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.Kirshoo.PersonalWardrobe")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.1.0")] [assembly: AssemblyInformationalVersion("0.3.1+63e7f96e7a8b86ebf3481de1f25cc947d603dccd")] [assembly: AssemblyProduct("com.github.Kirshoo.PersonalWardrobe")] [assembly: AssemblyTitle("PersonalWardrobe")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PersonalWardrobe { internal static class ColorUtil { public static Color FromRGB(int red, int green, int blue) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return FromRGB(red, green, blue, 1f); } public static Color FromRGB(int red, int green, int blue, float alpha) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) red = Math.Clamp(red, 0, 255); green = Math.Clamp(green, 0, 255); blue = Math.Clamp(blue, 0, 255); return new Color((float)red / 255f, (float)green / 255f, (float)blue / 255f, alpha); } } public class Loadout { [JsonProperty("name")] public string Name { get; set; } = string.Empty; [JsonProperty("skin")] public int SkinIndex { get; set; } [JsonProperty("accessory")] public int AccessoryIndex { get; set; } [JsonProperty("hat")] public int HatIndex { get; set; } [JsonProperty("outfit")] public int OutfitIndex { get; set; } [JsonProperty("eyes")] public int EyesIndex { get; set; } [JsonProperty("mouth")] public int MouthIndex { get; set; } [JsonProperty("sash")] public int SashIndex { get; set; } public static bool Equals(Loadout lhs, Loadout rhs) { return lhs.Name == rhs.Name; } public static bool Equals(Loadout lhs, string name) { return lhs.Name == name; } } public class Wardrobe { [JsonProperty("version")] public int Version = 1; [JsonProperty("wardrobe")] public List<Loadout> Loadouts = new List<Loadout>(); } [BepInPlugin("com.github.Kirshoo.PersonalWardrobe", "PersonalWardrobe", "0.3.1")] public class Plugin : BaseUnityPlugin { public static readonly string configFolder = Path.Combine(Paths.ConfigPath, "PersonalWardrobe"); public static readonly string loadoutsPath = Path.Combine(configFolder, "wardrobe.json"); public static readonly string loadoutsBackupPath = Path.Combine(configFolder, "~wardrobe.json"); internal static ConfigEntry<KeyCode> toggleMenuButton = null; private GameObject menuObj; private WardrobeMenu menu; public const string Id = "com.github.Kirshoo.PersonalWardrobe"; internal static ManualLogSource Log { get; private set; } = null; private Wardrobe Wardrobe { get; set; } public static string Name => "PersonalWardrobe"; public static string Version => "0.3.1"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; try { WardrobeManager.Instance.LoadWardrobe(); } catch (Exception ex) { Log.LogError((object)("Wardrobe Load error: " + ex.Message)); throw; } toggleMenuButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ToggleMenu", (KeyCode)290, "Button to toggle Wardrobe UI"); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void OnApplicationQuit() { WardrobeManager.SaveWardrobeToFile(); } private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown menuObj = new GameObject("Wardrobe"); Object.DontDestroyOnLoad((Object)(object)menuObj); menu = menuObj.AddComponent<WardrobeMenu>(); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(toggleMenuButton.Value)) { menu.ToggleOpen(); } } } internal class WardrobeManager { private static WardrobeManager _instance; private Wardrobe wardrobe; public static WardrobeManager Instance { get { if (_instance == null) { _instance = new WardrobeManager(); } return _instance; } } public WardrobeManager() { if (_instance == null) { _instance = this; LoadWardrobe(); } } public void LoadWardrobe() { Directory.CreateDirectory(Plugin.configFolder); if (!File.Exists(Plugin.loadoutsPath)) { Wardrobe wardrobe = new Wardrobe(); File.WriteAllText(Plugin.loadoutsPath, JsonConvert.SerializeObject((object)wardrobe, (Formatting)1)); Plugin.Log.LogInfo((object)"Created a default wardrobe file."); } string text = File.ReadAllText(Plugin.loadoutsPath); this.wardrobe = JsonConvert.DeserializeObject<Wardrobe>(text); if (this.wardrobe == null) { throw new FileLoadException("Deserialization returned null"); } Plugin.Log.LogInfo((object)$"Loaded wardrobe: v{this.wardrobe.Version}."); } public void SaveWardrobe(Loadout loadout) { Loadout loadout2 = loadout; int num = wardrobe.Loadouts.FindIndex((Loadout other) => Loadout.Equals(other, loadout2)); if (num == -1) { wardrobe.Loadouts.Add(loadout2); } else { wardrobe.Loadouts[num] = loadout2; } File.WriteAllText(Plugin.loadoutsBackupPath, JsonConvert.SerializeObject((object)wardrobe, (Formatting)1)); Plugin.Log.LogInfo((object)"Wardrobe is saved."); } public static void SaveWardrobeToFile() { if (File.Exists(Plugin.loadoutsBackupPath)) { string contents = File.ReadAllText(Plugin.loadoutsBackupPath); File.WriteAllText(Plugin.loadoutsPath, contents); File.Delete(Plugin.loadoutsBackupPath); Plugin.Log.LogInfo((object)"Backup removed and main file is up to date."); } } public Loadout GetLoadout(string name) { string name2 = name; Loadout loadout = wardrobe.Loadouts.Find((Loadout x) => Loadout.Equals(x, name2)); if (loadout == null) { Plugin.Log.LogWarning((object)("Unable to find \"" + name2 + "\" loadout. Returning default.")); return new Loadout { Name = name2 }; } return loadout; } } internal class WardrobeMenu : MenuWindow { public GameObject uiObject; private Canvas canvas; private WardrobeManager manager; private Loadout currentLoadout; private const int LoadoutAmount = 3; public override bool openOnStart => false; public override bool closeOnPause => true; public WardrobeMenu() { manager = WardrobeManager.Instance; currentLoadout = manager.GetLoadout("Loadout 1"); CreateUI(); } public void CreateUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_018c: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_022c: 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_029f: Expected O, but got Unknown //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: 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_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) uiObject = new GameObject("WardrobeMenu"); canvas = uiObject.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; uiObject.AddComponent<CanvasScaler>(); uiObject.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)uiObject); GameObject val = new GameObject("WardrobeBackground"); val.transform.SetParent(((Component)canvas).transform); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.anchoredPosition = Vector2.zero; GameObject val3 = new GameObject("WardrobeBackgroundDim"); val3.transform.SetParent(val.transform); Image val4 = val3.AddComponent<Image>(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.8f); RectTransform component = ((Component)val4).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; component.sizeDelta = new Vector2((float)Screen.width, (float)Screen.height); GameObject val5 = new GameObject("WardrobeBackgroundImage"); val5.transform.SetParent(val.transform); Image val6 = val5.AddComponent<Image>(); ((Graphic)val6).color = ColorUtil.FromRGB(223, 218, 194); RectTransform component2 = ((Component)val6).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(600f, 200f); component2.anchoredPosition = Vector2.zero; GameObject val7 = new GameObject("ButtonContainer"); val7.transform.SetParent(val.transform); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = new Vector2(0.5f, 0f); val8.anchorMax = new Vector2(0.5f, 0f); val8.sizeDelta = new Vector2(500f, 40f); val8.anchoredPosition = Vector2.zero; HorizontalLayoutGroup val9 = val7.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val9).spacing = 170f; ((LayoutGroup)val9).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandHeight = false; val7.AddComponent<ContentSizeFitter>().horizontalFit = (FitMode)2; Vector2 val16 = default(Vector2); for (int i = 0; i < 3; i++) { GameObject val10 = new GameObject($"WardrobeButton{i}"); val10.transform.SetParent(val7.transform); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.sizeDelta = new Vector2(150f, 40f); Image val12 = val10.AddComponent<Image>(); ((Graphic)val12).color = Color.white; Button val13 = val10.AddComponent<Button>(); int index = i + 1; ((UnityEvent)val13.onClick).AddListener((UnityAction)delegate { Plugin.Log.LogDebug((object)$"Loadout button {index} pressed!"); if (currentLoadout != null && Loadout.Equals(currentLoadout, $"Loadout {index}")) { Plugin.Log.LogWarning((object)"Selected current loadout. Do nothing."); } else { SwitchLoadout($"Loadout {index}"); } }); GameObject val14 = new GameObject("ButtonText"); val14.transform.SetParent(val10.transform); TextMeshProUGUI val15 = val14.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val15).text = $"Loadout #{i + 1}"; ((Graphic)val15).color = Color.black; ((TMP_Text)val15).fontSize = 28f; ((TMP_Text)val15).alignment = (TextAlignmentOptions)514; RectTransform component3 = ((Component)val15).GetComponent<RectTransform>(); ((Vector2)(ref val16))..ctor(0.5f, 0.5f); component3.pivot = val16; Vector2 anchorMin = (component3.anchorMax = val16); component3.anchorMin = anchorMin; component3.sizeDelta = new Vector2(150f, 40f); component3.anchoredPosition = Vector2.zero; } GameObject val18 = new GameObject("WardrobeText"); val18.transform.SetParent(((Component)canvas).transform); TextMeshProUGUI val19 = val18.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val19).text = $"In Wardrobe Menu - Press {Plugin.toggleMenuButton.Value} to exit"; TMP_FontAsset val20 = Resources.Load<TMP_FontAsset>("DarumaDropOne-Regular.ttf"); if ((Object)(object)val20 != (Object)null) { ((TMP_Text)val19).font = val20; } ((Graphic)val19).color = Color.white; ((TMP_Text)val19).fontSize = 28f; ((TMP_Text)val19).alignment = (TextAlignmentOptions)514; RectTransform component4 = ((Component)val19).GetComponent<RectTransform>(); component4.sizeDelta = new Vector2(600f, 100f); component4.anchoredPosition = new Vector2(0f, 200f); } private void SaveLoadout(string loadoutName) { Plugin.Log.LogDebug((object)"Overriding saved loadout with current cosmetics."); CharacterCustomizationData customizationData = CharacterCustomization.GetCustomizationData(PhotonNetwork.LocalPlayer); if (customizationData == null) { Plugin.Log.LogError((object)"Unable to retreive current cosmetics data."); return; } Loadout loadout = new Loadout { Name = loadoutName, SkinIndex = customizationData.currentSkin, AccessoryIndex = customizationData.currentAccessory, EyesIndex = customizationData.currentEyes, MouthIndex = customizationData.currentMouth, HatIndex = customizationData.currentHat, OutfitIndex = customizationData.currentOutfit, SashIndex = customizationData.currentSash }; manager.SaveWardrobe(loadout); } private void LoadLoadout(string loadoutName) { Plugin.Log.LogDebug((object)"Overriding current cosmetics with saved loadout."); Loadout loadout = manager.GetLoadout(loadoutName); if (loadout == null) { Plugin.Log.LogError((object)("Unable to find loadout with name " + loadoutName)); return; } CharacterCustomization.SetCharacterSkinColor(loadout.SkinIndex); CharacterCustomization.SetCharacterAccessory(loadout.AccessoryIndex); CharacterCustomization.SetCharacterEyes(loadout.EyesIndex); CharacterCustomization.SetCharacterMouth(loadout.MouthIndex); CharacterCustomization.SetCharacterHat(loadout.HatIndex); CharacterCustomization.SetCharacterOutfit(loadout.OutfitIndex); CharacterCustomization.SetCharacterSash(loadout.SashIndex); currentLoadout = loadout; } public void SwitchLoadout(string newLayoutName) { SaveLoadout(currentLoadout.Name); LoadLoadout(newLayoutName); } public void Awake() { uiObject.SetActive(false); } public void ToggleOpen() { if (!((MenuWindow)this).isOpen) { ((MenuWindow)this).Open(); uiObject.SetActive(true); } else { ((MenuWindow)this).Close(); } } public override void OnClose() { uiObject.SetActive(false); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }