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 EliteLookSwap v1.0.0
EliteLookSwap.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EliteLookSwap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EliteLookSwap")] [assembly: AssemblyTitle("EliteLookSwap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EliteLookSwap { [BepInPlugin("_prodzpod.EliteLookSwap", "EliteLookSwap", "1.0.0")] public class Main : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<EquipmentDef, bool> <>9__10_2; public static Func<EquipmentDef, string> <>9__10_3; public static Action <>9__10_0; public static hook_SetEquipmentDisplay <>9__10_1; internal void <Awake>b__10_0() { List<string> list = new List<string>(); foreach (string item in from x in EquipmentCatalog.equipmentDefs where (Object)(object)x.passiveBuffDef?.eliteDef != (Object)null select ((Object)x).name) { string text = item.ToUpper(); if (Overrides.ContainsKey(text.ToUpper())) { text = text + "=" + Overrides[text.ToUpper()]; } list.Add(text); } Log.LogInfo((object)("Elites: " + string.Join(", ", list))); } internal bool <Awake>b__10_2(EquipmentDef x) { return (Object)(object)x.passiveBuffDef?.eliteDef != (Object)null; } internal string <Awake>b__10_3(EquipmentDef x) { return ((Object)x).name; } internal void <Awake>b__10_1(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex idx) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass10_0 CS$<>8__locals0 = new <>c__DisplayClass10_0 { def = EquipmentCatalog.GetEquipmentDef(idx) }; if ((Object)(object)CS$<>8__locals0.def != (Object)null && Overrides.ContainsKey(((Object)CS$<>8__locals0.def).name.ToUpper())) { EquipmentDef? obj = ((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Overrides[((Object)CS$<>8__locals0.def).name.ToUpper()])); orig.Invoke(self, (obj != null) ? obj.equipmentIndex : idx); } else { orig.Invoke(self, idx); } } } [CompilerGenerated] private sealed class <>c__DisplayClass10_0 { public EquipmentDef def; internal bool <Awake>b__4(EquipmentDef x) { return ((Object)x).name.ToUpper() == Overrides[((Object)def).name.ToUpper()]; } } public const string PluginGUID = "_prodzpod.EliteLookSwap"; public const string PluginAuthor = "_prodzpod"; public const string PluginName = "EliteLookSwap"; public const string PluginVersion = "1.0.0"; public static ManualLogSource Log; public static PluginInfo pluginInfo; public static ConfigFile Config; public static Harmony Harmony; public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; Log = ((BaseUnityPlugin)this).Logger; Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "_prodzpod.EliteLookSwap.cfg"), true); Harmony = new Harmony("_prodzpod.EliteLookSwap"); OverridesRaw = Config.Bind<string>("General", "Overrides", "NEMESISRISINGTIDES_AFFIXBUFFERED=ELITEVARIETY_AFFIXARMORED, ELITE_EQUIPMENT_MOTIVATING=ELITEVARIETY_AFFIXBUFFING, ELITEVARIETY_AFFIXIMPPLANE=EQUIPMENT_AFFIXARAGONITE, EQUIPMENT_AFFIXARAGONITE=ELITEVARIETY_AFFIXIMPPLANE, ELITEAURELIONITEEQUIPMENT=ELITEVARIETY_AFFIXPILLAGING", "FROM=TO, elite names, separated by commas. see the log for list of valid input for your pack."); string[] array = OverridesRaw.Value.Split(","); foreach (string text in array) { string[] array2 = text.Split("="); if (array2.Length != 2) { Log.LogWarning((object)("Entry is malformed, skipping: " + text)); } else { Overrides.Add(array2[0].Trim().ToUpper(), array2[1].Trim().ToUpper()); } } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { List<string> list = new List<string>(); foreach (string item in from x in EquipmentCatalog.equipmentDefs where (Object)(object)x.passiveBuffDef?.eliteDef != (Object)null select ((Object)x).name) { string text2 = item.ToUpper(); if (Overrides.ContainsKey(text2.ToUpper())) { text2 = text2 + "=" + Overrides[text2.ToUpper()]; } list.Add(text2); } Log.LogInfo((object)("Elites: " + string.Join(", ", list))); }); Harmony.PatchAll(typeof(PatchR2API)); object obj = <>c.<>9__10_1; if (obj == null) { hook_SetEquipmentDisplay val = delegate(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex idx) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) EquipmentDef def = EquipmentCatalog.GetEquipmentDef(idx); if ((Object)(object)def != (Object)null && Overrides.ContainsKey(((Object)def).name.ToUpper())) { EquipmentDef? obj2 = ((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Overrides[((Object)def).name.ToUpper()])); orig.Invoke(self, (obj2 != null) ? obj2.equipmentIndex : idx); } else { orig.Invoke(self, idx); } }; <>c.<>9__10_1 = val; obj = (object)val; } CharacterModel.SetEquipmentDisplay += (hook_SetEquipmentDisplay)obj; } } [HarmonyPatch] public class PatchR2API { public static void ILManipulator(ILContext il, MethodBase original, ILLabel retLabel) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterModel>(x, "myEliteIndex") })) { val.EmitDelegate<Func<EliteIndex, EliteIndex>>((Func<EliteIndex, EliteIndex>)delegate(EliteIndex idx) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) EliteDef def = EliteCatalog.GetEliteDef(idx); if ((Object)(object)def == (Object)null) { return idx; } return Main.Overrides.ContainsKey(((Object)def.eliteEquipmentDef).name.ToUpper()) ? (((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Main.Overrides[((Object)def.eliteEquipmentDef).name.ToUpper()])) ?? def.eliteEquipmentDef).passiveBuffDef.eliteDef.eliteIndex : idx; }); } } public static MethodBase TargetMethod() { return AccessTools.GetDeclaredMethods(typeof(EliteRamp)).Find((MethodInfo x) => x.Name.StartsWith("<UpdateRampProperly>g")); } } }