using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Faust.QoLChests.Components; using Faust.QoLChests.Configs; using Faust.QoLChests.Handlers; using ItemQualities; using Microsoft.CodeAnalysis; using RoR2; using UnityEngine; [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("ItemQualitiesQoLChestsCompat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItemQualitiesQoLChestsCompat")] [assembly: AssemblyTitle("ItemQualitiesQoLChestsCompat")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace ItemQualitiesQoLChestsCompat { [BepInPlugin("com.KombatKingo.ItemQualitiesQoLChestsCompat", "Quality QoLChests Patch", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ItemQualitiesQoLChestsCompatPlugin : BaseUnityPlugin { public const string PluginGUID = "com.KombatKingo.ItemQualitiesQoLChestsCompat"; public const string PluginName = "Quality QoLChests Patch"; public const string PluginVersion = "1.0.0"; public void Awake() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnGameLoaded)); } private void OnGameLoaded() { try { TagPrefab(SpawnCards.QualityChest1, (InteractableCategory)0); TagPrefab(SpawnCards.QualityChest2, (InteractableCategory)0); TagPrefab(SpawnCards.Chest2Stealthed, (InteractableCategory)6); TagPrefab(SpawnCards.QualityDuplicator, (InteractableCategory)3); TagPrefab(SpawnCards.QualityDuplicatorLarge, (InteractableCategory)3); TagPrefab(SpawnCards.QualityDuplicatorMilitary, (InteractableCategory)3); TagPrefab(SpawnCards.QualityDuplicatorWild, (InteractableCategory)3); TagPrefab(SpawnCards.QualityEquipmentBarrel, (InteractableCategory)9); TryTagInternalPrefab("ItemQualities.Items.SpeedOnPickup", "_iscSpeedOnPickupBarrel", (InteractableCategory)9); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully injected QoLChests highlighting components into all ItemQualities prefabs."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Critical failure while hooking ItemQualities into QoLChests:\n{arg}"); } } private void TagPrefab(InteractableSpawnCard spawnCard, InteractableCategory category) { //IL_0025: 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) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)spawnCard == (Object)null) && !((Object)(object)((SpawnCard)spawnCard).prefab == (Object)null)) { GameObject prefab = ((SpawnCard)spawnCard).prefab; InteractableRegistry.Register(((Object)prefab).name, category); InteractableHighlightCategoryMarker val = prefab.GetComponent(); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent(); } val.SetCategory(category); ((BaseUnityPlugin)this).Logger.LogDebug((object)$"[Compat] Successfully tagged: {((Object)prefab).name} as {category}"); } } private void TryTagInternalPrefab(string fullClassName, string fieldName, InteractableCategory category) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) try { Type type = typeof(ItemQualitiesPlugin).Assembly.GetType(fullClassName); if (type != null) { FieldInfo field = type.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(null); InteractableSpawnCard val = (InteractableSpawnCard)((value is InteractableSpawnCard) ? value : null); if ((Object)(object)val != (Object)null) { TagPrefab(val, category); return; } } } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Compat] Could not resolve internal field " + fieldName + " in " + fullClassName + ".")); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"[Compat] Reflection failed for {fullClassName}.{fieldName}:\n{arg}"); } } } }