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 R2API Elites v1.1.1
plugins/R2API.Elites/R2API.Elites.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; 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 System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HG; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.Utils; using On.RoR2; using R2API.AutoVersionGen; using R2API.ContentManagement; using RoR2; using RoR2BepInExPack.GameAssetPaths; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("R2API.Elites")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+534d7e97f329b7efaa139a8e4dc60f676e792eb2")] [assembly: AssemblyProduct("R2API.Elites")] [assembly: AssemblyTitle("R2API.Elites")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } } namespace R2API { public class CustomElite { public EliteDef EliteDef; public Texture2D? EliteRamp; public IEnumerable<EliteTierDef> EliteTierDefs; public CustomElite(string name, EquipmentDef equipmentDef, Color32 color, string modifierToken, IEnumerable<EliteTierDef> eliteTierDefs) : this(name, equipmentDef, color, modifierToken, eliteTierDefs, null) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) public CustomElite(string name, EquipmentDef equipmentDef, Color32 color, string modifierToken, IEnumerable<EliteTierDef> eliteTierDefs, Texture2D? eliteRamp) { //IL_002f: 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) EliteDef = ScriptableObject.CreateInstance<EliteDef>(); ((Object)EliteDef).name = name; EliteDef.eliteEquipmentDef = equipmentDef; EliteDef.color = color; EliteDef.modifierToken = modifierToken; EliteTierDefs = eliteTierDefs ?? Array.Empty<EliteTierDef>(); EliteRamp = eliteRamp; } public CustomElite(EliteDef eliteDef, IEnumerable<EliteTierDef> eliteTierDefs) : this(eliteDef, eliteTierDefs, null) { } public CustomElite(EliteDef eliteDef, IEnumerable<EliteTierDef> eliteTierDefs, Texture2D? eliteRamp) { EliteDef = eliteDef; EliteTierDefs = eliteTierDefs ?? Array.Empty<EliteTierDef>(); EliteRamp = eliteRamp; } } [AutoVersion] public static class EliteAPI { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ResolveFieldInfo; public static hook_Init <1>__CopyCombatDirectorTiers; public static Manipulator <2>__InitEarlyCombatDirector; public static Func<EliteTierDef, int, EliteTierDef> <3>__UseExistingTierDef; } public const string PluginGUID = "com.bepis.r2api.elites"; public const string PluginName = "R2API.Elites"; public static ObservableCollection<CustomElite> EliteDefinitions = new ObservableCollection<CustomElite>(); public static int VanillaEliteTierCount; private static readonly List<EliteTierDef> CustomEliteTierDefs = new List<EliteTierDef>(); private static EliteTierDef[] _vanillaEliteTiers = Array.Empty<EliteTierDef>(); private static bool _resolvedFields = false; public const string PluginVersion = "1.1.1"; public static EliteTierDef[] VanillaEliteTiers { get { return _vanillaEliteTiers; } private set { _vanillaEliteTiers = value; VanillaEliteTierCount = ((value != null) ? value.Length : 0); } } public static EliteTierDef VanillaFirstTierDef => GetVanillaEliteTierDef(VanillaEliteTier.BaseTier1); public static EliteTierDef VanillaEliteOnlyFirstTierDef => GetVanillaEliteTierDef(VanillaEliteTier.BaseTier1Honor); public static int CustomEliteTierCount => CustomEliteTierDefs.Count; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static EliteTierDef GetVanillaEliteTierDef(VanillaEliteTier tier) { return ArrayUtils.GetSafe<EliteTierDef>(VanillaEliteTiers, (int)tier); } internal static void Init() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__ResolveFieldInfo; if (obj == null) { Manipulator val = ResolveFieldInfo; <>O.<0>__ResolveFieldInfo = val; obj = (object)val; } CombatDirector.Init += (Manipulator)obj; object obj2 = <>O.<0>__ResolveFieldInfo; if (obj2 == null) { Manipulator val2 = ResolveFieldInfo; <>O.<0>__ResolveFieldInfo = val2; obj2 = (object)val2; } CombatDirector.Init -= (Manipulator)obj2; object obj3 = <>O.<1>__CopyCombatDirectorTiers; if (obj3 == null) { hook_Init val3 = CopyCombatDirectorTiers; <>O.<1>__CopyCombatDirectorTiers = val3; obj3 = (object)val3; } CombatDirector.Init += (hook_Init)obj3; object obj4 = <>O.<2>__InitEarlyCombatDirector; if (obj4 == null) { Manipulator val4 = InitEarlyCombatDirector; <>O.<2>__InitEarlyCombatDirector = val4; obj4 = (object)val4; } CombatDirector.Init += (Manipulator)obj4; CombatDirector.Init(); } internal static void UnsetHooks() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<2>__InitEarlyCombatDirector; if (obj == null) { Manipulator val = InitEarlyCombatDirector; <>O.<2>__InitEarlyCombatDirector = val; obj = (object)val; } CombatDirector.Init -= (Manipulator)obj; object obj2 = <>O.<1>__CopyCombatDirectorTiers; if (obj2 == null) { hook_Init val2 = CopyCombatDirectorTiers; <>O.<1>__CopyCombatDirectorTiers = val2; obj2 = (object)val2; } CombatDirector.Init -= (hook_Init)obj2; } private static void CopyCombatDirectorTiers(orig_Init orig) { orig.Invoke(); if (VanillaEliteTierCount == 0) { VanillaEliteTiers = CombatDirector.eliteTiers.ToArray(); } AddElitesToGame(); } private static void InitEarlyCombatDirector(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int idx = 0; while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref idx), (Instruction x) => ILPatternMatchingExt.MatchNewobj<EliteTierDef>(x) })) { val.Emit(OpCodes.Ldc_I4, idx); val.EmitDelegate<Func<EliteTierDef, int, EliteTierDef>>((Func<EliteTierDef, int, EliteTierDef>)UseExistingTierDef); } } private static EliteTierDef UseExistingTierDef(EliteTierDef tierDef, int index) { return ArrayUtils.GetSafe<EliteTierDef>(VanillaEliteTiers, index, ref tierDef); } private static void ResolveFieldInfo(ILContext il) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (_resolvedFields || !TryLoadTokensFromFile(out Dictionary<string, string> assetNameToGuid)) { return; } ILCursor val = new ILCursor(il); FieldReference fieldRef = null; while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref fieldRef) })) { if (!assetNameToGuid.TryGetValue(((MemberReference)fieldRef).Name, out var value)) { continue; } EliteDef val2 = Addressables.LoadAssetAsync<EliteDef>((object)value).WaitForCompletion(); if (val2 == null) { ElitesPlugin.Logger.LogWarning((object)("Failed to load addressable " + ((MemberReference)fieldRef).Name + " | " + value)); continue; } FieldInfo fieldInfo = ReflectionHelper.ResolveReflection(fieldRef); if (fieldInfo.GetValue(null) == null) { fieldInfo.SetValue(null, val2); } } _resolvedFields = true; } private static bool TryLoadTokensFromFile(out Dictionary<string, string> assetNameToGuid) { assetNameToGuid = null; try { string[] array = default(string[]); string[] array2 = default(string[]); GameAssetPathsSerde.Deserialize(Path.Combine(Directory.GetParent(typeof(GameAssetPathsSerde).Assembly.Location).FullName, "GameAssetPaths.bin"), ref array, ref array2); Regex regex = new Regex("RoR2.*/ed[A-Z].*asset"); assetNameToGuid = new Dictionary<string, string>(); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (regex.IsMatch(text)) { string text2 = text.Split('/')[^1]; string key = text2.Substring(2, text2.Length - 6 - 2); assetNameToGuid[key] = array2[i]; } } return true; } catch (Exception ex) { ElitesPlugin.Logger.LogError((object)("Failed to load elite addressable tokens from file: " + ex)); } return false; } [MethodImpl(MethodImplOptions.NoInlining)] public static bool Add(CustomElite? elite) { return AddInternal(elite, Assembly.GetCallingAssembly()); } public static int AppendCustomEliteTier(EliteTierDef? eliteTierDef) { return AddCustomEliteTier(eliteTierDef, -1); } public static int AddCustomEliteTier(EliteTierDef? eliteTierDef) { EliteTierDef eliteTierDef2 = eliteTierDef; if (eliteTierDef2 == null) { ElitesPlugin.Logger.LogError((object)"EliteTierDef cannot be null"); return -1; } int indexToInsertAt = Array.FindIndex(GetCombatDirectorEliteTiers(), (EliteTierDef x) => x.costMultiplier >= eliteTierDef2.costMultiplier); return AddCustomEliteTier(eliteTierDef2, indexToInsertAt); } public static int AddCustomEliteTier(EliteTierDef? eliteTierDef, int indexToInsertAt = -1) { if (eliteTierDef == null) { ElitesPlugin.Logger.LogError((object)"EliteTierDef cannot be null"); return -1; } EliteTierDef val = eliteTierDef; if (val.eliteTypes == null) { val.eliteTypes = Array.Empty<EliteDef>(); } EliteTierDef[] combatDirectorEliteTiers = GetCombatDirectorEliteTiers(); if (combatDirectorEliteTiers != null) { if (indexToInsertAt == -1) { indexToInsertAt = combatDirectorEliteTiers.Length; } ArrayUtils.ArrayInsert<EliteTierDef>(ref combatDirectorEliteTiers, indexToInsertAt, ref eliteTierDef); OverrideCombatDirectorEliteTiers(combatDirectorEliteTiers); } CustomEliteTierDefs.Add(eliteTierDef); ElitesPlugin.Logger.LogInfo((object)$"Custom Elite Tier : (Index : {indexToInsertAt}) added"); return indexToInsertAt; } internal static bool AddInternal(CustomElite? customElite, Assembly addingAssembly) { if ((Object)(object)customElite?.EliteDef == (Object)null) { throw new ArgumentNullException("customElite.EliteDef"); } if (!CatalogBlockers.GetAvailability<EliteDef>()) { ElitesPlugin.Logger.LogError((object)("Too late ! Tried to add elite: " + customElite.EliteDef.modifierToken + " after the EliteCatalog has initialized!")); return false; } R2APIContentManager.HandleContentAddition(addingAssembly, (Object)(object)customElite.EliteDef); EliteDefinitions.Add(customElite); return true; } private static void AddElitesToGame() { foreach (CustomElite eliteDefinition in EliteDefinitions) { if (Object.op_Implicit((Object)(object)eliteDefinition.EliteRamp)) { EliteRamp.AddRamp(eliteDefinition.EliteDef, eliteDefinition.EliteRamp); } foreach (EliteTierDef eliteTierDef in eliteDefinition.EliteTierDefs) { if (Array.IndexOf(eliteTierDef.eliteTypes, eliteDefinition.EliteDef) == -1) { ArrayUtils.ArrayAppend<EliteDef>(ref eliteTierDef.eliteTypes, ref eliteDefinition.EliteDef); } } } } public static IEnumerable<EliteTierDef> GetEliteTierEnumerable(VanillaEliteTier tier) { return tier switch { VanillaEliteTier.None => Array.Empty<EliteTierDef>(), VanillaEliteTier.BaseTier1 => new <>z__ReadOnlyArray<EliteTierDef>((EliteTierDef[])(object)new EliteTierDef[2] { GetVanillaEliteTierDef(tier), GetVanillaEliteTierDef(VanillaEliteTier.FullTier1) }), VanillaEliteTier.BaseTier1Honor => new <>z__ReadOnlyArray<EliteTierDef>((EliteTierDef[])(object)new EliteTierDef[2] { GetVanillaEliteTierDef(tier), GetVanillaEliteTierDef(VanillaEliteTier.FullTier1Honor) }), _ => new <>z__ReadOnlySingleElementList<EliteTierDef>(GetVanillaEliteTierDef(tier)), }; } public static IEnumerable<EliteTierDef> GetHonorEliteTierEnumerable(VanillaEliteTier tier) { switch (tier) { case VanillaEliteTier.BaseTier1: case VanillaEliteTier.BaseTier1Honor: return new <>z__ReadOnlyArray<EliteTierDef>((EliteTierDef[])(object)new EliteTierDef[2] { GetVanillaEliteTierDef(VanillaEliteTier.BaseTier1Honor), GetVanillaEliteTierDef(VanillaEliteTier.FullTier1Honor) }); case VanillaEliteTier.FullTier1Honor: case VanillaEliteTier.FullTier1: return new <>z__ReadOnlySingleElementList<EliteTierDef>(GetVanillaEliteTierDef(VanillaEliteTier.FullTier1Honor)); default: return Array.Empty<EliteTierDef>(); } } public static EliteTierDef[] GetCombatDirectorEliteTiers() { return CombatDirector.eliteTiers; } public static void OverrideCombatDirectorEliteTiers(EliteTierDef[] newEliteTiers) { CombatDirector.eliteTiers = newEliteTiers; } } public static class EliteRamp { [CompilerGenerated] private static class <>O { public static Manipulator <0>__UpdateRampProperly; public static Action <1>__SetupDictionary; public static Action<CharacterModel> <2>__UpdateRampFromModel; } private static readonly Dictionary<EliteDef, Texture2D> _elitesAndRamps = new Dictionary<EliteDef, Texture2D>(); private static readonly Dictionary<EliteIndex, Texture2D> _eliteIndexToTexture = new Dictionary<EliteIndex, Texture2D>(); private static int _eliteRampPropertyID; private static bool _hooksEnabled = false; internal static void SetHooks() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if (!_hooksEnabled) { AsyncOperationHandle<Texture2D> val = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_GlobalTextures.texRampElites_psd); val.Completed += delegate(AsyncOperationHandle<Texture2D> task) { _eliteIndexToTexture[(EliteIndex)(-1)] = task.Result; }; object obj = <>O.<0>__UpdateRampProperly; if (obj == null) { Manipulator val2 = UpdateRampProperly; <>O.<0>__UpdateRampProperly = val2; obj = (object)val2; } CharacterModel.UpdateMaterials += (Manipulator)obj; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(SetupDictionary)); _hooksEnabled = true; } } internal static void UnsetHooks() { //IL_0010: 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_001b: Expected O, but got Unknown object obj = <>O.<0>__UpdateRampProperly; if (obj == null) { Manipulator val = UpdateRampProperly; <>O.<0>__UpdateRampProperly = val; obj = (object)val; } CharacterModel.UpdateMaterials -= (Manipulator)obj; RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(SetupDictionary)); _hooksEnabled = false; } private static void UpdateRampProperly(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterModel>(x, "propertyStorage"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonShaderProperties), "_EliteIndex") })) { ElitesPlugin.Logger.LogError((object)"Elite Ramp ILHook failed #1"); return; } if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<MaterialPropertyBlock>(x, "SetFloat") })) { ElitesPlugin.Logger.LogError((object)"Elite Ramp ILHook failed #2"); return; } val.Emit(OpCodes.Ldarg, 0); val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)UpdateRampFromModel); } private static void UpdateRampFromModel(CharacterModel model) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!_eliteIndexToTexture.TryGetValue(model.myEliteIndex, out Texture2D value)) { value = _eliteIndexToTexture[(EliteIndex)(-1)]; } model.propertyStorage.SetTexture(_eliteRampPropertyID, (Texture)(object)value); } private static void SetupDictionary() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) _eliteRampPropertyID = Shader.PropertyToID("_EliteRamp"); foreach (var (val3, value) in _elitesAndRamps) { if (Object.op_Implicit((Object)(object)val3) && (int)val3.eliteIndex != -1) { _eliteIndexToTexture[val3.eliteIndex] = value; } } _elitesAndRamps.Clear(); } public static void AddRamp(EliteDef eliteDef, Texture2D ramp) { SetHooks(); if (!Object.op_Implicit((Object)(object)eliteDef)) { ElitesPlugin.Logger.LogError((object)"Attempted to set a texture ramp for a null elite def!"); return; } if (_elitesAndRamps.TryGetValue(eliteDef, out Texture2D value) && (Object)(object)value != (Object)(object)ramp) { ElitesPlugin.Logger.LogWarning((object)("Texture ramp for " + (((Object)eliteDef).name ?? eliteDef.modifierToken) + " already exists. The new texture will be used instead.")); } eliteDef.shaderEliteRampIndex = 0; _elitesAndRamps[eliteDef] = ramp; } public static void AddRampToMultipleElites(IEnumerable<EliteDef> eliteDefs, Texture2D ramp) { SetHooks(); foreach (EliteDef eliteDef in eliteDefs) { AddRamp(eliteDef, ramp); } } public static bool TryGetRamp(EliteIndex eliteIndex, out Texture2D ramp) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) SetHooks(); ramp = null; if ((int)eliteIndex != -1) { return _eliteIndexToTexture.TryGetValue(eliteIndex, out ramp); } return false; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.elites", "R2API.Elites", "1.1.1")] public sealed class ElitesPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; EliteAPI.Init(); } private void OnDestroy() { EliteAPI.UnsetHooks(); EliteRamp.UnsetHooks(); } } public enum VanillaEliteTier { None, BaseTier1, BaseTier1Honor, FullTier1Honor, FullTier1, Tier2, Lunar } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }