using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PackOfCardsMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PackOfCardsMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7a22f61b-c571-445a-ba37-b2779eb31345")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public static class PackOfCardsPreset { public static Value CreateValuePreset() { Value obj = ScriptableObject.CreateInstance(); obj.valueMin = 3500f; obj.valueMax = 3500f; return obj; } public static Durability CreateDurabilityPreset() { Durability obj = ScriptableObject.CreateInstance(); obj.fragility = 10f; obj.durability = 50f; return obj; } public static PhysAttribute CreatePhysPreset() { PhysAttribute obj = ScriptableObject.CreateInstance(); obj.mass = 0.2f; return obj; } public static PhysAudio CreateAudioPreset() { return ScriptableObject.CreateInstance(); } } [BepInPlugin("ty.packofcards", "Pack of Cards Item", "1.0.0")] public class TyPackOfCardsLoot : BaseUnityPlugin { internal static TyPackOfCardsLoot Instance; internal Dictionary cardBundles = new Dictionary(); internal Dictionary cardPrefabs = new Dictionary(); private readonly string[] cardNames = new string[10] { "xrcard", "rcard1", "rarecard2", "basecard", "2ndtmehcard", "3rdtmehcard", "cc", "3rdworstcard", "2ndtwcard", "mcard" }; private void Awake() { Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PackOfCardsMod loaded."); LoadCardBundles(); RegisterPackValuable(); } public void Log(string msg) { ((BaseUnityPlugin)this).Logger.LogInfo((object)msg); } public void LogWarn(string msg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)msg); } private void LoadCardBundles() { string path = Path.Combine(Paths.PluginPath, "PackOfCards"); string[] array = cardNames; foreach (string text in array) { string text2 = Path.Combine(path, text); if (!File.Exists(text2)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Card bundle not found: " + text2)); continue; } AssetBundle val = AssetBundle.LoadFromFile(text2); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load card bundle: " + text2)); continue; } cardBundles[text] = val; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded card bundle: " + text)); string text3 = val.GetAllAssetNames().FirstOrDefault((string a) => a.EndsWith(".prefab") || !Enumerable.Contains(a, '.')); if (!string.IsNullOrEmpty(text3)) { GameObject val2 = val.LoadAsset(text3); if ((Object)(object)val2 != (Object)null) { cardPrefabs[text] = val2; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded card prefab for " + text + ": " + ((Object)val2).name)); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Prefab asset path found but failed to load GameObject: " + text3)); } } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("No prefab asset found inside bundle: " + text)); } } } private void RegisterPackValuable() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Paths.PluginPath, "PackOfCards", "cardpack")); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Cannot register valuable — cardpack bundle not loaded."); return; } string text = val.GetAllAssetNames().FirstOrDefault((string a) => a.EndsWith(".prefab") || !Enumerable.Contains(a, '.')); if (text == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"No prefab found in cardpack AssetBundle!"); return; } GameObject val2 = val.LoadAsset(text); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load prefab at path: " + text)); return; } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent().mass = 0.2f; } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent().size = new Vector3(0.2f, 0.1f, 0.3f); } ValuableObject obj = val2.GetComponent() ?? val2.AddComponent(); obj.valuePreset = PackOfCardsPreset.CreateValuePreset(); obj.durabilityPreset = PackOfCardsPreset.CreateDurabilityPreset(); obj.physAttributePreset = PackOfCardsPreset.CreatePhysPreset(); obj.audioPreset = PackOfCardsPreset.CreateAudioPreset(); if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } (val2.GetComponent() ?? val2.AddComponent()).VolumeType = (Type)1; if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent().interactRange = 2.5f; } PrefabRef val3 = new PrefabRef(); ((PrefabRef)(object)val3).SetPrefab(val, text); LevelValuables[] array = Resources.FindObjectsOfTypeAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Registering Pack of Cards with {array.Length} levels"); LevelValuables[] array2 = array; foreach (LevelValuables val4 in array2) { if (val4.small != null) { val4.small.Add(val3); ((BaseUnityPlugin)this).Logger.LogInfo((object)("✓ Added Pack of Cards to " + ((Object)val4).name)); } } } } public class PackOpenBehaviour : MonoBehaviour { } public class PackOpenBehaviourNew : MonoBehaviour { public float interactRange = 2.5f; private bool opened; private Transform mainCam; private void Start() { Camera main = Camera.main; mainCam = ((main != null) ? ((Component)main).transform : null); } private void Update() { //IL_0043: 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) if (!opened) { if ((Object)(object)mainCam == (Object)null) { Camera main = Camera.main; mainCam = ((main != null) ? ((Component)main).transform : null); } if (!((Object)(object)mainCam == (Object)null) && Vector3.Distance(mainCam.position, ((Component)this).transform.position) <= interactRange && Input.GetKeyDown((KeyCode)101)) { OpenPack(); } } } private void OpenPack() { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) opened = true; TyPackOfCardsLoot.Instance?.Log("Player opened a Pack of Cards."); List list = new List { "xrcard", "rcard1", "rarecard2", "basecard", "2ndtmehcard", "3rdtmehcard", "cc", "3rdworstcard", "2ndtwcard", "mcard" }; Random random = new Random(); int num = list.Count; while (num > 1) { num--; int index = random.Next(num + 1); string value = list[index]; list[index] = list[num]; list[num] = value; } for (int i = 0; i < list.Count; i++) { string text = list[i]; float num2; if (text == "mcard") { num2 = 0.2f; } else { switch (i) { case 0: num2 = 0.05f; break; case 1: case 2: num2 = 0.075f; break; default: num2 = 0.1f; break; } } if (!(Random.value <= num2)) { TyPackOfCardsLoot.Instance?.Log($"Card {text} skipped (roll > {num2})."); } else if (text == "mcard") { if (TrySpawnRandomMonster()) { TyPackOfCardsLoot.Instance?.Log("mcard effect: spawned random monster."); } else { TyPackOfCardsLoot.Instance?.LogWarn("mcard effect: no monster prefab found to spawn."); } } else if ((Object)(object)TyPackOfCardsLoot.Instance != (Object)null && TyPackOfCardsLoot.Instance.cardPrefabs.ContainsKey(text)) { GameObject obj = TyPackOfCardsLoot.Instance.cardPrefabs[text]; Vector3 val = ((Component)this).transform.position + Vector3.up * 0.5f + Random.insideUnitSphere * 0.3f; Object.Instantiate(obj, val, Quaternion.identity); TyPackOfCardsLoot.Instance?.Log($"Spawned card {text} at {val}."); } else { TyPackOfCardsLoot.Instance?.LogWarn("Card prefab not available: " + text); } } Collider[] components = ((Component)this).GetComponents(); for (int j = 0; j < components.Length; j++) { components[j].enabled = false; } Renderer component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } Object.Destroy((Object)(object)((Component)this).gameObject, 1f); } private bool TrySpawnRandomMonster() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) GameObject[] array = (from g in Resources.FindObjectsOfTypeAll() where ((Object)g).name.ToLower().Contains("enemy") || ((Object)g).name.ToLower().Contains("monster") || ((Object)g).name.ToLower().Contains("spawner") select g).ToArray(); if (array.Length == 0) { return false; } GameObject obj = array[Random.Range(0, array.Length)]; Vector3 val = ((Component)this).transform.position + Vector3.up * 0.5f; Object.Instantiate(obj, val, Quaternion.identity); return true; } }