using MIU; using System; using System.Collections.Generic; using System.Reflection; using UnityEngine; namespace CustomCosmeticLoader { internal class ConsoleCommands { [ConsoleCommand(description = "Shows help for Custom Cosmetic Loader commands")] public static string cclHelp() { MIU.Console.Instance.Write("Available commands:"); foreach (MethodInfo method in typeof(ConsoleCommands).GetMethods()) { if (!method.IsDefined(typeof(ConsoleCommandAttribute), false)) continue; ConsoleCommandAttribute attr = method.GetCustomAttribute(); string name = attr.name; if (name == null) name = method.Name; if (attr.paramsDescription != null && attr.paramsDescription.Length > 0) MIU.Console.Instance.Write(" " + name + " " + attr.paramsDescription + ": " + attr.description); else MIU.Console.Instance.Write(" " + name + ": " + attr.description); } return ""; } [ConsoleCommand(description = "Enables/disables the custom cosmetic loader", paramsDescription = "[true/false]", hidden = true)] public static string cclSetEnabled(params string[] args) { if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; if (args[0] == "false") { Config.enabled = false; return "Disabled custom cosmetic loader"; } Config.enabled = true; Config.ensureSkinSelected(); if (!Config.enabled) return "No skins found, could not enable!"; 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) { if (args.Length != 1) return "Requires 1 argument, the name of the custom skin"; foreach (KeyValuePair skin in Config.skins) { if (skin.Key == args[0]) { Config.currentSkin = skin.Key; return "Using custom skin " + skin.Key; } } return "Couldn't find skin " + args[0]; } [ConsoleCommand(description = "Change which cosmetic to hijack", paramsDescription = "[skinName]", hidden = true)] public static string cclSetHijackSkin(params string[] args) { if (args.Length != 1) return "Requires 1 argument, the name of the skin cosmetic to hijack"; if (args[0] == "*") { Config.skinNameToHijack = "*"; return "Hijack skin set to all skins"; } foreach (Cosmetic skin in CosmeticManager.Skins) { if (skin.Id == args[0]) { Config.skinNameToHijack = args[0]; return "Hijack skin set to " + args[0]; } } return "Couldn't find cosmetic " + args[0]; } [ConsoleCommand(description = "Enable/disable custom skins on the My Marble widgets", paramsDescription = "[true/false]", hidden = true)] public static string cclInMainMenu(params string[] args) { if (args.Length == 0) return "inMainMenu: " + (Config.inMainMenu ? "true" : "false"); ; if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; Config.inMainMenu = args[0] == "true"; return "Custom skins in main menu " + (Config.inMainMenu ? "enabled" : "disabled"); } [ConsoleCommand(description = "Enable/disable custom skins in the cosmetic menu (for previewing hijack skins)", paramsDescription = "[true/false]", hidden = true)] public static string cclInCosmeticMenu(params string[] args) { if (args.Length == 0) return "inCosmeticMenu: " + (Config.inCosmeticMenu ? "true" : "false"); ; if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; Config.inCosmeticMenu = args[0] == "true"; return "Custom skins in cosmetic menu " + (Config.inCosmeticMenu ? "enabled" : "disabled"); } [ConsoleCommand(description = "Enable/disable showing your custom skin in all replays, regardless of player", paramsDescription = "[true/false]", hidden = true)] public static string cclInAllReplays(params string[] args) { if (args.Length == 0) return "inAllReplays: " + (Config.inAllReplays ? "true" : "false"); ; if (args.Length != 1 || (args[0] != "true" && args[0] != "false")) return "Requires a true or false argument"; Config.inAllReplays = args[0] == "true"; return "Custom skins in all replays " + (Config.inAllReplays ? "enabled" : "disabled"); } } }