From 87645467681c5fe56ebf54aae1a68d85ffb0f7b9 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Mon, 11 Sep 2023 01:00:52 -0400 Subject: [PATCH] Configuration console commands --- ConsoleCommands.cs | 90 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/ConsoleCommands.cs b/ConsoleCommands.cs index ea16dfc..13d604d 100644 --- a/ConsoleCommands.cs +++ b/ConsoleCommands.cs @@ -31,9 +31,19 @@ namespace CustomCosmeticLoader return ""; } - [ConsoleCommand(description = "Enables/disables the custom cosmetic loader", paramsDescription = "[true/false]", hidden = true)] - public static string cclSetEnabled(params string[] args) + [ConsoleCommand(description = "Save the custom config loader configuration", hidden = true)] + public static string cclSaveConfig() { + Config.SaveConfig(); + return "Custom cosmetic loader config saved"; + } + + [ConsoleCommand(description = "Enables/disables the custom cosmetic loader", paramsDescription = "[true/false]", hidden = true)] + public static string cclEnabled(params string[] args) + { + if (args.Length == 0) + return "enabled: " + (Config.enabled ? "true" : "false"); + if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; @@ -50,16 +60,12 @@ namespace CustomCosmeticLoader return "Enabled custom cosmetic loader"; } - [ConsoleCommand(description = "Save the custom config loader configuration", hidden = true)] - public static string cclSaveConfig() - { - Config.SaveConfig(); - return "Custom cosmetic loader config saved"; - } - [ConsoleCommand(description = "Sets the active custom skin", paramsDescription = "[skinName]", hidden = true)] - public static string cclSetCurrentSkin(params string[] args) + public static string cclCurrentSkin(params string[] args) { + if (args.Length == 0) + return "currentSkin: " + Config.currentSkin; + if (args.Length != 1) return "Requires 1 argument, the name of the custom skin"; @@ -76,8 +82,11 @@ namespace CustomCosmeticLoader } [ConsoleCommand(description = "Change which cosmetic to hijack", paramsDescription = "[skinName]", hidden = true)] - public static string cclSetHijackSkin(params string[] args) + public static string cclSkinNameToHijack(params string[] args) { + if (args.Length == 0) + return "skinNameToHijack: " + Config.skinNameToHijack; + if (args.Length != 1) return "Requires 1 argument, the name of the skin cosmetic to hijack"; @@ -103,7 +112,7 @@ namespace CustomCosmeticLoader public static string cclInMainMenu(params string[] args) { if (args.Length == 0) - return "inMainMenu: " + (Config.inMainMenu ? "true" : "false"); ; + return "inMainMenu: " + (Config.inMainMenu ? "true" : "false"); if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; @@ -117,7 +126,7 @@ namespace CustomCosmeticLoader public static string cclInCosmeticMenu(params string[] args) { if (args.Length == 0) - return "inCosmeticMenu: " + (Config.inCosmeticMenu ? "true" : "false"); ; + return "inCosmeticMenu: " + (Config.inCosmeticMenu ? "true" : "false"); if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; @@ -131,7 +140,7 @@ namespace CustomCosmeticLoader public static string cclInAllReplays(params string[] args) { if (args.Length == 0) - return "inAllReplays: " + (Config.inAllReplays ? "true" : "false"); ; + return "inAllReplays: " + (Config.inAllReplays ? "true" : "false"); if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; @@ -145,7 +154,7 @@ namespace CustomCosmeticLoader public static string cclOverrideReplayCosmetics(params string[] args) { if (args.Length == 0) - return "overrideReplayCosmetics: " + (Config.overrideReplayCosmetics ? "true" : "false"); ; + return "overrideReplayCosmetics: " + (Config.overrideReplayCosmetics ? "true" : "false"); if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; @@ -154,5 +163,56 @@ namespace CustomCosmeticLoader return "Overriding cosmetics in all replays " + (Config.overrideReplayCosmetics ? "enabled" : "disabled"); } + + [ConsoleCommand(description = "List, add, or remove other players", paramsDescription = "[add/remove, playerName, skinName (if add)]", hidden = true)] + public static string cclOtherPlayers(params string[] args) + { + if (args.Length == 0) + { + MIU.Console.Instance.Write("otherPlayers: " + Config.otherPlayers.Count); + foreach (KeyValuePair entry in Config.otherPlayers) + { + MIU.Console.Instance.Write(" " + entry.Key + ": " + entry.Value); + } + return ""; + } + + switch (args[0]) + { + case "add": + if (args.Length != 3) + return "Must have 2 arguments after \"add\""; + string playerName = args[1]; + string skinName = args[2]; + if (!Config.skins.ContainsKey(skinName)) + return "Skin " + skinName + " not found"; + if (Config.otherPlayers.ContainsKey(playerName)) + { + Config.otherPlayers.Remove(playerName); + Config.otherPlayers.Add(playerName, skinName); + return "Updated " + playerName + ": " + skinName; + } + else + { + Config.otherPlayers.Add(playerName, skinName); + return "Added " + playerName + ": " + skinName; + } + case "remove": + if (args.Length != 2) + return "Must have 1 argument after \"remove\""; + playerName = args[1]; + if (Config.otherPlayers.ContainsKey(playerName)) + { + Config.otherPlayers.Remove(playerName); + return "Removed " + playerName; + } + else + { + return "Player " + playerName + " not found"; + } + default: + return "First argument must be either \"add\" or \"remove\""; + } + } } }