Add option to show skin IDs in cosmetics menu

This commit is contained in:
Terry Hearst 2023-10-25 00:50:21 -04:00
parent 16559dfe5b
commit ea688c8bec
3 changed files with 25 additions and 2 deletions

View file

@ -19,6 +19,7 @@ namespace CustomCosmeticLoader
public const string PROPERTY_IN_MAIN_MENU = "inMainMenu"; public const string PROPERTY_IN_MAIN_MENU = "inMainMenu";
public const string PROPERTY_IN_COSMETIC_MENU = "inCosmeticMenu"; public const string PROPERTY_IN_COSMETIC_MENU = "inCosmeticMenu";
public const string PROPERTY_IN_ALL_REPLAYS = "inAllReplays"; 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_OVERRIDE_REPLAY_COSMETICS = "overrideReplayCosmetics";
public const string PROPERTY_OTHER_PLAYERS = "otherPlayers"; public const string PROPERTY_OTHER_PLAYERS = "otherPlayers";
@ -28,6 +29,7 @@ namespace CustomCosmeticLoader
public static bool inMainMenu = true; public static bool inMainMenu = true;
public static bool inCosmeticMenu = false; public static bool inCosmeticMenu = false;
public static bool inAllReplays = false; public static bool inAllReplays = false;
public static bool showSkinIds = false;
public static bool overrideReplayCosmetics = false; public static bool overrideReplayCosmetics = false;
public static Dictionary<string, string> otherPlayers = new Dictionary<string, string>(); public static Dictionary<string, string> otherPlayers = new Dictionary<string, string>();
@ -85,6 +87,9 @@ namespace CustomCosmeticLoader
if (data[PROPERTY_IN_ALL_REPLAYS] != null) if (data[PROPERTY_IN_ALL_REPLAYS] != null)
inAllReplays = data[PROPERTY_IN_ALL_REPLAYS].AsBool; 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) if (data[PROPERTY_OVERRIDE_REPLAY_COSMETICS] != null)
overrideReplayCosmetics = data[PROPERTY_OVERRIDE_REPLAY_COSMETICS].AsBool; overrideReplayCosmetics = data[PROPERTY_OVERRIDE_REPLAY_COSMETICS].AsBool;
@ -121,6 +126,7 @@ namespace CustomCosmeticLoader
{ PROPERTY_IN_MAIN_MENU, new JSONData(inMainMenu) }, { PROPERTY_IN_MAIN_MENU, new JSONData(inMainMenu) },
{ PROPERTY_IN_COSMETIC_MENU, new JSONData(inCosmeticMenu) }, { PROPERTY_IN_COSMETIC_MENU, new JSONData(inCosmeticMenu) },
{ PROPERTY_IN_ALL_REPLAYS, new JSONData(inAllReplays) }, { PROPERTY_IN_ALL_REPLAYS, new JSONData(inAllReplays) },
{ PROPERTY_SHOW_SKIN_IDS, new JSONData(showSkinIds) },
{ PROPERTY_OVERRIDE_REPLAY_COSMETICS, new JSONData(overrideReplayCosmetics) }, { PROPERTY_OVERRIDE_REPLAY_COSMETICS, new JSONData(overrideReplayCosmetics) },
}; };

View file

@ -149,6 +149,20 @@ namespace CustomCosmeticLoader
return "Custom skins in all replays " + (Config.inAllReplays ? "enabled" : "disabled"); 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)] [ConsoleCommand(description = "Enable/disable overriding a replay's cosmetics with your cosmetics", paramsDescription = "[true/false]", hidden = true)]
public static string cclOverrideReplayCosmetics(params string[] args) public static string cclOverrideReplayCosmetics(params string[] args)
{ {

View file

@ -1,4 +1,4 @@
using HarmonyLib; using HarmonyLib;
using System; using System;
namespace CustomCosmeticLoader.Patches namespace CustomCosmeticLoader.Patches
@ -9,7 +9,7 @@ namespace CustomCosmeticLoader.Patches
[HarmonyPatch(typeof(CosmeticPanel), nameof(CosmeticPanel.SelectCosmetic), new Type[] { typeof(Cosmetic), typeof(CosmeticType), typeof(bool) })] [HarmonyPatch(typeof(CosmeticPanel), nameof(CosmeticPanel.SelectCosmetic), new Type[] { typeof(Cosmetic), typeof(CosmeticType), typeof(bool) })]
internal class CosmeticPanelSelectCosmeticPatch internal class CosmeticPanelSelectCosmeticPatch
{ {
static void Postfix(CosmeticType ctype) static void Postfix(Cosmetic c, CosmeticType ctype)
{ {
if (!Config.enabled) if (!Config.enabled)
return; return;
@ -21,6 +21,9 @@ namespace CustomCosmeticLoader.Patches
holder.SetMarble(Shared.SkinToHijack); holder.SetMarble(Shared.SkinToHijack);
Shared.ApplyCustomTexture(holder.currentMarble); Shared.ApplyCustomTexture(holder.currentMarble);
} }
if (Config.showSkinIds)
CosmeticPanel.instance.CosmTitle.text += " (" + c.Id + ")";
} }
} }
} }