Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LoadoutSkillTitles v1.0.1
plugins/LoadoutSkillTitles.dll
Decompiled 2 years 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.Bootstrap; using BepInEx.Configuration; using IL.RoR2.UI; using LoadoutSkillTitles.Modules; using Mono.Cecil.Cil; using MonoMod.Cil; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("LoadoutSkillTitles")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+963bbb9fd2b2ec155c500ab5996efb7c53aa6d6a")] [assembly: AssemblyProduct("LoadoutSkillTitles")] [assembly: AssemblyTitle("LoadoutSkillTitles")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LoadoutSkillTitles { [BepInPlugin("com.TheTimeSweeper.LoadoutSkillTitles", "Loadout Skill Titles", "1.0.0")] public class LoadoutSkillTitlesPlugin : BaseUnityPlugin { public static LoadoutSkillTitlesPlugin instance; private Dictionary<string, Dictionary<int, string>> titleTokens = new Dictionary<string, Dictionary<int, string>>(); private ConfigEntry<bool> firstSkillPassive; private ConfigEntry<bool> fallbackToSkillName; public static void AddTitleToken(string bodyName, int skillSlotIndex, string token) { if (!instance.titleTokens.ContainsKey(bodyName)) { instance.titleTokens[bodyName] = new Dictionary<int, string>(); } instance.titleTokens[bodyName][skillSlotIndex] = token; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown instance = this; InitConfig(); InitDefaultTitles(); Row.FromSkillSlot += new Manipulator(Row_FromSkillSlot); } private void InitDefaultTitles() { AddTitleToken("ToolbotBody", 1, "LOADOUT_SKILL_PRIMARY"); AddTitleToken("CaptainBody", 4, "LOADOUT_SKILL_CAPTAIN_BEACON1"); AddTitleToken("CaptainBody", 5, "LOADOUT_SKILL_CAPTAIN_BEACON2"); if (Language.printingEnabled) { Language.Add("LOADOUT_SKILL_PASSIVE", "Passive"); Language.Add("LOADOUT_SKILL_CAPTAIN_BEACON1", "Beacon 1"); Language.Add("LOADOUT_SKILL_CAPTAIN_BEACON2", "Beacon 2"); Language.PrintOutput("SkillTitles.language"); } } private void InitConfig() { string section = "hope life is treating you well"; firstSkillPassive = Config.BindAndOptions(section, "First Skill Passive", defaultValue: true, "Non-primary generic skill in skillslot 0 will be titled 'Passive'"); fallbackToSkillName = Config.BindAndOptions(section, "Fallback to skillName", defaultValue: false, "if a proper title token isn't found, use the skillName of the GenericSkill component for that slot"); } private void Row_FromSkillSlot(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchLdstr(instruction, "LOADOUT_SKILL_MISC") }); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldarg_2); val.Emit(OpCodes.Ldarg_3); val.EmitDelegate<Func<string, BodyIndex, int, GenericSkill, string>>((Func<string, BodyIndex, int, GenericSkill, string>)delegate(string originalString, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill genericSkill) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) string bodyName = BodyCatalog.GetBodyName(bodyIndex); if (titleTokens.ContainsKey(bodyName) && titleTokens[bodyName].ContainsKey(skillSlotIndex)) { return titleTokens[bodyName][skillSlotIndex]; } if ((Object)(object)genericSkill == (Object)null) { return originalString; } if (!string.IsNullOrEmpty(genericSkill.skillName) && genericSkill.skillName.StartsWith("LOADOUT")) { return genericSkill.skillName; } if (firstSkillPassive.Value && skillSlotIndex == 0 && (Object)(object)((Component)genericSkill).GetComponent<SkillLocator>().primary != (Object)(object)genericSkill) { return "LOADOUT_SKILL_PASSIVE"; } return (!string.IsNullOrEmpty(genericSkill.skillName) && fallbackToSkillName.Value) ? genericSkill.skillName : originalString; }); } } } namespace LoadoutSkillTitles.Modules { internal static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)LoadoutSkillTitlesPlugin.instance).Config; public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = MyConfig.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption<T>(val, restartRequired); } return val; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<float> val = MyConfig.Bind<float>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOptionSlider(val, min, max, restartRequired); } return val; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (entry is ConfigEntry<float>) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig { min = 0f, max = 20f, formatString = "{0:0.00}", restartRequired = restartRequired })); } if (entry is ConfigEntry<int>) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, restartRequired)); } if (entry is ConfigEntry<bool>) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOptionSlider(ConfigEntry<float> entry, float min, float max, bool restartRequired) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, formatString = "{0:0.00}", restartRequired = restartRequired })); } public static bool GetKeyPressed(ConfigEntry<KeyboardShortcut> entry) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = entry.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } value = entry.Value; return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); } } internal static class Language { public static string TokensOutput = ""; public static bool printingEnabled = false; public static void Add(string token, string text) { if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\r\n \"strings\": {" + TokensOutput + "\r\n },\r\n \"en\": {" + TokensOutput + "\r\n }\r\n}"; Debug.LogWarning((object)(fileName + ": \n" + text)); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)LoadoutSkillTitlesPlugin.instance).Info.Location).FullName, fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } }