diff --git a/Config.cs b/Config.cs index 05ebdbe..3cf8b0e 100644 --- a/Config.cs +++ b/Config.cs @@ -19,6 +19,7 @@ namespace CustomCosmeticLoader public const string PROPERTY_IN_MAIN_MENU = "inMainMenu"; public const string PROPERTY_IN_COSMETIC_MENU = "inCosmeticMenu"; public const string PROPERTY_IN_ALL_REPLAYS = "inAllReplays"; + public const string PROPERTY_SHOW_SKIN_IDS = "showSkinIds"; public const string PROPERTY_OVERRIDE_REPLAY_COSMETICS = "overrideReplayCosmetics"; public const string PROPERTY_OTHER_PLAYERS = "otherPlayers"; @@ -28,6 +29,7 @@ namespace CustomCosmeticLoader public static bool inMainMenu = true; public static bool inCosmeticMenu = false; public static bool inAllReplays = false; + public static bool showSkinIds = false; public static bool overrideReplayCosmetics = false; public static Dictionary otherPlayers = new Dictionary(); @@ -85,6 +87,9 @@ namespace CustomCosmeticLoader if (data[PROPERTY_IN_ALL_REPLAYS] != null) inAllReplays = data[PROPERTY_IN_ALL_REPLAYS].AsBool; + if (data[PROPERTY_SHOW_SKIN_IDS] != null) + showSkinIds = data[PROPERTY_SHOW_SKIN_IDS].AsBool; + if (data[PROPERTY_OVERRIDE_REPLAY_COSMETICS] != null) overrideReplayCosmetics = data[PROPERTY_OVERRIDE_REPLAY_COSMETICS].AsBool; @@ -121,6 +126,7 @@ namespace CustomCosmeticLoader { PROPERTY_IN_MAIN_MENU, new JSONData(inMainMenu) }, { PROPERTY_IN_COSMETIC_MENU, new JSONData(inCosmeticMenu) }, { PROPERTY_IN_ALL_REPLAYS, new JSONData(inAllReplays) }, + { PROPERTY_SHOW_SKIN_IDS, new JSONData(showSkinIds) }, { PROPERTY_OVERRIDE_REPLAY_COSMETICS, new JSONData(overrideReplayCosmetics) }, }; diff --git a/ConsoleCommands.cs b/ConsoleCommands.cs index cfd4c1e..0928c89 100644 --- a/ConsoleCommands.cs +++ b/ConsoleCommands.cs @@ -149,6 +149,20 @@ namespace CustomCosmeticLoader return "Custom skins in all replays " + (Config.inAllReplays ? "enabled" : "disabled"); } + [ConsoleCommand(description = "Enable/disable showing the underlying skin ID in the cosmetic menu", paramsDescription = "[true/false]", hidden = true)] + public static string cclShowSkinIds(params string[] args) + { + if (args.Length == 0) + return "cclShowSkinIds: " + (Config.showSkinIds ? "true" : "false"); + + if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) + return "Requires a true or false argument"; + + Config.showSkinIds = args[0] == "true"; + + return "Skin IDs in cosmetic menu " + (Config.showSkinIds ? "enabled" : "disabled"); + } + [ConsoleCommand(description = "Enable/disable overriding a replay's cosmetics with your cosmetics", paramsDescription = "[true/false]", hidden = true)] public static string cclOverrideReplayCosmetics(params string[] args) { diff --git a/Patches/CosmeticPanelPatches.cs b/Patches/CosmeticPanelPatches.cs index 9d8a1ff..1f82f5f 100644 --- a/Patches/CosmeticPanelPatches.cs +++ b/Patches/CosmeticPanelPatches.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; namespace CustomCosmeticLoader.Patches @@ -9,7 +9,7 @@ namespace CustomCosmeticLoader.Patches [HarmonyPatch(typeof(CosmeticPanel), nameof(CosmeticPanel.SelectCosmetic), new Type[] { typeof(Cosmetic), typeof(CosmeticType), typeof(bool) })] internal class CosmeticPanelSelectCosmeticPatch { - static void Postfix(CosmeticType ctype) + static void Postfix(Cosmetic c, CosmeticType ctype) { if (!Config.enabled) return; @@ -21,6 +21,9 @@ namespace CustomCosmeticLoader.Patches holder.SetMarble(Shared.SkinToHijack); Shared.ApplyCustomTexture(holder.currentMarble); } + + if (Config.showSkinIds) + CosmeticPanel.instance.CosmTitle.text += " (" + c.Id + ")"; } } }