using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using DiskCardGame; using InscryptionAPI.Card; using InscryptionAPI.Helpers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OldSa_Cache_sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldSa_Cache_sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a730f331-acfb-4291-9da1-08fbe66ea620")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace OLD_SA.Cache; public static class CacheAPI { public static FullAbility ability; public static void Init() { AbilityInfo val = ScriptableObject.CreateInstance(); ((Object)val).name = "Cache"; val.rulebookName = "Cache"; val.metaCategories = new List { (AbilityMetaCategory)0 }; val.powerLevel = 4; val.opponentUsable = false; val.canStack = false; Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Cache.png", (FilterMode)0); FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, "When [creature] kills a creature, gain a random item."); } ability = AbilityManager.Add("OLD_SA", val, typeof(CacheBehaviour), imageAsTexture); } } public class CacheBehaviour : DrawCreatedCard { public override Ability Ability => CacheAPI.ability.Id; protected override CardInfo CardToDraw { get { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_CONSUMABLE_SQUIRREL"); if ((Object)(object)cardByName != (Object)null) { cardByName.Mods.AddRange(((AbilityBehaviour)this).GetNonDefaultModsFromSelf((Ability[])(object)new Ability[1] { (Ability)(int)((AbilityBehaviour)this).Ability })); } return cardByName; } } public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer) { return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card; } public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer) { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); if (RunState.Run.consumables.Count < RunState.Run.MaxConsumables) { RunState.Run.consumables.Add(((Object)ItemsUtil.GetRandomUnlockedConsumable(((TriggerReceiver)this).GetRandomSeed())).name); Singleton.Instance.UpdateItems(false); yield return (object)new WaitForSeconds(0.2f); yield return ((AbilityBehaviour)this).LearnAbility(0f); } else { yield return ((DrawCreatedCard)this).CreateDrawnCard(); } } } [BepInPlugin("OLD_SA.Cache", "OLD SA Cache", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "OLD_SA.Cache"; public const string PluginName = "OLD SA Cache"; public const string PluginVersion = "1.0.0"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Cache] Plugin loaded."); try { CacheAPI.Init(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Cache] Cache initialized successfully."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)"[OLD SA Cache] Failed to initialize:"); ((BaseUnityPlugin)this).Logger.LogError((object)ex); } } }