using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CollectionWeaver.Core; using EnhancedPrefabLoader.API; using EnhancedPrefabLoader.API.Assets; using EnhancedPrefabLoader.API.Behaviors; using EnhancedPrefabLoader.API.Events; using EnhancedPrefabLoader.API.Extensions; using EnhancedPrefabLoader.API.InternalBridges; using EnhancedPrefabLoader.API.Models; using EnhancedPrefabLoader.API.Registry; using EnhancedPrefabLoader.API.Services; using EnhancedPrefabLoader.API.UI; using EnhancedPrefabLoader.Core; using EnhancedPrefabLoader.Core.Assets; using EnhancedPrefabLoader.Core.Cards; using EnhancedPrefabLoader.Core.Cards.ExpGenerators; using EnhancedPrefabLoader.Core.Cards.PriceGenerators; using EnhancedPrefabLoader.Core.Components; using EnhancedPrefabLoader.Core.Events; using EnhancedPrefabLoader.Core.Extensions; using EnhancedPrefabLoader.Core.ExternalBridges; using EnhancedPrefabLoader.Core.LoadingPipeline; using EnhancedPrefabLoader.Core.LoadingPipeline.Processors; using EnhancedPrefabLoader.Core.LoadingPipeline.Validators; using EnhancedPrefabLoader.Core.Models.Runtime; using EnhancedPrefabLoader.Core.Models.SaveData; using EnhancedPrefabLoader.Core.Packs.PackGenerators; using EnhancedPrefabLoader.Core.Patches; using EnhancedPrefabLoader.Core.Properties; using EnhancedPrefabLoader.Core.Registry; using EnhancedPrefabLoader.Core.Saves; using EnhancedPrefabLoader.Core.Services; using EnhancedPrefabLoader.Core.Services.Internal; using EnhancedPrefabLoader.Core.Settings; using EnhancedPrefabLoader.Core.Shops; using EnhancedPrefabLoader.Core.Trading; using EnhancedPrefabLoader.Core.Uninstall; using EnhancedPrefabLoader.Core.Utils; using EnhancedPrefabLoader.Shared.Enums; using EnhancedPrefabLoader.Shared.Extensions; using EnhancedPrefabLoader.Shared.Helpers; using EnhancedPrefabLoader.Shared.Models; using HarmonyLib; using I2.Loc; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Experimental.Rendering; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("EnhancedPrefabLoader")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("6.2.3.0")] [assembly: AssemblyInformationalVersion("6.2.3+35f34656f829a028d941f0dc922be3d2b18bf963")] [assembly: AssemblyProduct("Enhanced Prefab Loader")] [assembly: AssemblyTitle("EnhancedPrefabLoader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("6.2.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { 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.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.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 IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlyList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Count; 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.Count => _items.Count; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Count; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List 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 IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return _items.Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return _items.IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.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.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.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.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.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 IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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; } } } public sealed class ConfigurationManagerAttributes { public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput); public bool? ShowRangeAsPercent; public Action CustomDrawer; public CustomHotkeyDrawerFunc CustomHotkeyDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func ObjToStr; public Func StrToObj; } namespace EnhancedPrefabLoader { [BepInDependency("EnhancedPrefabLoader.API", "6.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("EnhancedPrefabLoader", "Enhanced Prefab Loader", "6.2.3")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("EnhancedPrefabLoader"); private bool legacyPlayTablesChecked; internal static Plugin Instance { get; private set; } public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Instance = this; } private void Awake() { EplRuntimeData.Config.Initialize(((BaseUnityPlugin)this).Config); ModLogger.Initialize(((BaseUnityPlugin)this).Logger); ValidateApiAssembly(); Epl.RegisterApi((IEplApi)(object)new EplApi()); InterceptorRegistry.RegisterFromAssembly(Assembly.GetExecutingAssembly()); StreamingAssetsBridge.AssetLoadBridge = (IAssetLoadBridge)(object)EplRuntimeData.Services.StreamingAssetService; StreamingAssetsBridge.AssetRefTracker = (IAssetRefTracker)(object)EplRuntimeData.Services.StreamingAssetService; EplRuntimeData.Events.OnInventoryBaseAwake += delegate { EplRuntimeData.Services.ShopInventoryManager.PopulateAllShopInventories(); }; SceneManager.sceneLoaded += OnSceneLoad; harmony.PatchAll(); ModLogger.Info("Plugin Enhanced Prefab Loader v:6.2.3 by GhostNarwhal is loaded!", "Awake", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\Plugin.cs"); } private void OnDestroy() { harmony.UnpatchSelf(); ModLogger.Info("Plugin Enhanced Prefab Loader is unloaded!", "OnDestroy", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\Plugin.cs"); } private static void ValidateApiAssembly() { Assembly assembly = typeof(Epl).Assembly; AssemblyName loadedName = assembly.GetName(); AssemblyName assemblyName = typeof(Plugin).Assembly.GetReferencedAssemblies().FirstOrDefault((AssemblyName a) => a.Name == loadedName.Name); if (assemblyName != null && loadedName.Version < assemblyName.Version) { ModLogger.Error($"Loaded {loadedName.Name} {loadedName.Version} is older than the {assemblyName.Version} this EnhancedPrefabLoader build was compiled against — another mod is likely shipping an outdated copy at '{assembly.Location}'. Remove duplicate EnhancedPrefabLoader.API.dll files; only the standalone API mod should provide it.", "ValidateApiAssembly", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\Plugin.cs"); } } private void NeutralizeLegacyEnhancedPlayTables() { if (!Chainloader.PluginInfos.ContainsKey("EnhancedPlayTables")) { return; } ModLogger.Error("EnhancedPlayTables is installed alongside EnhancedPrefabLoader, which now includes its play-table card features — uninstall EnhancedPlayTables. Its patches have been disabled for this session.", "NeutralizeLegacyEnhancedPlayTables", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\Plugin.cs"); foreach (MethodBase item in Harmony.GetAllPatchedMethods().ToList()) { harmony.Unpatch(item, (HarmonyPatchType)0, "EnhancedPlayTables"); } } private void OnSceneLoad(Scene scene, LoadSceneMode _) { if (!legacyPlayTablesChecked) { legacyPlayTablesChecked = true; NeutralizeLegacyEnhancedPlayTables(); } if (((Scene)(ref scene)).name == "Title") { EplRuntimeData.Services.SaveDataManager.ResetAllSaveData(); EplRuntimeData.Services.ShopService.ResetUIState(); EplRuntimeData.Services.PlayTableService.Reset(); EplRuntimeData.Services.CardExpansionSelectService.IsLoaded = false; EplRuntimeData.Services.CardRaritySelectService.IsLoaded = false; EplRuntimeData.Services.CollectionBinderService.IsLoaded = false; EplRuntimeData.Services.SettingsScreenService.IsLoaded = false; EplRuntimeData.Services.ScriptHookService.Reset(); } else { EplRuntimeData.Services.ShopService.CreateAndRegisterCustomShops(); EplRuntimeData.Services.StreamingAssetService.StartCleanupCoroutine(); EplRuntimeData.Services.ScriptHookService.SubscribeGameEvents(); } } } } namespace EnhancedPrefabLoader.Shared.Models { public class BundleDescriptor { private List assemblies = new List(); private List customShops = new List(); private List items = new List(); private List prefabs = new List(); private List cardExpansions = new List(); public string BundleId { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public bool ItemPricesSuppliedByApi { get; set; } public List Assemblies { get { return assemblies; } set { assemblies = value ?? new List(); } } public List CustomShops { get { return customShops; } set { customShops = value ?? new List(); } } public List Items { get { return items; } set { items = value ?? new List(); } } public List Prefabs { get { return prefabs; } set { prefabs = value ?? new List(); } } public List CardExpansions { get { return cardExpansions; } set { cardExpansions = value ?? new List(); } } public List Furniture => Prefabs.Where((PrefabInfo p) => p.AddItemToFurnitureShop).ToList(); public List Deco => Prefabs.Where((PrefabInfo p) => p.IsDecoObject || p.IsDecoFloorTexture || p.IsDecoCeilingTexture || p.IsDecoWallTexture).ToList(); public HashSet MeshNames { get { HashSet hashSet = new HashSet(); foreach (string item in from i in Items where !string.IsNullOrWhiteSpace(i.Mesh) select i.Mesh) { hashSet.Add(item); } return hashSet; } } } public class CardExpansionInfo { public string Name { get; set; } = string.Empty; public string MenuCategory { get; set; } = string.Empty; public string CardExpansion { get; set; } = string.Empty; [JsonProperty("CardbackSprite")] public string Cardback { get; set; } = string.Empty; public string FoilMask { get; set; } = string.Empty; public bool HasRandomFoils { get; set; } public float FoilChance { get; set; } public List Rarities { get; set; } = new List(); public List Cards { get; set; } = new List(); public string CardPriceStrategy { get; set; } = string.Empty; public bool CardPriceStrategySuppliedByApi { get; set; } public float DefaultBorderMultiplierBase { get; set; } = 3.15f; public float DefaultFoilMultiplier { get; set; } = 2.9f; public float RarityDrivenFloor { get; set; } = 4f; public float RarityDrivenStepSize { get; set; } = 1026f; public float RarityDrivenBorderMultiplierBase { get; set; } = 1.15f; public float RarityDrivenFoilMultiplier { get; set; } = 1.4f; public int TradeUnlockLevel { get; set; } public List PlayCardMaterials { get; set; } = new List(); public bool IsValid { get; set; } = true; } public class CardExpansionMetadata { public string ExpansionName { get; set; } = string.Empty; public int CardCount { get; set; } } public class CardInfo { public string Name { get; set; } = string.Empty; public string ElementType { get; set; } = string.Empty; public string Rarity { get; set; } = string.Empty; public int CardNumber { get; set; } public string Sprite { get; set; } = string.Empty; public string BorderType { get; set; } = string.Empty; public bool IsFoil { get; set; } public string FoilMask { get; set; } = string.Empty; public string Cardback { get; set; } = string.Empty; } public struct ColorData { public float R { get; set; } public float G { get; set; } public float B { get; set; } public float A { get; set; } } public class CustomShopInfo { public string PhoneAppId { get; set; } = string.Empty; public string AppDisplayName { get; set; } = string.Empty; public string AppIcon { get; set; } = string.Empty; public string AppInnerBGImage { get; set; } = string.Empty; public string AppOuterBGImage { get; set; } = string.Empty; public string SiteLogo { get; set; } = string.Empty; public string SiteHeader { get; set; } = string.Empty; public string SiteBackground { get; set; } = string.Empty; public bool IsValid { get; internal set; } = true; } public class ItemInfo { public string Name { get; set; } = string.Empty; public string ItemCategory { get; set; } = string.Empty; public string SpriteName { get; set; } = string.Empty; public float BaseCost { get; set; } public bool AddItemAsAccessory { get; set; } public bool AddItemAsFigurine { get; set; } public bool AddItemAsBoardGame { get; set; } public string PhoneAppId { get; set; } = string.Empty; public string ItemType { get; set; } = string.Empty; public bool UsesBaseGameMesh { get; set; } public string MeshToUse { get; set; } = string.Empty; public string Mesh { get; set; } = string.Empty; public string MeshSecondary { get; set; } = string.Empty; public string Material { get; set; } = string.Empty; public string MaterialSecondary { get; set; } = string.Empty; public List MaterialList { get; set; } = new List(); [JsonProperty("IsBigBox")] public bool HasBigBox { get; set; } public bool HasSmallBox { get; set; } [JsonProperty("HideTillUnlocked")] public bool BigBoxHideTillUnlocked { get; set; } public bool SmallBoxHideTillUnlocked { get; set; } [JsonProperty("LicensePrice")] public float BigBoxLicensePrice { get; set; } public float SmallBoxLicensePrice { get; set; } [JsonProperty("LicenseLevelRequirement")] public int BigBoxLicenseLevelRequirement { get; set; } public int SmallBoxLicenseLevelRequirement { get; set; } [JsonProperty("IgnoreDoubleImage")] public bool BigBoxIgnoreDoubleImage { get; set; } public bool SmallBoxIgnoreDoubleImage { get; set; } [JsonProperty("HasBigBox")] private bool HasBigBoxAlias { set { HasBigBox = value; } } [JsonProperty("BigBoxHideTillUnlocked")] private bool BigBoxHideTillUnlockedAlias { set { BigBoxHideTillUnlocked = value; } } [JsonProperty("BigBoxLicensePrice")] private float BigBoxLicensePriceAlias { set { BigBoxLicensePrice = value; } } [JsonProperty("BigBoxLicenseLevelRequirement")] private int BigBoxLicenseLevelRequirementAlias { set { BigBoxLicenseLevelRequirement = value; } } [JsonProperty("BigBoxIgnoreDoubleImage")] private bool BigBoxIgnoreDoubleImageAlias { set { BigBoxIgnoreDoubleImage = value; } } public float MinMarketPricePercent { get; set; } public float MaxMarketPricePercent { get; set; } public string FollowItemPrice { get; set; } = string.Empty; public bool AutoSetBoxPrice { get; set; } public bool MarketPricePercentSuppliedByApi { get; set; } public bool FollowItemPriceSuppliedByApi { get; set; } public bool AutoBoxPriceSuppliedByApi { get; set; } public bool LicensePriceSuppliedByApi { get; set; } public bool LicenseLevelSuppliedByApi { get; set; } public bool IsTallItem { get; set; } public float InBoxOffsetY { get; set; } public float InBoxOffsetScale { get; set; } public Vector3Data ItemDeminsion { get; set; } public Vector3Data CollidorPosOffset { get; set; } public Vector3Data ColliderScale { get; set; } public List PriceAffectedBy { get; set; } = new List(); public bool IsSprayCan { get; set; } public bool IsCardPack { get; set; } public bool ApiManaged { get; set; } public bool IsCardBox { get; set; } public bool IsBulkBox { get; set; } public int MinValue { get; set; } public string CardExpansion { get; set; } = string.Empty; public bool CanHaveDuplicates { get; set; } public bool CanHaveGodPacks { get; set; } public string PackGenerationStrategy { get; set; } = string.Empty; public Dictionary NormalWeights { get; set; } = new Dictionary(); public Dictionary GodWeights { get; set; } = new Dictionary(); public Dictionary> SlotWeights { get; set; } = new Dictionary>(); public bool NormalWeightsSuppliedByApi { get; set; } public bool GodWeightsSuppliedByApi { get; set; } public bool SlotWeightsSuppliedByApi { get; set; } public bool CanHaveGodPacksSuppliedByApi { get; set; } public bool GodPackPercentageSuppliedByApi { get; set; } [Obsolete("Use NormalWeights, GodWeights, and SlotWeights instead. This field exists for backwards compatibility with older descriptors.")] public List GenerationWeights { get; set; } = new List(); public string SpawnsPackType { get; set; } = string.Empty; public string PackType { get; set; } = string.Empty; public float GodPackPercentage { get; set; } public bool IsValid { get; set; } = true; } public class ModManifest { public string ModId { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public string Directory { get; set; } = string.Empty; public string BundlePath { get; set; } = string.Empty; public string JsonPath { get; set; } = string.Empty; public bool IsValid { get; set; } = true; public bool IsLoaded { get; set; } = true; public List Errors { get; set; } = new List(); public int ItemCount { get; set; } public int FurnitureCount { get; set; } public int CustomShopCount { get; set; } public int DecoCount { get; set; } public List CardExpansions { get; set; } = new List(); } public class PrefabInfo { public string Name { get; set; } = string.Empty; public string PrefabName { get; set; } = string.Empty; public string SpriteName { get; set; } = string.Empty; public float Price { get; set; } public int LevelRequirement { get; set; } public bool LevelRequirementSuppliedByApi { get; set; } public bool AddItemToFurnitureShop { get; set; } public string Description { get; set; } = string.Empty; public string ObjectType { get; set; } public List VideoClips { get; set; } = new List(); public float DecoBonus { get; set; } public bool IsDecoWallTexture { get; set; } public bool IsDecoFloorTexture { get; set; } public bool IsDecoCeilingTexture { get; set; } public bool IsDecoObject { get; set; } public string DecoObject { get; set; } = string.Empty; public string DecoType { get; set; } = string.Empty; public string Texture { get; set; } = string.Empty; public string RoughnessMap { get; set; } = string.Empty; public string NormalMap { get; set; } = string.Empty; public float Smoothness { get; set; } public ColorData Color { get; set; } public bool IsValid { get; set; } = true; } public class RarityWeightInfo { public string Rarity { get; set; } = string.Empty; [Obsolete("Use SlotWeights instead. This field exists for backwards compatibility with older descriptors.")] public string GuaranteedSlots { get; set; } = string.Empty; public float NormalWeight { get; set; } public float GodPackWeight { get; set; } } public struct Vector3Data { public float X { get; set; } public float Y { get; set; } public float Z { get; set; } } public class VideoClipInfo { public string Name { get; set; } = string.Empty; public string VideoPlayerName { get; set; } = string.Empty; } } namespace EnhancedPrefabLoader.Shared.Helpers { public static class FileHelper { public const string BundleDirectoryPattern = "*_prefabloader"; public static List GetAllBundleDescriptorsIn(string basePath) { return Directory.EnumerateDirectories(basePath, "*_prefabloader", new EnumerationOptions { RecurseSubdirectories = true, MatchCasing = MatchCasing.CaseInsensitive }).SelectMany((string d) => Directory.GetFiles(d, "*.json", SearchOption.AllDirectories)).ToList(); } } public static class ModIdGenerator { public static string GenerateFromDirectory(string directory) { string directoryName = Path.GetDirectoryName(directory); DirectoryInfo directoryInfo = new DirectoryInfo(string.IsNullOrEmpty(directoryName) ? directory : directoryName); string fullName = directoryInfo.FullName; string name = directoryInfo.Name; using SHA1 sHA = SHA1.Create(); string text = BitConverter.ToString(sHA.ComputeHash(Encoding.UTF8.GetBytes(fullName.ToLowerInvariant()))).Replace("-", "").Substring(0, 8); return name + "_" + text; } } } namespace EnhancedPrefabLoader.Shared.Extensions { public static class DictionaryExtensions { public static TValue GetOrDefault(this Dictionary dict, TKey key) { if (!dict.TryGetValue(key, out TValue value)) { return default(TValue); } return value; } public static TValue GetOrAdd(this Dictionary dict, TKey key, Func factory) { if (!dict.TryGetValue(key, out TValue value)) { value = (dict[key] = factory(key)); } return value; } public static void MergeAdd(this Dictionary dict, IEnumerable<(TKey key, int amount)> items) { foreach (var item3 in items) { TKey item = item3.key; int item2 = item3.amount; dict[item] = dict.GetOrAdd(item, (TKey _) => 0) + item2; } } public static void AddRange(this Dictionary dict, IEnumerable> items) { foreach (KeyValuePair item in items) { dict[item.Key] = item.Value; } } } public static class ListExtensions { public static List Shuffle(this List list) where T : class { for (int num = list.Count - 1; num > 0; num--) { int num2 = Random.Range(0, num + 1); int index = num; int index2 = num2; T value = list[num2]; T value2 = list[num]; list[index] = value; list[index2] = value2; } return list; } public static List SwapAndRemove(this List list, int index) { int num = list.Count - 1; if (index != num) { int index2 = num; T value = list[num]; T value2 = list[index]; list[index] = value; list[index2] = value2; } list.RemoveAt(num); return list; } } } namespace EnhancedPrefabLoader.Shared.Enums { [Flags] public enum ItemFlags : byte { None = 0, BoardGame = 1, Accessory = 2, Figurine = 4, TCG = 8 } } namespace EnhancedPrefabLoader.Core { internal class BundleManager { internal class BundleHandle { private AssetBundle? assetBundle; private AssetBundleCreateRequest? loadRequest; private bool isLoading; public bool HasError { get; private set; } public bool IsLoaded { get; private set; } public static BundleHandle Create(string bundlePath) { string bundleName = Path.GetFileNameWithoutExtension(bundlePath); AssetBundle val = AssetBundle.GetAllLoadedAssetBundles().FirstOrDefault((Func)((AssetBundle b) => ((Object)b).name == bundleName)); if (val != null) { ModLogger.Debug("Bundle '" + bundleName + "' already loaded externally, reusing.", "Create", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\BundleManager.cs"); return new BundleHandle { assetBundle = val, IsLoaded = true }; } return new BundleHandle { loadRequest = AssetBundle.LoadFromFileAsync(bundlePath) }; } internal IEnumerator WaitForLoadAsync() { if (IsLoaded) { yield break; } if (!isLoading) { isLoading = true; if (loadRequest != null) { yield return loadRequest; assetBundle = loadRequest.assetBundle; loadRequest = null; IsLoaded = assetBundle != null; HasError = assetBundle == null; } isLoading = false; } while (isLoading) { ModLogger.Debug("Waiting for another coroutine to finish loading bundle.", "WaitForLoadAsync", "C:\\GitLab-Runner\\builds\\-F4_x1RGt\\0\\tcg-mods\\prefabloader\\EnhancedPrefabLoader.Core\\BundleManager.cs"); yield return null; } } internal AssetBundleRequest? LoadAssetAsync(string assetName) where T : Object { if (!string.IsNullOrEmpty(assetName)) { AssetBundle? obj = assetBundle; if (obj == null) { return null; } return obj.LoadAssetAsync(assetName); } return null; } internal AssetBundleRequest? LoadAssetAsync(string assetName, Type type) { if (!string.IsNullOrEmpty(assetName)) { AssetBundle? obj = assetBundle; if (obj == null) { return null; } return obj.LoadAssetAsync(assetName, type); } return null; } internal AssetBundleRequest? LoadAllAsync() where T : Object { AssetBundle? obj = assetBundle; if (obj == null) { return null; } return obj.LoadAllAssetsAsync(); } } private readonly Dictionary bundleHandles = new Dictionary(); internal BundleHandle GetOrOpen(string bundlePath) { if (bundleHandles.TryGetValue(bundlePath, out BundleHandle value)) { if (!value.HasError) { return value; } bundleHandles.Remove(bundlePath); } value = BundleHandle.Create(bundlePath); bundleHandles[bundlePath] = value; return value; } } internal class EplApi : IEplApi { public bool IsBundleLoadingComplete => EplRuntimeData.IsBundleLoadingComplete; public IBundleRegistry BundleRegistry => (IBundleRegistry)(object)EplRuntimeData.Assets.BundleRegistry; public IEplAssets Assets => (IEplAssets)(object)EplRuntimeData.Assets; public IEplServices Services => (IEplServices)(object)EplRuntimeData.Services; public IEplEvents Events => (IEplEvents)(object)EplRuntimeData.Events; } internal class EplCaches { internal Dictionary CardBackMaterials { get; } = new Dictionary(); internal Material? OriginalCardBackMaterial { get; set; } internal List<(Material Material, Color OriginalColor)> LightingAwareMaterials { get; } = new List<(Material, Color)>(); } internal class EplConfig { internal bool ExcludeBaseGameCardsFromTrade { get; private set; } internal bool SparkleFoilEnabled { get; private set; } internal bool UseCustomExpForBase { get; private set; } internal bool DisableBaseGamePlayCards { get; private set; } internal int PreferEplTableItemsChance { get; private set; } internal bool FlipTableCards { get; private set; } internal int FacedownCardChance { get; private set; } internal int TappedCardChance { get; private set; } internal float TappedCardAngle { get; private set; } internal bool OptimizeShelfVisibilityUpdates { get; private set; } internal bool OptimizeMonsterDataLookups { get; private set; } internal bool OptimizeCardSaveIndexLookups { get; private set; } internal bool ReduceStreamedTextureMemory { get; private set; } internal bool OptimizeRestockDataLookups { get; private set; } internal bool OptimizeClockUpdates { get; private set; } internal bool OptimizeCardBorderTypeLookups { get; private set; } internal ConfigEntry MinimumLogLevelEntry { get; private set; } internal ConfigEntry CollectionBinderSpacingXEntry { get; private set; } internal ConfigEntry CollectionBinderSpacingYEntry { get; private set; } internal ConfigEntry CollectionBinderButtonSizeEntry { get; private set; } internal ConfigEntry CardExpansionSelectSpacingXEntry { get; private set; } internal ConfigEntry CardExpansionSelectSpacingYEntry { get; private set; } internal ConfigEntry CardExpansionSelectButtonSizeEntry { get; private set; } internal ConfigEntry RaritySelectSpacingXEntry { get; private set; } internal ConfigEntry RaritySelectSpacingYEntry { get; private set; } internal ConfigEntry RaritySelectButtonSizeEntry { get; private set; } internal void Initialize(ConfigFile config) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Expected O, but got Unknown //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Expected O, but got Unknown //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Expected O, but got Unknown //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Expected O, but got Unknown ConfigEntry excludeBaseGame = config.Bind("Trading", "ExcludeBaseGameCardsFromTrade", false, "When enabled, base-game expansions (Tetramon, Destiny, Ghost) will not appear in customer card trade/sell selection."); ExcludeBaseGameCardsFromTrade = excludeBaseGame.Value; excludeBaseGame.SettingChanged += delegate { ExcludeBaseGameCardsFromTrade = excludeBaseGame.Value; }; ConfigEntry sparkleFoil = config.Bind("CardUI", "Sparkle Foil Enabled", true, "When enabled, foil cards display the sparkle glitter effect."); SparkleFoilEnabled = sparkleFoil.Value; sparkleFoil.SettingChanged += delegate { SparkleFoilEnabled = sparkleFoil.Value; }; CollectionBinderSpacingXEntry = config.Bind("CollectionBinderUI", "ExpansionSpacingX", 30f, (ConfigDescription)null); CollectionBinderSpacingYEntry = config.Bind("CollectionBinderUI", "ExpansionSpacingY", -45f, (ConfigDescription)null); CollectionBinderButtonSizeEntry = config.Bind("CollectionBinderUI", "ExpansionButtonSize", new Vector2(325f, 184.5f), (ConfigDescription)null); CardExpansionSelectSpacingXEntry = config.Bind("UI", "ExpansionSpacingX", 30f, (ConfigDescription)null); CardExpansionSelectSpacingYEntry = config.Bind("UI", "ExpansionSpacingY", -45f, (ConfigDescription)null); CardExpansionSelectButtonSizeEntry = config.Bind("UI", "ExpansionButtonSize", new Vector2(325f, 184.5f), (ConfigDescription)null); RaritySelectSpacingXEntry = config.Bind("UI", "RaritySpacingX", 30f, (ConfigDescription)null); RaritySelectSpacingYEntry = config.Bind("UI", "RaritySpacingY", -45f, (ConfigDescription)null); RaritySelectButtonSizeEntry = config.Bind("UI", "RarityButtonSize", new Vector2(325f, 184.5f), (ConfigDescription)null); ConfigEntry useCustomExp = config.Bind("GamePlay", "UseCustomExpForBase", false, "When enabled, base-game card expansions will use the EPL experience formula instead of the vanilla formula."); UseCustomExpForBase = useCustomExp.Value; useCustomExp.SettingChanged += delegate { UseCustomExpForBase = useCustomExp.Value; }; MinimumLogLevelEntry = config.Bind("Logging", "Minimum log level to log", LogLevel.Warning, (ConfigDescription)null); ConfigEntry optimizeShelfVisibility = config.Bind("Performance", "OptimizeShelfVisibilityUpdates", false, "When enabled, replaces the base game's per-frame shelf item visibility pass with change detection — item meshes are only toggled when a shelf crosses the distance/angle threshold, plus a periodic 0.5s refresh. Greatly reduces per-frame overhead in large stocked shops. Disable if another mod patches ShelfManager.Update."); OptimizeShelfVisibilityUpdates = optimizeShelfVisibility.Value; optimizeShelfVisibility.SettingChanged += delegate { OptimizeShelfVisibilityUpdates = optimizeShelfVisibility.Value; }; ConfigEntry optimizeMonsterData = config.Bind("Performance", "OptimizeMonsterDataLookups", false, "When enabled, base-game monster data lookups use a cached dictionary instead of scanning the data lists on every call (card prices, pack opening, card rendering). Lookups that miss the cache fall back to the vanilla scan. Disable if another mod patches InventoryBase.GetMonsterData."); OptimizeMonsterDataLookups = optimizeMonsterData.Value; optimizeMonsterData.SettingChanged += delegate { OptimizeMonsterDataLookups = optimizeMonsterData.Value; }; ConfigEntry optimizeCardSaveIndex = config.Bind("Performance", "OptimizeCardSaveIndexLookups", false, "When enabled, base-game card save index lookups use a cached index dictionary instead of rescanning the shown monster list on every call (the hottest card path: add/remove card, prices, binder, bulk donation). EPL expansions are unaffected — they already use their own cached path. Disable if another mod patches CPlayerData.GetCardSaveIndex."); OptimizeCardSaveIndexLookups = optimizeCardSaveIndex.Value; optimizeCardSaveIndex.SettingChanged += delegate { OptimizeCardSaveIndexLookups = optimizeCardSaveIndex.Value; }; ConfigEntry reduceStreamedTextures = config.Bind("Performance", "ReduceStreamedTextureMemory", false, "When enabled, the base game's web-streamed textures (downloaded card art) release their CPU-side pixel copies after loading, halving their memory for the session. Disable if another mod reads pixels from these cached textures."); ReduceStreamedTextureMemory = reduceStreamedTextures.Value; reduceStreamedTextures.SettingChanged += delegate { ReduceStreamedTextureMemory = reduceStreamedTextures.Value; }; ConfigEntry optimizeRestockData = config.Bind("Performance", "OptimizeRestockDataLookups", false, "When enabled, restock data lookups (check price screens, barcode scanner, customer purchasing, trades) use a cached index dictionary over the combined base+EPL entry list instead of rescanning it per call. Disable if another mod patches InventoryBase.GetRestockData* methods."); OptimizeRestockDataLookups = optimizeRestockData.Value; optimizeRestockData.SettingChanged += delegate { OptimizeRestockDataLookups = optimizeRestockData.Value; }; ConfigEntry optimizeClock = config.Bind("Performance", "OptimizeClockUpdates", false, "When enabled, the in-game clock string is only rebuilt when the displayed time actually changes instead of every frame, removing constant string allocation garbage. Disable if another mod patches LightManager.EvaluateTimeClock."); OptimizeClockUpdates = optimizeClock.Value; optimizeClock.SettingChanged += delegate { OptimizeClockUpdates = optimizeClock.Value; }; ConfigEntry optimizeCardBorders = config.Bind("Performance", "OptimizeCardBorderTypeLookups", false, "When enabled, base-game card border type lookups use fixed tables instead of building a new list on every call (several call sites run per card in loops). EPL expansions are unaffected. Disable if another mod patches CPlayerData.GetCardBorderType."); OptimizeCardBorderTypeLookups = optimizeCardBorders.Value; optimizeCardBorders.SettingChanged += delegate { OptimizeCardBorderTypeLookups = optimizeCardBorders.Value; }; ConfigEntry disableBaseCards = config.Bind("PlayTable", "DisableBaseGamePlayCards", false, "When enabled, base game card textures will not appear on play tables. If no mod expansion textures are available, this setting is ignored."); DisableBaseGamePlayCards = disableBaseCards.Value; disableBaseCards.SettingChanged += delegate { DisableBaseGamePlayCards = disableBaseCards.Value; }; ConfigEntry preferEplTableItems = config.Bind("PlayTable", "PreferEplTableItemsChance", 50, new ConfigDescription("Chance (%) that a play table's decorations (playmat, deck box, comic book) are picked from EPL-added items when any are unlocked. At 0 every unlocked item has equal odds, so large base-game pools drown out EPL items; at 100 EPL items are always picked when available.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); PreferEplTableItemsChance = preferEplTableItems.Value; preferEplTableItems.SettingChanged += delegate { PreferEplTableItemsChance = preferEplTableItems.Value; }; ConfigEntry flipTableCards = config.Bind("PlayTable", "FlipTableCards", true, "When enabled, the cards laid out on play tables become individual face-up cards instead of the vanilla facedown rows, with configurable facedown/tapped rolls per card. Card faces always come from the expansion the table picked."); FlipTableCards = flipTableCards.Value; flipTableCards.SettingChanged += delegate { FlipTableCards = flipTableCards.Value; }; ConfigEntry facedownChance = config.Bind("PlayTable", "FacedownCardChance", 10, new ConfigDescription("Chance (%) for each flipped table card to be placed facedown. Only used when FlipTableCards is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); FacedownCardChance = facedownChance.Value; facedownChance.SettingChanged += delegate { FacedownCardChance = facedownChance.Value; }; ConfigEntry tappedChance = config.Bind("PlayTable", "TappedCardChance", 10, new ConfigDescription("Chance (%) for each flipped table card to be \"tapped\" (rotated sideways). Only used when FlipTableCards is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); TappedCardChance = tappedChance.Value; tappedChance.SettingChanged += delegate { TappedCardChance = tappedChance.Value; }; ConfigEntry tappedAngle = config.Bind("PlayTable", "TappedCardAngle", 75f, new ConfigDescription("Angle in degrees a \"tapped\" table card is rotated. Only used when FlipTableCards is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 90f), Array.Empty())); TappedCardAngle = tappedAngle.Value; tappedAngle.SettingChanged += delegate { TappedCardAngle = tappedAngle.Value; }; } } internal static class EplRuntimeData { internal static bool IsBundleLoadingComplete { get; set; } internal static BundleAssetTracker BundleAssetTracker { get; set; } = new BundleAssetTracker(); internal static List Assemblies { get; private set; } = new List(); internal static EplCaches Caches { get; private set; } = new EplCaches(); internal static EplConfig Config { get; private set; } = new EplConfig(); internal static EplEvents Events { get; private set; } = new EplEvents(); internal static EplAssets Assets { get; private set; } = new EplAssets(new BundleRegistry(BundleAssetTracker)); internal static EplServices Services { get; private set; } = new EplServices(new SaveDataService(BundleAssetTracker)); } public enum LogLevel { Debug, Info, Warning, Error, None } public static class ModLogger { private static ManualLogSource logger; private static LogLevel logLevel; public static void Initialize(ManualLogSource logger) { ModLogger.logger = logger; logLevel = EplRuntimeData.Config.MinimumLogLevelEntry.Value; EplRuntimeData.Config.MinimumLogLevelEntry.SettingChanged += delegate { logLevel = EplRuntimeData.Config.MinimumLogLevelEntry.Value; }; } public static void Debug(string message, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "") { if (logLevel <= LogLevel.Debug) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); logger.LogDebug((object)("[" + fileNameWithoutExtension + "." + memberName + "]: " + message)); } } public static void Info(string message, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "") { if (logLevel <= LogLevel.Info) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); logger.LogInfo((object)("[" + fileNameWithoutExtension + "." + memberName + "]: " + message)); } } public static void Warning(string message, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "") { if (logLevel <= LogLevel.Warning) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); logger.LogWarning((object)("[" + fileNameWithoutExtension + "." + memberName + "]: " + message)); } } public static void Error(string message, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "") { if (logLevel <= LogLevel.Error) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); logger.LogError((object)("[" + fileNameWithoutExtension + "." + memberName + "]: " + message)); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "EnhancedPrefabLoader"; public const string PLUGIN_NAME = "Enhanced Prefab Loader"; public const string PLUGIN_VERSION = "6.2.3"; } } namespace EnhancedPrefabLoader.Core.Utils { internal static class CardExpansionTypeResolver { private static ECardExpansionType[]? sortedModKeys; internal static ECardExpansionType Resolve(int index) { if (index >= 8 && index < 200000) { ECardExpansionType[] array = GetSortedModKeys(); int num = index - 8; if (num < array.Length) { return array[num]; } return (ECardExpansionType)0; } return (ECardExpansionType)index; } internal static void InvalidateCache() { sortedModKeys = null; } private static ECardExpansionType[] GetSortedModKeys() { return sortedModKeys ?? (sortedModKeys = EplRuntimeData.Assets.CardExpansionLibrary.CardExpansionData.Keys.OrderBy((ECardExpansionType k) => (int)k).ToArray()); } } internal static class DecoObjectResolver { private static EDecoObject[]? sortedModKeys; internal static EDecoObject Resolve(int index) { if (index >= 184 && index < 200000) { EDecoObject[] array = GetSortedModKeys(); int num = index - 184; if (num < array.Length) { return array[num]; } return (EDecoObject)0; } return (EDecoObject)index; } internal static void InvalidateCache() { sortedModKeys = null; } private static EDecoObject[] GetSortedModKeys() { return sortedModKeys ?? (sortedModKeys = EplRuntimeData.Assets.DecoLibrary.DecoObjectData.Keys.OrderBy((EDecoObject k) => (int)k).ToArray()); } } internal static class GameBuild { internal static Type? PriceTagAtlasMapType { get; } = AccessTools.TypeByName("PriceTagAtlasMap"); internal static Type? StoredBoxRecordType { get; } = AccessTools.TypeByName("StoredBoxRecord"); internal static bool HasPriceTagAtlas { get; } = (object)PriceTagAtlasMapType != null && (object)AccessTools.Field(typeof(UI_PriceTag), "m_AtlasMap") != null && (object)AccessTools.Field(typeof(UI_PriceTag), "m_InstancedRenderer") != null; internal static bool HasLegacyPriceTagIcon { get; } = (object)AccessTools.Field(typeof(UI_PriceTag), "m_Icon") != null; internal static bool HasItemMaterialPropertyBlocks { get; } = (object)AccessTools.Property(typeof(Item), "m_MaterialPropertyBlock") != null; internal static bool HasItemSharedMaterialSlots { get; } = (object)AccessTools.Method(typeof(Item), "SetSharedMaterialForFirstSlot", (Type[])null, (Type[])null) != null; internal static bool HasStoredBoxRecords { get; } = (object)StoredBoxRecordType != null && (object)AccessTools.Method(typeof(RestockManager), "GetWarehouseCompartmentList", (Type[])null, (Type[])null) != null && (object)AccessTools.Method(typeof(ShelfCompartment), "TryPopLastStoredBoxRecord", (Type[])null, (Type[])null) != null; } internal static class ItemTypeResolver { private static EItemType[]? sortedModKeys; internal static EItemType Resolve(int index) { if (index >= 130 && index < 200000) { EItemType[] array = GetSortedModKeys(); int num = index - 130; if (num < array.Length) { return array[num]; } return (EItemType)0; } return (EItemType)index; } internal static void InvalidateCache() { sortedModKeys = null; } private static EItemType[] GetSortedModKeys() { return sortedModKeys ?? (sortedModKeys = EplRuntimeData.Assets.ItemLibrary.ItemData.Keys.OrderBy((EItemType k) => (int)k).ToArray()); } } } namespace EnhancedPrefabLoader.Core.Uninstall { internal class CardRemovalStrategy(HashSet cardExpansions) : IAssetRemovalStrategy { private Dictionary removedCards = new Dictionary(); public RemovalResult RemoveAssets() { removedCards = new Dictionary(); RemoveFromCardShelves(); RemoveFromBinder(); RemoveFromBulkDonationBoxes(); RemoveFromCardStorageShelves(); RemoveFromCardPackageBoxes(); RemoveFromCardGrading(); RemoveFromDecks(); RemoveFromAutoPackOpeners(); RemoveFromHeldCards(); return RemovalResult.Success(removedCards.Values.Sum(), removedCards.Sum>((KeyValuePair kvp) => CPlayerData.GetCardMarketPrice(kvp.Key) * (float)kvp.Value)); } private void RemoveFromCardShelves() { RemoveFromShelfCardCompartments(CSingleton.Instance.m_CardShelfList); RemoveFromShelfCardCompartments((IEnumerable)CSingleton.Instance.m_CardItemCombiShelfList); } private void RemoveFromShelfCardCompartments(IEnumerable cardShelves) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) foreach (InteractableCardCompartment item in cardShelves.SelectMany((CardShelf cs) => cs.m_CardCompartmentList)) { if (item.m_StoredCardList.Count == 0) { continue; } CardData cardData = item.m_StoredCardList[0].m_Card3dUI.m_CardUI.m_CardData; if (!cardExpansions.Contains(cardData.expansionType)) { continue; } foreach (InteractableCardPriceTag interactablePriceTag in item.m_InteractablePriceTagList) { interactablePriceTag.SetPriceChecked(false); } item.m_StoredCardList[0].SetIsDisplayedOnShelf(false); item.m_StoredCardList[0].SetTargetRotation(Quaternion.identity); item.m_StoredCardList.RemoveAt(0); item.SetPriceTagCardData((CardData)null); item.SetPriceTagVisibility(false); if (item.m_CardShelf?.m_ElectronicCardListener != null) { item.m_CardShelf.m_ElectronicCardListener.UpdateCardUI((CardData)null); } removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + 1; } } private void RemoveFromBinder() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) foreach (CardData item in CPlayerData.m_GradedCardInventoryList.Where((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType)).Select((Func)CPlayerData.GetGradedCardData).ToList()) { CPlayerData.RemoveGradedCard(item, false); removedCards[item] = removedCards.GetValueOrDefault(item) + 1; } CardExpansionLibrary cardExpansionLibrary = EplRuntimeData.Assets.CardExpansionLibrary; foreach (ECardExpansionType item2 in cardExpansions) { if (!cardExpansionLibrary.CardExpansionData.TryGetValue(item2, out ModCardExpansionData value)) { continue; } foreach (KeyValuePair card in value.Cards) { card.Deconstruct(out var _, out var value2); CardData val = value2.ToCardData(); int cardAmount = CPlayerData.GetCardAmount(val); if (cardAmount > 0) { CPlayerData.ReduceCard(val, cardAmount); removedCards[val] = removedCards.GetValueOrDefault(val) + cardAmount; } } } } private void RemoveFromBulkDonationBoxes() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) foreach (List item in CSingleton.Instance.m_BulkDonationBoxList.Select((InteractableBulkDonationBox b) => b.m_CompactCardDataAmountList)) { foreach (CompactCardDataAmount item2 in item.Where((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType))) { CardData cardData = CPlayerData.GetCardData(item2.cardSaveIndex, item2.expansionType, item2.isDestiny); removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + item2.amount; } item.RemoveAll((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType)); } } private void RemoveFromCardStorageShelves() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) foreach (List item in CSingleton.Instance.m_CardStorageShelfList.Select((InteractableCardStorageShelf b) => b.m_CompactCardDataAmountList)) { foreach (CompactCardDataAmount item2 in item.Where((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType))) { CardData cardData = CPlayerData.GetCardData(item2.cardSaveIndex, item2.expansionType, item2.isDestiny); removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + item2.amount; } item.RemoveAll((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType)); } } private void RemoveFromCardPackageBoxes() { foreach (InteractablePackagingBox_Card packageBox in RestockManager.GetCardPackagingBoxList().ToList()) { packageBox.m_StoredCardList.RemoveAll(delegate(InteractableCard3d i) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) CardData cardData = i.m_Card3dUI.m_CardUI.m_CardData; if (cardExpansions.Contains(cardData.expansionType)) { removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + 1; packageBox.m_StoredCardDataList.Remove(cardData); ((InteractableObject)i).OnDestroyed(); return true; } return false; }); if (packageBox.m_StoredCardList.Count == 0) { CSingleton.Instance.m_SpawnedPackageBoxCardList.Remove(packageBox); ((InteractableObject)packageBox).OnDestroyed(); } } } private void RemoveFromCardGrading() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown foreach (GradeCardSubmitSet item in CPlayerData.m_GradeCardInProgressList.ToList()) { item.m_CardDataList.RemoveAll(delegate(CardData cardData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!cardExpansions.Contains(cardData.expansionType)) { return false; } removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + 1; return true; }); if (item.m_CardDataList.Count == 0) { CPlayerData.m_GradeCardInProgressList.Remove(item); } } GradeCardSubmitSet currentGradeCardSubmitSet = CPlayerData.m_CurrentGradeCardSubmitSet; if (currentGradeCardSubmitSet?.m_CardDataList == null) { return; } for (int num = 0; num < currentGradeCardSubmitSet.m_CardDataList.Count; num++) { if (cardExpansions.Contains(currentGradeCardSubmitSet.m_CardDataList[num].expansionType)) { currentGradeCardSubmitSet.m_CardDataList[num] = new CardData(); } } } private void RemoveFromDecks() { foreach (DeckCompactCardDataList deckCompactCardData in CPlayerData.m_DeckCompactCardDataList) { deckCompactCardData.compactCardDataAmountList.RemoveAll((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType)); } } private void RemoveFromAutoPackOpeners() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) foreach (List item in CSingleton.Instance.m_AutoPackOpenerList.Select((InteractableAutoPackOpener p) => p.m_CompactCardDataAmountList)) { foreach (CompactCardDataAmount item2 in item.Where((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType))) { CardData cardData = CPlayerData.GetCardData(item2.cardSaveIndex, item2.expansionType, item2.isDestiny); removedCards[cardData] = removedCards.GetValueOrDefault(cardData) + item2.amount; } item.RemoveAll((CompactCardDataAmount c) => cardExpansions.Contains(c.expansionType)); } } private void RemoveFromHeldCards() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) InteractionPlayerController instance = CSingleton.Instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } List currentHoldingCard3dList = instance.m_CurrentHoldingCard3dList; bool flag = false; for (int num = Math.Min(currentHoldingCard3dList.Count, CPlayerData.m_HoldCardDataList.Count) - 1; num >= 0; num--) { CardData val = CPlayerData.m_HoldCardDataList[num]; if (cardExpansions.Contains(val.expansionType)) { removedCards[val] = removedCards.GetValueOrDefault(val) + 1; ((InteractableObject)currentHoldingCard3dList[num]).OnDestroyed(); currentHoldingCard3dList.RemoveAt(num); CPlayerData.m_HoldCardDataList.RemoveAt(num); flag = true; } } if (!flag) { return; } if (currentHoldingCard3dList.Count == 0) { instance.ExitHoldCardMode(); return; } for (int i = 0; i < currentHoldingCard3dList.Count; i++) { ((InteractableObject)currentHoldingCard3dList[i]).LerpToTransform(instance.m_HoldCardPosList[i], instance.m_HoldCardPosList[i], 3f); } } } internal class CustomerRemovalStrategy(HashSet cardExpansions, HashSet items) : IAssetRemovalStrategy { public RemovalResult RemoveAssets() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) int num = 0; float num2 = 0f; foreach (Customer customer in CSingleton.Instance.m_CustomerList) { if (!customer.IsActive() || !IsCarryingBundleContent(customer)) { continue; } foreach (Item item in from i in customer.m_ItemInBagList.Concat(customer.m_ItemInHandList) where items.Contains(i.m_ItemType) select i) { num++; num2 += RestockManager.GetItemMarketPrice(item.m_ItemType); } foreach (CardData item2 in from c in customer.m_CardInBagList select c.m_Card3dUI.m_CardUI.m_CardData into c where cardExpansions.Contains(c.expansionType) select c) { num++; num2 += CPlayerData.GetCardMarketPrice(item2); } customer.DeactivateCustomer(); } return RemovalResult.Success(num, num2); } private bool IsCarryingBundleContent(Customer customer) { if (!customer.m_ItemInBagList.Concat(customer.m_ItemInHandList).Any((Item i) => items.Contains(i.m_ItemType)) && !customer.m_CardInBagList.Any((InteractableCard3d c) => cardExpansions.Contains(c.m_Card3dUI.m_CardUI.m_CardData.expansionType))) { return HasBundleTournamentPrize(customer); } return true; } private bool HasBundleTournamentPrize(Customer customer) { CustomerTournamentData customerTournamentData = customer.GetCustomerTournamentData(); if (customerTournamentData == null) { return false; } if (customerTournamentData.m_TargetPrizeData == null || !customerTournamentData.m_TargetPrizeData.IsBundleContent(cardExpansions, items)) { return customerTournamentData.m_PrizeDataList.Any((TournamentPrizeData p) => p.IsBundleContent(cardExpansions, items)); } return true; } } internal class DecoRemovalStrategy(HashSet decoTypes, string bundleId) : IAssetRemovalStrategy { public RemovalResult RemoveAssets() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) float totalValue = 0f; int totalDecoCount = 0; foreach (EDecoObject item in decoTypes) { if (EplRuntimeData.Services.SaveDataManager.TryGetSaveData(item, out DecoSaveData data)) { totalDecoCount += data.ItemCount; totalValue += InventoryBase.GetItemDecoPurchaseData(item).price * (float)data.ItemCount; data.Reset(); } } ResetTextureSaveData((DecoFlags)3, EplRuntimeData.Assets.DecoLibrary.firstInsertedCeilingTexture, CSingleton.Instance.m_ObjectData_SO.m_CeilingDecoDataList, ref totalDecoCount, ref totalValue); ResetTextureSaveData((DecoFlags)1, EplRuntimeData.Assets.DecoLibrary.firstInsertedFloorTexture, CSingleton.Instance.m_ObjectData_SO.m_FloorDecoDataList, ref totalDecoCount, ref totalValue); ResetTextureSaveData((DecoFlags)2, EplRuntimeData.Assets.DecoLibrary.firstInsertedWallTexture, CSingleton.Instance.m_ObjectData_SO.m_WallDecoDataList, ref totalDecoCount, ref totalValue); return RemovalResult.Success(totalDecoCount, totalValue); } private unsafe void ResetTextureSaveData(DecoFlags category, int? firstInsertedIndex, List decoDataList, ref int totalDecoCount, ref float totalValue) { if (!firstInsertedIndex.HasValue) { return; } string category2 = ((object)(*(DecoFlags*)(&category))/*cast due to .constrained prefix*/).ToString(); BundleAssetTracker bundleAssetTracker = EplRuntimeData.BundleAssetTracker; SaveDataService saveDataManager = EplRuntimeData.Services.SaveDataManager; for (int i = firstInsertedIndex.Value; i < decoDataList.Count; i++) { string name = decoDataList[i].name; if (!(bundleAssetTracker.GetBundleIdFor(category2, name) != bundleId) && saveDataManager.TryGetSaveData(category2, name, out DecoSaveData data)) { totalDecoCount += data.ItemCount; totalValue += decoDataList[i].price * (float)data.ItemCount; data.Reset(); } } } } internal interface IAssetRemovalStrategy { RemovalResult RemoveAssets(); } internal class InteractableObjectRemovalStrategy(HashSet furnitures, HashSet decos) : IAssetRemovalStrategy { private readonly Dictionary itemsToRestock = new Dictionary(); public RemovalResult RemoveAssets() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) itemsToRestock.Clear(); int num = 0; float num2 = 0f; List list = (from Transform t in (IEnumerable)CSingleton.Instance.m_ShelfParentGrp select ((Component)t).GetComponent() into i where i != null && (furnitures.Contains(i.m_ObjectType) || decos.Contains(i.m_DecoObjectType)) select i).ToList(); FurnitureLibrary furnitureLibrary = EplRuntimeData.Assets.FurnitureLibrary; foreach (InteractableObject item in list) { InteractableDecoration val = (InteractableDecoration)(object)((item is InteractableDecoration) ? item : null); if (val == null) { InteractableBulkDonationBox val2 = (InteractableBulkDonationBox)(object)((item is InteractableBulkDonationBox) ? item : null); if (val2 == null) { InteractableCardStorageShelf val3 = (InteractableCardStorageShelf)(object)((item is InteractableCardStorageShelf) ? item : null); if (val3 == null) { CardItemCombiShelf val4 = (CardItemCombiShelf)(object)((item is CardItemCombiShelf) ? item : null); if (val4 == null) { CardShelf val5 = (CardShelf)(object)((item is CardShelf) ? item : null); if (val5 == null) { InteractableWorkbench val6 = (InteractableWorkbench)(object)((item is InteractableWorkbench) ? item : null); if (val6 == null) { Shelf val7 = (Shelf)(object)((item is Shelf) ? item : null); if (val7 == null) { WarehouseShelf val8 = (WarehouseShelf)(object)((item is WarehouseShelf) ? item : null); ModFurniturePurchaseData value; if (val8 != null) { EmptyWarehouseShelf(val8); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val8).m_ObjectType].BaseFurniturePurchaseData.price; } else if (furnitureLibrary.FurnitureData.TryGetValue(item.m_ObjectType, out value)) { num2 += value.BaseFurniturePurchaseData.price; } else if (decos.Contains(item.m_DecoObjectType)) { num2 += InventoryBase.GetItemDecoPurchaseData(item.m_DecoObjectType).price; } } else { EmptyShelf(val7); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val7).m_ObjectType].BaseFurniturePurchaseData.price; } } else { EmptyWorkbench(val6); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val6).m_ObjectType].BaseFurniturePurchaseData.price; } } else { EmptyCardShelf(val5); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val5).m_ObjectType].BaseFurniturePurchaseData.price; } } else { EmptyCombiShelf(val4); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val4).m_ObjectType].BaseFurniturePurchaseData.price; } } else { EmptyCardStorageShelf(val3); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val3).m_ObjectType].BaseFurniturePurchaseData.price; } } else { EmptyBulkDonationBox(val2); num2 += furnitureLibrary.FurnitureData[((InteractableObject)val2).m_ObjectType].BaseFurniturePurchaseData.price; } } else { num2 += InventoryBase.GetItemDecoPurchaseData(((InteractableObject)val).m_DecoObjectType).price; } if (item.m_IsBoxedUp) { ((InteractableObject)item.m_InteractablePackagingBox_Shelf).OnDestroyed(); } else { item.OnDestroyed(); } num++; } RestockItems(); return RemovalResult.Success(num, num2); } private void EmptyWarehouseShelf(WarehouseShelf warehouseShelf) { //IL_0064: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) foreach (ShelfCompartment item in from p in warehouseShelf.m_StorageCompartmentList.SelectMany((InteractableStorageCompartment s) => s.m_ShelfCompartment.m_InteractablePackagingBoxList) select p.m_ItemCompartment) { itemsToRestock[item.m_ItemType] = itemsToRestock.GetValueOrDefault(item.m_ItemType) + item.m_StoredItemList.Count; } if (!StoredBoxRecordAccess.IsAvailable) { return; } foreach (ShelfCompartment item2 in warehouseShelf.m_StorageCompartmentList.Select((InteractableStorageCompartment s) => s.m_ShelfCompartment)) { int num = StoredBoxRecordAccess.RecordCount(item2); for (int num2 = 0; num2 < num; num2++) { object record = StoredBoxRecordAccess.Peek(item2, num2); EItemType key = StoredBoxRecordAccess.ItemTypeOf(record); itemsToRestock[key] = itemsToRestock.GetValueOrDefault(key) + StoredBoxRecordAccess.AmountOf(record); } } } private void EmptyCombiShelf(CardItemCombiShelf combiShelf) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) EmptyCardShelf((CardShelf)(object)combiShelf); foreach (ShelfCompartment shelfItemCompartment in combiShelf.GetShelfItemCompartmentList()) { itemsToRestock[shelfItemCompartment.m_ItemType] = itemsToRestock.GetValueOrDefault(shelfItemCompartment.m_ItemType) + shelfItemCompartment.m_StoredItemList.Count; } } private void EmptyShelf(Shelf shelf) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) foreach (ShelfCompartment itemCompartment in ((InteractableObject)shelf).m_ItemCompartmentList) { itemsToRestock[itemCompartment.m_ItemType] = itemsToRestock.GetValueOrDefault(itemCompartment.m_ItemType) + itemCompartment.m_StoredItemList.Count; } } private void EmptyWorkbench(InteractableWorkbench interactableWorkbench) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) foreach (Item storedItem in interactableWorkbench.m_StoredItemList) { itemsToRestock[storedItem.m_ItemType] = itemsToRestock.GetValueOrDefault(storedItem.m_ItemType) + 1; } } private static void EmptyCardShelf(CardShelf cardShelf) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) foreach (InteractableCardCompartment item in cardShelf.m_CardCompartmentList.Where((InteractableCardCompartment c) => c.m_StoredCardList.Count > 0)) { foreach (InteractableCardPriceTag interactablePriceTag in item.m_InteractablePriceTagList) { interactablePriceTag.SetPriceChecked(false); } CardData cardData = item.m_StoredCardList[0].m_Card3dUI.m_CardUI.m_CardData; item.m_StoredCardList[0].SetIsDisplayedOnShelf(false); item.m_StoredCardList[0].SetTargetRotation(Quaternion.identity); item.m_StoredCardList.RemoveAt(0); item.SetPriceTagCardData((CardData)null); item.SetPriceTagVisibility(false); if (item.m_CardShelf?.m_ElectronicCardListener != null) { item.m_CardShelf.m_ElectronicCardListener.UpdateCardUI((CardData)null); } CPlayerData.AddCard(cardData, 1); } } private static void EmptyCardStorageShelf(InteractableCardStorageShelf interactableCardStorageShelf) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) foreach (CompactCardDataAmount compactCardDataAmount in interactableCardStorageShelf.m_CompactCardDataAmountList) { CPlayerData.AddCard(CPlayerData.GetCardData(compactCardDataAmount.cardSaveIndex, compactCardDataAmount.expansionType, compactCardDataAmount.isDestiny), compactCardDataAmount.amount); } interactableCardStorageShelf.m_CompactCardDataAmountList.Clear(); } private static void EmptyBulkDonationBox(InteractableBulkDonationBox interactableBulkDonationBox) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) foreach (CompactCardDataAmount compactCardDataAmount in interactableBulkDonationBox.m_CompactCardDataAmountList) { CPlayerData.AddCard(CPlayerData.GetCardData(compactCardDataAmount.cardSaveIndex, compactCardDataAmount.expansionType, compactCardDataAmount.isDestiny), compactCardDataAmount.amount); } interactableBulkDonationBox.m_CompactCardDataAmountList.Clear(); } private void RestockItems() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair item in itemsToRestock) { item.Deconstruct(out var key, out var value); EItemType val = key; int num2; int num = (num2 = value); int maxItemCountInBox = RestockManager.GetMaxItemCountInBox(val, true); int num3 = Mathf.CeilToInt((float)num / (float)maxItemCountInBox); for (int i = 0; i < num3; i++) { int num4 = ((num2 >= maxItemCountInBox) ? maxItemCountInBox : num2); RestockManager.SpawnPackageBoxItem(val, num4, true); num2 -= num4; } } } } internal class ItemRemovalStrategy(HashSet items) : IAssetRemovalStrategy { private List removedItems = new List(); public RemovalResult RemoveAssets() { removedItems = new List(); RemoveFromShelves(); RemoveFromPackagingBoxes(); RemoveFromWorkbenches(); RemoveFromAutoPackOpeners(); RemoveFromPlayTables(); RemoveFromHeldItems(); float num = RemoveFromRestockQueue(); (int Count, float Value) tuple = RemoveFromStoredBoxRecords(); int item = tuple.Count; float item2 = tuple.Value; float totalValue = removedItems.Select((Item i) => RestockManager.GetItemMarketPrice(i.m_ItemType)).Sum() + num + item2; foreach (Item removedItem in removedItems) { ItemSpawnManager.DisableItem(removedItem); } return RemovalResult.Success(removedItems.Count + item, totalValue); } private (int Count, float Value) RemoveFromStoredBoxRecords() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!StoredBoxRecordAccess.IsAvailable) { return (Count: 0, Value: 0f); } int num = 0; float num2 = 0f; foreach (ShelfCompartment warehouseCompartment in StoredBoxRecordAccess.GetWarehouseCompartments()) { if (!Object.op_Implicit((Object)(object)warehouseCompartment) || !HasMatchingRecord(warehouseCompartment)) { continue; } List list = new List(); object record; while (StoredBoxRecordAccess.TryPop(warehouseCompartment, out record)) { EItemType val = StoredBoxRecordAccess.ItemTypeOf(record); if (!items.Contains(val)) { list.Add(record); continue; } num++; num2 += RestockManager.GetItemMarketPrice(val) * (float)StoredBoxRecordAccess.AmountOf(record); } for (int num3 = list.Count - 1; num3 >= 0; num3--) { StoredBoxRecordAccess.Add(warehouseCompartment, list[num3]); } if (warehouseCompartment.m_ItemAmount == 0) { warehouseCompartment.RemoveLabel(false); } } return (Count: num, Value: num2); } private bool HasMatchingRecord(ShelfCompartment compartment) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) int num = StoredBoxRecordAccess.RecordCount(compartment); for (int i = 0; i < num; i++) { if (items.Contains(StoredBoxRecordAccess.ItemTypeOf(StoredBoxRecordAccess.Peek(compartment, i)))) { return true; } } return false; } private void RemoveFromPackagingBoxes() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) foreach (InteractablePackagingBox_Item item in RestockManager.GetItemPackagingBoxList().ToList()) { if (!items.Contains(item.m_ItemType) && !items.Contains(item.m_ItemCompartment.m_ItemType)) { continue; } if (item.m_IsStored) { item.m_BoxStoredCompartment.RemoveBox(item); if (item.m_BoxStoredCompartment.m_ItemAmount == 0) { item.m_BoxStoredCompartment.RemoveLabel(false); } } removedItems.AddRange(item.m_ItemCompartment.m_StoredItemList); EmptyItemCompartment(item.m_ItemCompartment); ((InteractableObject)item).OnDestroyed(); } } private void RemoveFromShelves() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) ShelfManager instance = CSingleton.Instance; foreach (ShelfCompartment item in instance.m_ShelfList.SelectMany((Shelf s) => ((InteractableObject)s).m_ItemCompartmentList).Concat(instance.m_CardItemCombiShelfList.SelectMany((CardItemCombiShelf s) => s.GetShelfItemCompartmentList()))) { if (items.Contains(item.m_ItemType) && item.m_ItemAmount != 0) { removedItems.AddRange(item.m_StoredItemList); EmptyItemCompartment(item); } } } private void RemoveFromWorkbenches() { foreach (InteractableWorkbench workbench in CSingleton.Instance.m_WorkbenchList) { foreach (Item item in workbench.m_StoredItemList.Where((Item i) => items.Contains(i.m_ItemType)).ToList()) { removedItems.Add(item); workbench.RemoveItem(item); } } } private void RemoveFromAutoPackOpeners() { foreach (InteractableAutoPackOpener autoPackOpener in CSingleton.Instance.m_AutoPackOpenerList) { List list = autoPackOpener.m_StoredItemList.Where((Item i) => items.Contains(i.m_ItemType)).ToList(); if (list.Count == 0) { continue; } foreach (Item item in list) { removedItems.Add(item); autoPackOpener.RemoveItem(item); } if (Object.op_Implicit((Object)(object)autoPackOpener.m_AutoCardOpenerUI)) { autoPackOpener.m_AutoCardOpenerUI.UpdatePackCountText(autoPackOpener.m_StoredItemList.Count, autoPackOpener.m_MaxPackCount); } } } private void RemoveFromPlayTables() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) foreach (InteractablePlayTable playTable in CSingleton.Instance.m_PlayTableList) { for (int i = 0; i < playTable.m_TableGameItemSetDataList.Count; i++) { TableGameItemSetData val = playTable.m_TableGameItemSetDataList[i]; if (val != null && (items.Contains(val.playMatType) || items.Contains(val.deckBoxType) || items.Contains(val.comicBookType))) { playTable.m_TableGameItemSetDataList[i] = null; } } } } private void RemoveFromHeldItems() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) InteractionPlayerController instance = CSingleton.Instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } List holdItemList = instance.m_HoldItemList; bool flag = false; for (int num = holdItemList.Count - 1; num >= 0; num--) { if (items.Contains(holdItemList[num].m_ItemType)) { removedItems.Add(holdItemList[num]); holdItemList.RemoveAt(num); flag = true; } } if (!flag) { return; } CPlayerData.m_HoldItemTypeList.RemoveAll((EItemType t) => items.Contains(t)); if (holdItemList.Count == 0) { instance.SetCurrentGameState((EGameState)0); instance.m_IsHoldItemMode = false; return; } for (int num2 = 0; num2 < holdItemList.Count; num2++) { holdItemList[num2].SmoothLerpToTransform(instance.m_HoldCardPackPosList[num2], instance.m_HoldCardPackPosList[num2], true); } } private float RemoveFromRestockQueue() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) RestockManager instance = CSingleton.Instance; float num = 0f; for (int num2 = CPlayerData.m_SpawnBoxRestockIndexWaitingList.Count - 1; num2 >= 0; num2--) { RestockData restockData = InventoryBase.GetRestockData(CPlayerData.m_SpawnBoxRestockIndexWaitingList[num2]); if (restockData != null && items.Contains(restockData.itemType)) { int maxItemCountInBox = RestockManager.GetMaxItemCountInBox(restockData.itemType, restockData.isBigBox); num += RestockManager.GetItemMarketPrice(restockData.itemType) * (float)maxItemCountInBox * (float)CPlayerData.m_SpawnBoxItemCountWaitingList[num2]; CPlayerData.m_SpawnBoxRestockIndexWaitingList.RemoveAt(num2); CPlayerData.m_SpawnBoxItemCountWaitingList.RemoveAt(num2); if (num2 < instance.m_SpawnBoxItemWaitingList.Count) { instance.m_SpawnBoxItemWaitingList.RemoveAt(num2); } } } return num; } private static void EmptyItemCompartment(ShelfCompartment itemCompartment) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) itemCompartment.m_StoredItemList.Clear(); itemCompartment.m_ItemAmount = 0; itemCompartment.m_ItemType = (EItemType)(-1); itemCompartment.RemoveLabel(false); } } internal class RemovalResult { internal bool IsSuccess { get; private set; } internal int AssetsRemoved { get; private set; } internal float TotalValue { get; private set; } internal string ErrorMessage { get; private set; } = string.Empty; private RemovalResult() { } internal static RemovalResult Success(int assetsRemoved, float totalValue) { return new RemovalResult { IsSuccess = true, AssetsRemoved = assetsRemoved, TotalValue = totalValue }; } internal static RemovalResult Failure(string msg) { return new RemovalResult { IsSuccess = false, ErrorMessage = msg }; } internal static RemovalResult Empty() { return new RemovalResult { IsSuccess = true }; } internal void Merge(RemovalResult other) { IsSuccess = IsSuccess && other.IsSuccess; AssetsRemoved += other.AssetsRemoved; TotalValue += other.TotalValue; if (!string.IsNullOrWhiteSpace(other.ErrorMessage)) { ErrorMessage = (string.IsNullOrWhiteSpace(ErrorMessage) ? other.ErrorMessage : (ErrorMessage + "\n" + other.ErrorMessage)); } } } internal static class StoredBoxRecordAccess { private static readonly MethodInfo? getWarehouseCompartmentList = AccessTools.Method(typeof(RestockManager), "GetWarehouseCompartmentList", (Type[])null, (Type[])null); private static readonly MethodInfo? getRecordCount = AccessTools.Method(typeof(ShelfCompartment), "GetStoredBoxRecordCount", (Type[])null, (Type[])null); private static readonly MethodInfo? peekRecord = AccessTools.Method(typeof(ShelfCompartment), "PeekStoredBoxRecord", (Type[])null, (Type[])null); private static readonly MethodInfo? tryPopRecord = AccessTools.Method(typeof(ShelfCompartment), "TryPopLastStoredBoxRecord", (Type[])null, (Type[])null); private static readonly MethodInfo? addRecord = AccessTools.Method(typeof(ShelfCompartment), "AddStoredBoxRecord", (Type[])null, (Type[])null); private static readonly FieldInfo? itemTypeField = AccessTools.Field(GameBuild.StoredBoxRecordType, "itemType"); private static readonly FieldInfo? amountField = AccessTools.Field(GameBuild.StoredBoxRecordType, "amount"); internal static bool IsAvailable { get { if (GameBuild.HasStoredBoxRecords && (object)getWarehouseCompartmentList != null && (object)getRecordCount != null && (object)peekRecord != null && (object)tryPopRecord != null && (object)addRecord != null && (object)itemTypeField != null) { return (object)amountField != null; } return false; } } internal static List GetWarehouseCompartments() { return (getWarehouseCompartmentList.Invoke(null, null) as List) ?? new List(); } internal static int RecordCount(ShelfCompartment compartment) { return (int)getRecordCount.Invoke(compartment, null); } internal static object Peek(ShelfCompartment compartment, int index) { return peekRecord.Invoke(compartment, new object[1] { index }); } internal static bool TryPop(ShelfCompartment compartment, out object? record) { object[] array = new object[1]; bool flag = (bool)tryPopRecord.Invoke(compartment, array); record = (flag ? array[0] : null); return flag; } internal static void Add(ShelfCompartment compartment, object record) { addRecord.Invoke(compartment, new object[1] { record }); } internal static EItemType ItemTypeOf(object record) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return (EItemType)itemTypeField.GetValue(record); } internal static int AmountOf(object record) { return (int)amountField.GetValue(record); } } internal static class TournamentPrizeDataExtensions { internal static bool IsBundleContent(this TournamentPrizeData prize, HashSet cardExpansions, HashSet items) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!prize.IsCard() || !cardExpansions.Contains(prize.m_CardData.expansionType)) { if (prize.IsItem()) { return items.Contains(prize.m_ItemType); } return false; } return true; } } internal class TournamentRemovalStrategy(HashSet cardExpansions, HashSet items) : IAssetRemovalStrategy { public RemovalResult RemoveAssets() { int num = 0; float num2 = 0f; TournamentData tournamentData = CPlayerData.m_TournamentData; if (tournamentData != null) { foreach (TournamentPrizeDataList prizeData in tournamentData.m_PrizeDataList) { foreach (TournamentPrizeData item in prizeData.m_PrizeDataList.Where((TournamentPrizeData p) => p.IsBundleContent(cardExpansions, items))) { num += item.m_Count; num2 += GetPrizeValue(item); } prizeData.m_PrizeDataList.RemoveAll((TournamentPrizeData p) => p.IsBundleContent(cardExpansions, items)); } } foreach (CustomerTournamentData item2 in from d in CSingleton.Instance.m_PlayTableList.SelectMany((InteractablePlayTable t) => t.m_CustomerTournamentDataList).Append(CPlayerData.m_PlayerTournamentData) where d != null select d) { item2.m_PrizeDataList.RemoveAll((TournamentPrizeData p) => p.IsBundleContent(cardExpansions, items)); if (item2.m_TargetPrizeData != null && item2.m_TargetPrizeData.IsBundleContent(cardExpansions, items)) { item2.m_TargetPrizeData = null; } } return RemovalResult.Success(num, num2); } private static float GetPrizeValue(TournamentPrizeData prize) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!prize.IsCard()) { return RestockManager.GetItemMarketPrice(prize.m_ItemType) * (float)prize.m_Count; } return CPlayerData.GetCardMarketPrice(prize.m_CardData) * (float)prize.m_Count; } } } namespace EnhancedPrefabLoader.Core.Trading { internal class CardTradeManager { private readonly CardSelectionService cardSelectionService = new CardSelectionService(); private readonly CardTradePricingService cardTradePricingService = new CardTradePricingService(); private readonly CardTradeUIManager cardTradeUIManager = new CardTradeUIManager(); public void SetCustomer(CustomerTradeCardScreen screen, Customer customer, CustomerTradeData customerTradeData) { CSingleton.Instance.m_IsPlayerTrading = true; screen.m_CurrentCustomer = customer; screen.m_HasAccepted = false; screen.m_IsTrading = customerTradeData?.m_IsTrading ?? (Random.Range(0, 100) < Math.Min(40, CPlayerData.m_ShopLevel)); screen.m_CardData_L = (CardData)((customerTradeData != null) ? ((object)customerTradeData.m_CardData_L) : ((object)cardSelectionService.SelectRandomCard())); if (screen.m_IsTrading) { SetupTradeMode(screen, customerTradeData); } else { SetupSellMode(screen, customerTradeData); } cardTradeUIManager.UpdateUI(screen); } private void SetupTradeMode(CustomerTradeCardScreen screen, CustomerTradeData customerTradeData) { screen.m_CardData_R = (CardData)((customerTradeData != null) ? ((object)customerTradeData.m_CardData_R) : ((object)cardSelectionService.SelectPlayerCard(screen.m_CardData_L, customerTradeData))); if (screen.m_CardData_R == null) { screen.m_IsTrading = false; SetupSellMode(screen, customerTradeData); } } private void SetupSellMode(CustomerTradeCardScreen screen, CustomerTradeData customerTradeData) { cardTradePricingService.CalculateAskingPrice(screen, screen.m_CardData_L, customerTradeData); if (customerTradeData != null) { screen.m_PriceSet = customerTradeData.m_PriceSet; screen.m_LastPriceSet = customerTradeData.m_LastPriceSet; } else { screen.OnInputTextUpdated("0"); } } } internal class CardTradePricingService { private static readonly (float threshold, float minBonus, float maxBonus)[] PriceTiers = new(float, float, float)[9] { (10f, 0f, 0.03f), (20f, 0f, 0.04f), (100f, 0.01f, 0.05f), (300f, 0.01f, 0.06f), (500f, 0.01f, 0.08f), (1000f, 0.01f, 0.1f), (2000f, 0.02f, 0.11f), (5000f, 0.03f, 0.12f), (8000f, 0.03f, 0.12f) }; public void CalculateAskingPrice(CustomerTradeCardScreen screen, CardData customerCard, CustomerTradeData customerTradeData) { screen.m_SellCardMarketPrice = CPlayerData.GetCardMarketPrice(customerCard); if (customerTradeData != null) { screen.m_SellCardAskPrice = customerTradeData.m_SellCardAskPrice; screen.m_MaxDeclineCount = customerTradeData.m_MaxDeclineCount; screen.m_DeclineCount = customerTradeData.m_DeclineCount; } else { screen.m_SellCardAskPrice = CalculateInitialAskingPrice(screen.m_SellCardMarketPrice); screen.m_MaxDeclineCount = Random.Range(0, 5); screen.m_DeclineCount = 0; } } private float CalculateInitialAskingPrice(float marketPrice) { float num = Random.Range(0.7f, 1.2f); (float, float, float)[] priceTiers = PriceTiers; for (int i = 0; i < priceTiers.Length; i++) { (float, float, float) tuple = priceTiers[i]; if (marketPrice > tuple.Item1) { num += Random.Range(tuple.Item2, tuple.Item3); } } return num * marketPrice; } } internal class CardTradeUIManager { public void UpdateUI(CustomerTradeCardScreen screen) { SetTradingScreenText(screen); UpdateScreenGrpVisibility(screen); SetPriceTexts(screen); UpdateCardDisplays(screen); UpdateButtonVisibility(screen); } private void SetTradingScreenText(CustomerTradeCardScreen screen) { List list = (screen.m_IsTrading ? screen.m_CustomerTradeCardTextList : screen.m_CustomerSellCardTextList); ((TMP_Text)screen.m_CustomerTopText).text = LocalizationManager.GetTranslation("CustomerTrade/" + list[Random.Range(0, list.Count)], true, 0, true, false, (GameObject)null, (string)null, true); screen.m_CustomerTopTextAnim.Rewind(); screen.m_CustomerTopTextAnim.Play(); } private void UpdateScreenGrpVisibility(CustomerTradeCardScreen screen) { screen.m_CustomerTradingText.SetActive(screen.m_IsTrading); screen.m_CustomerSellingText.SetActive(!screen.m_IsTrading); screen.m_TradeGrp_R.SetActive(screen.m_IsTrading); screen.m_SellGrp_R.SetActive(!screen.m_IsTrading); } private void SetPriceTexts(CustomerTradeCardScreen screen) { string translation = LocalizationManager.GetTranslation("Market Price", true, 0, true, false, (GameObject)null, (string)null, true); string priceString = GameInstance.GetPriceString(CPlayerData.GetCardMarketPrice(screen.m_CardData_L), false, true, false, "F2"); string translation2 = LocalizationManager.GetTranslation("Ask Price", true, 0, true, false, (GameObject)null, (string)null, true); string priceString2 = GameInstance.GetPriceString(screen.m_SellCardAskPrice, false, true, false, "F2"); if (screen.m_IsTrading) { ((TMP_Text)screen.m_MarketPrice_L).text = translation + " : " + priceString; return; } ((TMP_Text)screen.m_MarketPrice_L).text = translation2 + " : " + priceString2 + "\n" + translation + " : " + priceString; screen.m_CardUI_Buying.SetCardUI(screen.m_CardData_L); } private void UpdateButtonVisibility(CustomerTradeCardScreen screen) { screen.m_AcceptBtn.SetActive(true); screen.m_CancelBtn.SetActive(true); screen.m_LetMeThinkBtn.SetActive(true); screen.m_DoneBtn.SetActive(false); } private void UpdateCardDisplays(CustomerTradeCardScreen screen) { screen.m_IsNewUI.SetActive(CPlayerData.GetCardAmount(screen.m_CardData_L) == 0); screen.m_CardUI_L.SetCardUI(screen.m_CardData_L); screen.m_CardUI_Album_L.SetCardUI(screen.m_CardData_L); ((TMP_Text)screen.m_AlbumCardCount_L).text = GetCardCountText(screen.m_CardData_L); if (screen.m_IsTrading && screen.m_CardData_R != null) { screen.m_CardUI_R.SetCardUI(screen.m_CardData_R); screen.m_CardUI_Album.SetCardUI(screen.m_CardData_R); ((TMP_Text)screen.m_AlbumCardCount).text = GetCardCountText(screen.m_CardData_R); float cardMarketPrice = CPlayerData.GetCardMarketPrice(screen.m_CardData_R); string translation = LocalizationManager.GetTranslation("Market Price", true, 0, true, false, (GameObject)null, (string)null, true); ((TMP_Text)screen.m_MarketPrice_R).text = translation + " : " + GameInstance.GetPriceString(cardMarketPrice, false, true, false, "F2"); } } private string GetCardCountText(CardData card) { if (card.cardGrade <= 0) { return "X" + CPlayerData.GetCardAmount(card); } if (!CPlayerData.HasGradedCardInAlbum(card)) { return "X0"; } return "X1"; } } } namespace EnhancedPrefabLoader.Core.Shops { internal class CustomShopScreen : RestockItemScreen, ICustomShopScreen { private TextMeshProUGUI? pageUrl; private Image? pageLogo; private Image? pageHeader; private Image? pageBackground; private Color originalHeaderColor; private Color originalBackgroundColor; private string displayName = string.Empty; private readonly List pageUrls = new List(4) { "cards", "accessories", "figurines", "all" }; private List> pageItems = new List>(); private int currentPageIndex; internal bool IsOpen => ((UIScreenBase)this).m_ScreenGroup.activeSelf; public override void Awake() { //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Expected O, but got Unknown //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown ((UIScreenBase)this).m_ScreenGroup = ((Component)((Component)this).transform.Find("ScreenGrp")).gameObject; ref RectTransform animGrp = ref ((GenericSliderScreen)this).m_AnimGrp; Transform obj = ((UIScreenBase)this).m_ScreenGroup.transform.Find("AnimGrp"); animGrp = (RectTransform)(object)((obj is RectTransform) ? obj : null); ((GenericSliderScreen)this).m_VerticalLayoutGrp = ((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteContent_Grp/ScrollerGrp"); ((GenericSliderScreen)this).m_VerticalLayout = ((Component)((GenericSliderScreen)this).m_VerticalLayoutGrp).GetComponent(); ((GenericSliderScreen)this).m_SliderGrp = ((Component)((GenericSliderScreen)this).m_VerticalLayoutGrp).gameObject; ((GenericSliderScreen)this).m_ScrollEndComparer = ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("ScrollEndComparer")).gameObject; ((GenericSliderScreen)this).m_ScrollEndPos = ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("ScrollEnd")).gameObject; Transform obj2 = ((Component)this).transform.parent.Find("RestockItemAddToCartScreen"); base.m_RestockItemAddToCartScreen = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); Transform obj3 = ((Component)this).transform.parent.Find("RestockItemCheckoutScreen"); base.m_RestockItemCheckoutScreen = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); base.m_SortUIScreen = ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("SortingUIScreen")).GetComponent(); base.m_RestockItemPanelUIList = new List(); base.m_PageButtonHighlightList = new List(4) { ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteTopBar/PackBtn/AnimGrp/BGBarGrp/BGBlack")).gameObject, ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteTopBar/AccessoriesBtn/AnimGrp/BGBarGrp/BGBlack")).gameObject, ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteTopBar/FigurineBtn/AnimGrp/BGBarGrp/BGBlack")).gameObject, ((Component)((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteTopBar/AllBtn/AnimGrp/BGBarGrp/BGBlack")).gameObject }; base.m_SortBtnList = (from Transform t in (IEnumerable)((Component)base.m_SortUIScreen).transform.Find("Screen_Grp/AnimGrp/Mask/UIGroup") select ((Component)t).GetComponent()).ToList(); Transform val = ((Transform)((GenericSliderScreen)this).m_AnimGrp).Find("WebsiteTopBar"); Transform obj4 = val.Find("TotalPriceBG/TotalPrice"); base.m_TotalCostText = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); base.m_CartNotification = ((Component)val.Find("NotificationGrp")).gameObject; Transform obj5 = base.m_CartNotification.transform.Find("NotificationText"); base.m_TotalCartItemCountText = ((obj5 != null) ? ((Component)obj5).GetComponent() : null); Button component = ((Component)val.Find("CheckoutBtn/BtnRaycast")).GetComponent