using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Zichen-ShopPlus-1.0.2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+70d29b0e67f7649c9f24c1882424d330cbb8303a")] [assembly: AssemblyProduct("Zichen-ShopPlus-1.0.2")] [assembly: AssemblyTitle("Zichen-ShopPlus-1.0.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [BepInPlugin("zichen.shopplus", "ShopPlus", "1.0.2")] public class ShopPlusPlugin : BaseUnityPlugin { [Serializable] private sealed class DebugShelfPlacementRecord { public string shopKey; public string levelName; public string narrativeName; public string sceneName; public string resourcePath; public string prefabName; public string lastAction; public string anchorName; public Vector3 anchorPosition; public Vector3 position; public Vector3 scale = Vector3.one; public float yaw; public string savedAtUtc; } private struct GroundPackLayout { public int PackCount; public int SlotsPerSet; public int RowsPerSet; public int TotalRows; public float FloorHeight; public float SpacingX; public float SpacingZ; public Vector3 GridCenter; public Vector3[] PackCenters; public Vector3 ExtractionPosition; public Vector3 SpawnReferencePosition; public Bounds ShopBounds; } private struct GroundPackSpawnSlot { public itemVolume VolumeType; public Vector3 Position; public Quaternion Rotation; } private struct GroundPackCategoryGroup { public itemVolume VolumeType; public int ItemCount; } private struct GroundPackPlacement { public itemVolume VolumeType; public int ItemCount; public Vector3 Center; public int Columns; public int Rows; public float SpacingX; public float SpacingZ; public float HalfWidth; public float HalfDepth; } private struct ShopItemLimitState { public int MaxAmountInShop; public int MaxAmount; public bool MaxPurchase; public int MaxPurchaseAmount; } [CompilerGenerated] private sealed class d__356 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ShopPlusPlugin <>4__this; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__356(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ShopPlusPlugin shopPlusPlugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; 5__2++; break; } if (5__2 < 15) { if (!shopPlusPlugin.IsRandomFreeItemRuntimeEnabled() || !SemiFunc.RunIsShop()) { shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } if (shopPlusPlugin.TryAssignRandomFreeItem()) { shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } <>2__current = FreeItemRetryDelay; <>1__state = 1; return true; } shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__357 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ShopPlusPlugin <>4__this; public int photonViewId; public bool nativeScaleApplied; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__357(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ShopPlusPlugin shopPlusPlugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; 5__2++; break; } if (5__2 < 15) { if (!shopPlusPlugin.IsRandomFreeItemRuntimeEnabled() || !SemiFunc.RunIsShop()) { shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } if (shopPlusPlugin.TryAssignSyncedFreeItem(photonViewId, nativeScaleApplied)) { shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } <>2__current = FreeItemRetryDelay; <>1__state = 1; return true; } if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)$"Failed to apply synced free shop item on this client. ViewID={photonViewId}"); } shopPlusPlugin.freeItemSelectionCoroutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "zichen.shopplus"; public const string PluginVersion = "1.0.2"; public const string PluginName = "ShopPlus"; private static ShopPlusPlugin Instance; private Harmony harmony; private const string InfoSection = "模组信息"; private const string GlobalSection = "A.全局设置"; private const string ShopItemFeaturesSection = "B.刷物和免单"; private const string GroundPacksSection = "C.地面补货"; private const string DebugSection = "D.调试选项"; private const int MaxItemSpawnMultiplier = 3; private const int MaxGroundItemPackCount = 3; private const int MaxGroundItemVolumeCount = 20; private ConfigEntry moduleNameInfo; private ConfigEntry moduleVersionInfo; private ConfigEntry modEnabled; internal ConfigEntry shopItemFeaturesEnabled; internal ConfigEntry itemSpawnMultiplier; internal ConfigEntry randomFreeItemEnabled; internal ConfigEntry groundItemPacksEnabled; internal ConfigEntry groundItemPackCount; internal ConfigEntry groundSmallItemCount; internal ConfigEntry groundMediumItemCount; internal ConfigEntry groundPowerCrystalCount; internal ConfigEntry groundLargeHighItemCount; internal ConfigEntry groundUpgradeItemCount; internal ConfigEntry groundHealthPackCount; internal ConfigEntry groundLargeItemCount; internal ConfigEntry groundLargeWideItemCount; internal ConfigEntry groundLargePlusItemCount; internal ConfigEntry debugGroundPackMarkers; private Coroutine freeItemSelectionCoroutine; private readonly List freeItemCandidateBuffer = new List(128); private DateTime lastLoadedConfigWriteTimeUtc = DateTime.MinValue; private int lastRuntimeConfigReloadFrame = -1; private Rect cachedFreeItemLabelRect; private int cachedFreeItemLabelFrame = -1; private static ItemAttributes currentFreeShopItem; private static int currentFreeShopItemOriginalValue = -1; private static Vector3 currentFreeShopItemOriginalScale = Vector3.one; private static bool currentFreeShopItemShouldRestoreOriginalState = true; private static bool currentFreeShopItemUsesNativeNetworkSync; private static ShopPlusFreeItemSync freeItemNetworkSync; private static GUIStyle freeItemLabelStyle; private static readonly Color FreeItemHighlightColor = new Color(0.32f, 1f, 0.48f, 1f); private static readonly Color FreeItemLabelBackgroundColor = new Color(0.18f, 0.92f, 0.35f, 0.95f); private static readonly WaitForSeconds FreeItemRetryDelay = new WaitForSeconds(0.2f); private static readonly Comparison FreeItemCandidateComparison = CompareFreeItemCandidates; private const int FreeItemMaxValue = 10; private const int FreeItemMaxSelectionAttempts = 15; private const float FreeItemScaleMultiplier = 3f; private const string FreeItemPromptSuffix = " [FREE]"; private const string DebugShelfSection = "D.货架模型调试"; private const string DebugShelfBundleFileName = "moreshopitems_assets.file"; private const string DebugShelfPrefabName = "custom_soda_shelf"; private const string DebugShelfPrimaryModelId = "custom_soda_shelf"; private const string DebugShelfSecondaryModelId = "gouwujia_fbx"; private const string DebugShelfSecondaryModelDisplayName = "gouwujia.fbx"; private const string DebugShelfSecondaryModelFileName = "gouwujia.fbx"; private const string DebugShelfPlacementFilePrefix = "debug-shelf-placement-"; private const string DebugShelfLiveStateFilePrefix = "debug-shelf-current-"; private const float DebugShelfMinScale = 0.25f; private const float DebugShelfMaxScale = 3.5f; private const int DebugShelfWindowId = 381126; private const KeyCode DebugShelfToggleKey = 282; private const float DebugShelfWindowWidth = 460f; private const float DebugShelfWindowHeight = 420f; private const string RepoProjectRootPath = "D:\\donetProjects\\repo\\Zichen-Mods\\Zichen-ShopPlus"; private static readonly string RepoLocalMoreShopItemsBundlePath = "D:\\donetProjects\\repo\\_project_docs\\MODS_DECOMPILED_SOURCE_READ_ONLY\\Jettcodey-MoreShopItems_Updated\\3.3.0\\moreshopitems_assets.file"; private static readonly string[] DebugShelfAnchorCandidates = new string[6] { "Soda Shelf", "Shop Magazine Stand (1)", "Candy Shelf", "Soda Machine (1)", "cashiers shelf", "Shop Magazine Stand" }; private static readonly float[] DebugShelfMoveSteps = new float[5] { 0.01f, 0.05f, 0.1f, 0.25f, 0.5f }; private static readonly float[] DebugShelfScaleSteps = new float[4] { 0.01f, 0.05f, 0.1f, 0.25f }; private static readonly float[] DebugShelfYawSteps = new float[4] { 1f, 5f, 15f, 45f }; private const float DebugShelfFineStepMultiplier = 0.1f; internal ConfigEntry debugShelfEnabled; internal ConfigEntry debugShelfPanelEnabled; private static AssetBundle debugShelfBundle; private static GameObject debugShelfPrefab; private static GameObject debugShelfInstance; private static GameObject debugShelfSecondaryInstance; private static string debugShelfResolvedBundlePath = string.Empty; private static string debugShelfLastError = string.Empty; private static string debugShelfSecondaryStatus = string.Empty; private static string debugShelfCurrentShopKey = string.Empty; private static string debugShelfCurrentLevelName = string.Empty; private static string debugShelfCurrentNarrativeName = string.Empty; private static string debugShelfCurrentSceneName = string.Empty; private static string debugShelfCurrentResourcePath = string.Empty; private static string debugShelfAnchorName = "none"; private static Vector3 debugShelfAnchorPosition = Vector3.zero; private static Quaternion debugShelfAnchorRotation = Quaternion.identity; private static Rect debugShelfWindowRect = new Rect(18f, 18f, 460f, 420f); private static int debugShelfMoveStepIndex = 2; private static int debugShelfScaleStepIndex = 1; private static int debugShelfYawStepIndex = 1; private static bool debugShelfHasSavedPlacement; private static bool debugShelfPanelVisible; private static string debugShelfSelectedModelId = "custom_soda_shelf"; private static bool debugShelfCursorStateCaptured; private static bool debugShelfPreviousCursorVisible; private static CursorLockMode debugShelfPreviousCursorLockMode; private static GUIStyle debugShelfBadgeStyle; private static GUIStyle debugShelfInfoStyle; private static GUIStyle debugShelfHeaderStyle; private static readonly FieldInfo ShopManagerItemVolumesField = typeof(ShopManager).GetField("itemVolumes", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerShoppingListField = typeof(ShopManager).GetField("shoppingList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerItemSpawnTargetAmountField = typeof(ShopManager).GetField("itemSpawnTargetAmount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerItemConsumablesAmountField = typeof(ShopManager).GetField("itemConsumablesAmount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerItemUpgradesAmountField = typeof(ShopManager).GetField("itemUpgradesAmount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerItemHealthPacksAmountField = typeof(ShopManager).GetField("itemHealthPacksAmount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerPotentialItemsField = typeof(ShopManager).GetField("potentialItems", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerPotentialItemConsumablesField = typeof(ShopManager).GetField("potentialItemConsumables", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerPotentialItemUpgradesField = typeof(ShopManager).GetField("potentialItemUpgrades", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerPotentialItemHealthPacksField = typeof(ShopManager).GetField("potentialItemHealthPacks", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerPotentialSecretItemsField = typeof(ShopManager).GetField("potentialSecretItems", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ShopManagerItemValueMultiplierField = typeof(ShopManager).GetField("itemValueMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ItemAttributesValueField = typeof(ItemAttributes).GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ItemAttributesPromptNameField = typeof(ItemAttributes).GetField("promptName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ExtractionPointIsShopField = typeof(ExtractionPoint).GetField("isShop", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RoomVolumeCheckInTruckField = typeof(RoomVolumeCheck).GetField("inTruck", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RoomVolumeCheckInExtractionPointField = typeof(RoomVolumeCheck).GetField("inExtractionPoint", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo WorldSpaceUIValueTextField = typeof(WorldSpaceUIValue).GetField("text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private const int GroundPackColumns = 11; private const float GroundPackMaxSpacing = 0.62f; private const float GroundPackMinSpacing = 0.38f; private const float GroundPackDesiredSpawnHeight = 1.25f; private const float GroundPackMinimumSpawnHeight = 0.45f; private const float GroundPackCeilingClearance = 0.55f; private const float GroundPackExtractionClearance = 3.65f; private const float GroundPackBoundsMargin = 0.38f; private const float GroundPackOccupiedClearanceFactor = 0.68f; private const float GroundPackOccupiedClearanceMin = 0.26f; private const float GroundPackOriginalVolumeClearance = 0.48f; private const int GroundPackRaycastHitBufferSize = 64; private static readonly float[] GroundPackFallbackAngles = new float[14] { 0f, 24f, -24f, 48f, -48f, 72f, -72f, 96f, -96f, 120f, -120f, 144f, -144f, 180f }; private static readonly List groundSpawnVolumeObjects = new List(); private static readonly List groundPackMarkedItems = new List(); private static readonly List sceneShopVolumeBuffer = new List(96); private static readonly List normalShopVolumeBuffer = new List(96); private static readonly List groundPackOccupiedPositionsBuffer = new List(256); private static readonly List pendingGroundPackSpawnSlots = new List(512); private static readonly Dictionary groundPackCreatedCountsBuffer = new Dictionary(16); private static readonly Dictionary groundPackSkippedCountsBuffer = new Dictionary(16); private static readonly Dictionary groundPackUpgradeItemCountsBuffer = new Dictionary(32); private static readonly List limitedItemReplacementCandidatesBuffer = new List(64); private static readonly Dictionary originalShopItemLimitStates = new Dictionary(128); private static readonly float[] groundPackHeightSampleBuffer = new float[5]; private static readonly RaycastHit[] GroundPackFloorRaycastHits = (RaycastHit[])(object)new RaycastHit[64]; private static readonly RaycastHit[] GroundPackCeilingRaycastHits = (RaycastHit[])(object)new RaycastHit[64]; private static int groundPackCreateLogFrame = -1; private static int itemVolumeCollectionLogFrame = -1; private static int originalShopCurrency = -1; private static PropertyInfo worldSpaceUITextProperty; private static PropertyInfo worldSpaceUIColorProperty; private void Awake() { DetachFromManager(); Instance = this; ResetConfigIfVersionChanged(); BindConfig(); ApplyHarmonyPatches(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ShopPlus v1.0.2 loaded."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if (Instance == this) { Instance = null; } } private void DetachFromManager() { try { ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to mark plugin host persistent: " + ex.GetType().Name + ": " + ex.Message)); } } private bool IsModEnabled() { if (modEnabled != null) { return modEnabled.Value; } return true; } private static bool IsStaticModEnabled() { ShopPlusPlugin instance = Instance; if (!((Object)(object)instance == (Object)null)) { return instance.IsModEnabled(); } return true; } private static bool ShouldRunMasterShopLogic() { if (IsStaticModEnabled() && SemiFunc.RunIsShop()) { return !SemiFunc.IsNotMasterClient(); } return false; } private bool AreShopItemFeaturesEnabled() { if (shopItemFeaturesEnabled != null) { return shopItemFeaturesEnabled.Value; } return true; } private static bool AreStaticShopItemFeaturesEnabled() { ShopPlusPlugin instance = Instance; if (!((Object)(object)instance == (Object)null)) { return instance.AreShopItemFeaturesEnabled(); } return true; } private static int GetConfiguredItemSpawnMultiplier() { if (!AreStaticShopItemFeaturesEnabled()) { return 1; } return Mathf.Clamp((Instance?.itemSpawnMultiplier?.Value).GetValueOrDefault(1), 1, 3); } private bool IsRandomFreeItemRuntimeEnabled() { if (IsModEnabled() && AreShopItemFeaturesEnabled()) { if (randomFreeItemEnabled != null) { return randomFreeItemEnabled.Value; } return true; } return false; } private static bool IsStaticRandomFreeItemEnabled() { ShopPlusPlugin instance = Instance; if (!((Object)(object)instance == (Object)null)) { return instance.IsRandomFreeItemRuntimeEnabled(); } return true; } private static bool IsDebugGroundPackMarkersEnabled() { ShopPlusPlugin instance = Instance; if ((Object)(object)instance != (Object)null && instance.debugGroundPackMarkers != null) { return instance.debugGroundPackMarkers.Value; } return false; } private static bool IsGroundPackEnabled() { ShopPlusPlugin instance = Instance; if ((Object)(object)instance != (Object)null && instance.groundItemPacksEnabled != null) { return instance.groundItemPacksEnabled.Value; } return false; } private static int GetConfiguredGroundPackCount() { return Mathf.Clamp((Instance?.groundItemPackCount?.Value).GetValueOrDefault(1), 1, 3); } private static int ClampGroundItemVolumeCount(ConfigEntry entry, int fallback) { return Mathf.Clamp(entry?.Value ?? fallback, 0, 20); } private void BindConfig() { moduleNameInfo = BindReadOnlyInfo("模组名称", "商店扩展", "当前模组的中文名称。此处只是提示,不影响功能。", 1000); moduleVersionInfo = BindReadOnlyInfo("模组版本号", "1.0.2", "当前模组版本号。此处只是提示,不影响功能。", 990); modEnabled = ((BaseUnityPlugin)this).Config.Bind("A.全局设置", "模组启用", true, ConfigDescriptionWithOrder("关闭后整个模组所有功能都不生效。默认开启。", 1005)); int fallback = ReadIntConfigValue(((BaseUnityPlugin)this).Config.ConfigFilePath, "B.刷物和免单", "系统商店倍率", 1, 1, 3); fallback = ReadIntConfigValue(((BaseUnityPlugin)this).Config.ConfigFilePath, "B.刷物和免单", "物品刷出倍率", fallback, 1, 3); bool flag = ReadRandomFreeItemDefault(((BaseUnityPlugin)this).Config.ConfigFilePath); shopItemFeaturesEnabled = ((BaseUnityPlugin)this).Config.Bind("B.刷物和免单", "启用刷物和免单", true, ConfigDescriptionWithOrder("总开关:关闭后系统商店倍率按1倍处理,免单1件10k以内商品也不生效。默认开启。", 1000)); itemSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind("B.刷物和免单", "系统商店倍率", fallback, ConfigDescriptionWithOrder("只调整官方/原版商店刷物倍率,不影响 C.地面补货。1倍为原版,最多3倍。默认1倍。", (AcceptableValueBase)(object)new AcceptableValueRange(1, 3), 995)); randomFreeItemEnabled = ((BaseUnityPlugin)this).Config.Bind("B.刷物和免单", "免单1件10k以内商品", flag, ConfigDescriptionWithOrder("开启后每次进入商店会随机挑选一件价格不高于10k的商店商品直接改成0元,并显示明显提示。默认开启。", 990)); groundItemPacksEnabled = ((BaseUnityPlugin)this).Config.Bind("C.地面补货", "启用地面补货", true, ConfigDescriptionWithOrder("开启后独立在商店地面生成补货物品,不受 B.刷物和免单/系统商店倍率影响;关闭后完全不生成。默认开启。", 985)); groundItemPackCount = ((BaseUnityPlugin)this).Config.Bind("C.地面补货", "地面补货套数", 2, ConfigDescriptionWithOrder("每1套按配置分类数量生成一堆地面补货。最多3套。默认2套。", (AcceptableValueBase)(object)new AcceptableValueRange(1, 3), 980)); groundUpgradeItemCount = BindGroundVolumeCount("升级药水数量", 20, "每套地面补货生成多少个升级药水/升级道具刷点。0为不生成,最多20。", 979); groundSmallItemCount = BindGroundVolumeCount("小型物品数量", 10, "每套地面补货生成多少个 small 小型物品刷点。0为不生成,最多20。", 978); groundMediumItemCount = BindGroundVolumeCount("中型物品数量", 10, "每套地面补货生成多少个 medium 中型物品刷点。0为不生成,最多20。", 977); groundPowerCrystalCount = BindGroundVolumeCount("能量水晶数量", 3, "每套地面补货生成多少个 power_crystal 能量水晶刷点。0为不生成,最多20。", 976); groundLargeHighItemCount = BindGroundVolumeCount("高大型物品数量", 2, "每套地面补货生成多少个 large_high 高大型物品刷点。0为不生成,最多20。", 975); groundHealthPackCount = BindGroundVolumeCount("医疗包数量", 5, "每套地面补货生成多少个 healthPack 医疗包/血包刷点。0为不生成,最多20。", 974); groundLargeItemCount = BindGroundVolumeCount("大型物品数量", 0, "每套地面补货生成多少个 large 大型物品刷点。0为不生成,最多20。", 973); groundLargeWideItemCount = BindGroundVolumeCount("宽大型物品数量", 0, "每套地面补货生成多少个 large_wide 宽大型物品刷点。0为不生成,最多20。", 972); groundLargePlusItemCount = BindGroundVolumeCount("超大型物品数量", 0, "每套地面补货生成多少个 large_plus 超大型物品刷点。0为不生成,最多20。", 971); debugGroundPackMarkers = ((BaseUnityPlugin)this).Config.Bind("D.调试选项", "显示地面补货标记", false, ConfigDescriptionWithOrder("开启后地面补货物品上方会显示蓝色分类标签(用于调试)。默认关闭。", 900)); UpdateLoadedConfigWriteTime(); } private ConfigEntry BindGroundVolumeCount(string key, int defaultValue, string description, int order) { return ((BaseUnityPlugin)this).Config.Bind("C.地面补货", key, defaultValue, ConfigDescriptionWithOrder(description, (AcceptableValueBase)(object)new AcceptableValueRange(0, 20), order)); } private void ResetConfigIfVersionChanged() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; string text = ReadConfigPluginVersion(configFilePath); if (!string.IsNullOrWhiteSpace(text) && !(text == "1.0.2")) { ResetConfigFileToDefaults(configFilePath); ((BaseUnityPlugin)this).Logger.LogWarning((object)"Config version changed. Old config was reset to defaults."); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to reset config by version: " + ex.Message)); } } private void ReloadRuntimeConfigForNextShop() { try { if (lastRuntimeConfigReloadFrame != Time.frameCount) { lastRuntimeConfigReloadFrame = Time.frameCount; string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; DateTime dateTime = (File.Exists(configFilePath) ? File.GetLastWriteTimeUtc(configFilePath) : DateTime.MinValue); ((BaseUnityPlugin)this).Config.Reload(); lastLoadedConfigWriteTimeUtc = dateTime; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Config reloaded for shop generation. fileTimeUtc={dateTime:O}"); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to reload config for next shop: " + ex.Message)); } } private static string ReadConfigPluginVersion(string configPath) { if (!File.Exists(configPath)) { return null; } Match match = Regex.Match(File.ReadAllText(configPath), "(?m)^模组版本号\\s*=\\s*(.+?)\\s*$"); if (!match.Success) { return null; } return match.Groups[1].Value.Trim(); } private static bool ReadBoolConfigValue(string configPath, string section, string key, bool fallback) { if (!TryReadConfigValue(configPath, section, key, out var value) || !bool.TryParse(value, out var result)) { return fallback; } return result; } private static bool ReadRandomFreeItemDefault(string configPath) { return ReadBoolConfigValue(configPath, "B.刷物和免单", "免单1件10k以内商品", ReadBoolConfigValue(configPath, "B.刷物和免单", "十元内随机免单", ReadBoolConfigValue(configPath, "A.全局设置", "十元内随机免单", fallback: true))); } private static int ReadIntConfigValue(string configPath, string section, string key, int fallback, int min, int max) { if (!TryReadConfigValue(configPath, section, key, out var value) || !int.TryParse(value, out var result)) { return fallback; } return Mathf.Clamp(result, min, max); } private static bool TryReadConfigValue(string configPath, string section, string key, out string value) { value = null; if (!File.Exists(configPath)) { return false; } string text = null; string[] array = File.ReadAllLines(configPath); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.Length == 0 || text2.StartsWith("#", StringComparison.Ordinal)) { continue; } if (text2.StartsWith("[", StringComparison.Ordinal) && text2.EndsWith("]", StringComparison.Ordinal)) { text = text2.Substring(1, text2.Length - 2); } else if (!(text != section)) { int num = text2.IndexOf('='); if (num >= 0 && !(text2.Substring(0, num).Trim() != key)) { value = text2.Substring(num + 1).Trim(); return true; } } } return false; } private void ResetConfigFileToDefaults(string configPath) { ((BaseUnityPlugin)this).Config.Clear(); if (File.Exists(configPath)) { File.Delete(configPath); } ((BaseUnityPlugin)this).Config.Reload(); } private void UpdateLoadedConfigWriteTime() { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; lastLoadedConfigWriteTimeUtc = (File.Exists(configFilePath) ? File.GetLastWriteTimeUtc(configFilePath) : DateTime.MinValue); } private static ConfigDescription ConfigDescriptionWithOrder(string description, int order) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } private static ConfigDescription ConfigDescriptionWithOrder(string description, AcceptableValueBase acceptableValues, int order) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, acceptableValues, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } private ConfigEntry BindReadOnlyInfo(string key, string value, string description, int order) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown ConfigEntry obj = ((BaseUnityPlugin)this).Config.Bind("模组信息", key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = order, CustomDrawer = DrawInfo, ReadOnly = true } })); obj.Value = value; return obj; } private static void DrawInfo(ConfigEntryBase entry) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.Label(entry.BoxedValue?.ToString() ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); GUILayout.EndHorizontal(); } private bool IsDebugShelfRuntimeEnabled() { return false; } private bool IsDebugShelfPanelRuntimeEnabled() { return false; } private static bool IsStaticDebugShelfEnabled() { ShopPlusPlugin instance = Instance; if ((Object)(object)instance != (Object)null) { return instance.IsDebugShelfRuntimeEnabled(); } return false; } private static bool IsStaticDebugShelfPanelEnabled() { ShopPlusPlugin instance = Instance; if ((Object)(object)instance != (Object)null) { return instance.IsDebugShelfPanelRuntimeEnabled(); } return false; } private void UpdateDebugShelfRuntime() { if (!SemiFunc.RunIsShop() || !IsDebugShelfRuntimeEnabled()) { RestoreDebugShelfCursorState(); debugShelfPanelVisible = false; if ((Object)(object)debugShelfInstance != (Object)null || (Object)(object)debugShelfSecondaryInstance != (Object)null) { DestroyDebugShelfInstances("left shop or feature disabled"); } return; } if (IsDebugShelfPanelRuntimeEnabled() && Input.GetKeyDown((KeyCode)282)) { debugShelfPanelVisible = !debugShelfPanelVisible; if (debugShelfPanelVisible) { CenterDebugShelfWindow(); CaptureDebugShelfCursorStateIfNeeded(); } else { RestoreDebugShelfCursorState(); } if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)string.Format("[ShelfDebug] Panel toggled {0} by key {1}.", debugShelfPanelVisible ? "open" : "closed", (object)(KeyCode)282)); } } if (debugShelfPanelVisible) { ForceDebugShelfCursorUnlocked(); } if ((Object)(object)debugShelfInstance == (Object)null) { EnsureDebugShelfSpawnedForCurrentShop(); } else if (!debugShelfInstance.activeInHierarchy) { DestroyDebugShelfInstances("debug shelf instance became inactive"); } } private static void EnsureDebugShelfSpawnedForCurrentShop() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticDebugShelfEnabled() || !SemiFunc.RunIsShop()) { return; } UpdateDebugShelfContext(); if ((Object)(object)debugShelfInstance != (Object)null && debugShelfCurrentShopKey == BuildCurrentDebugShelfShopKey()) { return; } if (!TryLoadDebugShelfPrefab(out var failureReason)) { debugShelfLastError = failureReason; ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[ShelfDebug] " + failureReason)); return; } debugShelfCurrentShopKey = BuildCurrentDebugShelfShopKey(); DestroyDebugShelfInstances(null); if (!TryGetDebugShelfAnchor(out var anchorPosition, out var anchorRotation, out var anchorName)) { anchorPosition = Vector3.zero; anchorRotation = Quaternion.identity; anchorName = "FallbackOrigin"; } debugShelfAnchorPosition = anchorPosition; debugShelfAnchorRotation = anchorRotation; debugShelfAnchorName = anchorName; Vector3 position = anchorPosition; Vector3 val = Vector3.one; float num = NormalizeYaw(((Quaternion)(ref anchorRotation)).eulerAngles.y); debugShelfHasSavedPlacement = TryGetSavedDebugShelfPlacement("custom_soda_shelf", debugShelfCurrentShopKey, out var placement); if (debugShelfHasSavedPlacement && placement != null) { position = placement.position; val = ValidateDebugShelfScale(placement.scale); num = NormalizeYaw(placement.yaw); } debugShelfInstance = Object.Instantiate(debugShelfPrefab); ((Object)debugShelfInstance).name = "ShopPlus_DebugShelf"; PrepareDebugShelfVisualOnly(debugShelfInstance); ApplyDebugShelfTransform(position, num, val); EnsureSecondaryDebugShelfSpawned(anchorPosition, anchorRotation); debugShelfLastError = string.Empty; debugShelfSelectedModelId = "custom_soda_shelf"; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)string.Format("[ShelfDebug] Spawned custom shelf for shopKey={0}, level={1}, narrative={2}, anchor={3}{4}, position={5}, yaw={6:F1}, scale={7}, bundle={8}, savedPlacement={9}, toggleKey={10}.", debugShelfCurrentShopKey, debugShelfCurrentLevelName, debugShelfCurrentNarrativeName, debugShelfAnchorName, FormatVector3(debugShelfAnchorPosition), FormatVector3(position), num, FormatVector3(val), debugShelfResolvedBundlePath, debugShelfHasSavedPlacement ? "yes" : "no", (object)(KeyCode)282)); } private static void PrepareDebugShelfVisualOnly(GameObject instance) { if ((Object)(object)instance == (Object)null) { return; } int num = 0; ItemVolume[] componentsInChildren = instance.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null)) { ((Behaviour)componentsInChildren[i]).enabled = false; num++; } } int num2 = 0; Collider[] componentsInChildren2 = instance.GetComponentsInChildren(true); foreach (Collider val in componentsInChildren2) { if (!((Object)(object)val == (Object)null) && !val.isTrigger) { val.isTrigger = true; num2++; } } Rigidbody[] componentsInChildren3 = instance.GetComponentsInChildren(true); foreach (Rigidbody val2 in componentsInChildren3) { if (!((Object)(object)val2 == (Object)null)) { val2.isKinematic = true; val2.useGravity = false; } } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"[ShelfDebug] Prepared debug shelf as visual-only model. disabledItemVolumes={num}, triggerColliders={num2}, rigidbodies={componentsInChildren3.Length}."); } private static bool TryLoadDebugShelfPrefab(out string failureReason) { failureReason = null; if ((Object)(object)debugShelfPrefab != (Object)null) { return true; } string text = ResolveDebugShelfBundlePath(); if (string.IsNullOrEmpty(text)) { failureReason = "Could not find moreshopitems_assets.file. Searched repo local reference path, ShopPlus DLL folder, and installed plugin folders."; return false; } if ((Object)(object)debugShelfBundle == (Object)null) { debugShelfBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)debugShelfBundle == (Object)null) { failureReason = "Failed to load asset bundle from " + text + "."; return false; } } debugShelfPrefab = debugShelfBundle.LoadAsset("custom_soda_shelf"); if ((Object)(object)debugShelfPrefab == (Object)null) { failureReason = "Asset 'custom_soda_shelf' was not found in bundle " + text + "."; return false; } debugShelfResolvedBundlePath = text; return true; } private static string ResolveDebugShelfBundlePath() { if (!string.IsNullOrEmpty(debugShelfResolvedBundlePath) && File.Exists(debugShelfResolvedBundlePath)) { return debugShelfResolvedBundlePath; } if (File.Exists(RepoLocalMoreShopItemsBundlePath)) { debugShelfResolvedBundlePath = RepoLocalMoreShopItemsBundlePath; return debugShelfResolvedBundlePath; } string text = (((Object)(object)Instance != (Object)null) ? Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? string.Empty, "moreshopitems_assets.file") : string.Empty); if (!string.IsNullOrEmpty(text) && File.Exists(text)) { debugShelfResolvedBundlePath = text; return debugShelfResolvedBundlePath; } try { string[] files = Directory.GetFiles(Paths.PluginPath, "moreshopitems_assets.file", SearchOption.AllDirectories); foreach (string text2 in files) { if (text2.IndexOf("MoreShopItems", StringComparison.OrdinalIgnoreCase) >= 0) { debugShelfResolvedBundlePath = text2; return debugShelfResolvedBundlePath; } } if (files.Length != 0) { debugShelfResolvedBundlePath = files[0]; return debugShelfResolvedBundlePath; } } catch (Exception ex) { debugShelfLastError = "Failed to search plugin folders for debug shelf bundle: " + ex.Message; } return string.Empty; } private static void UpdateDebugShelfContext() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) debugShelfCurrentLevelName = (((Object)(object)RunManager.instance != (Object)null && (Object)(object)RunManager.instance.levelCurrent != (Object)null) ? ((Object)RunManager.instance.levelCurrent).name : string.Empty); debugShelfCurrentNarrativeName = (((Object)(object)RunManager.instance != (Object)null && (Object)(object)RunManager.instance.levelCurrent != (Object)null) ? RunManager.instance.levelCurrent.NarrativeName : string.Empty); debugShelfCurrentResourcePath = (SemiFunc.RunIsShop() ? "Shop" : string.Empty); Scene activeScene = SceneManager.GetActiveScene(); debugShelfCurrentSceneName = ((Scene)(ref activeScene)).name; } private static string BuildCurrentDebugShelfShopKey() { UpdateDebugShelfContext(); if (!string.IsNullOrWhiteSpace(debugShelfCurrentLevelName)) { return debugShelfCurrentLevelName; } return "UnknownShopLevel"; } private static bool TryGetDebugShelfAnchor(out Vector3 anchorPosition, out Quaternion anchorRotation, out string anchorName) { //IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < DebugShelfAnchorCandidates.Length; i++) { string text = DebugShelfAnchorCandidates[i]; GameObject val = GameObject.Find(text); if (!((Object)(object)val == (Object)null)) { anchorPosition = val.transform.position; anchorRotation = ResolveAnchorRotation(text, val.transform.rotation); anchorName = text; return true; } } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance != (Object)null) { Vector3 forward = ((Component)instance).transform.forward; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = Vector3.forward; } anchorPosition = ((Component)instance).transform.position + ((Vector3)(ref forward)).normalized * 2f; anchorRotation = Quaternion.Euler(0f, NormalizeYaw(((Component)instance).transform.eulerAngles.y + 180f), 0f); anchorName = "PlayerSpawnFallback"; return true; } if ((Object)(object)ShopManager.instance != (Object)null && (Object)(object)ShopManager.instance.extractionPoint != (Object)null) { anchorPosition = ShopManager.instance.extractionPoint.position + Vector3.forward * 2f; anchorRotation = Quaternion.identity; anchorName = "ExtractionFallback"; return true; } anchorPosition = Vector3.zero; anchorRotation = Quaternion.identity; anchorName = "OriginFallback"; return true; } private static Quaternion ResolveAnchorRotation(string anchorName, Quaternion baseRotation) { //IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) switch (anchorName) { case "Shop Magazine Stand (1)": case "Shop Magazine Stand": return baseRotation * Quaternion.Euler(0f, 90f, 0f); case "Soda Machine (1)": return Quaternion.Euler(0f, 90f, 0f); case "cashiers shelf": return baseRotation * Quaternion.Euler(0f, 180f, 0f); default: return baseRotation; } } private static void EnsureSecondaryDebugShelfSpawned(Vector3 anchorPosition, Quaternion anchorRotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)debugShelfSecondaryInstance != (Object)null)) { Vector3 position = anchorPosition + new Vector3(2.5f, 0f, 0f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(1.5f, 2f, 0.75f); float num = NormalizeYaw(((Quaternion)(ref anchorRotation)).eulerAngles.y); if (TryGetSavedDebugShelfPlacement("gouwujia_fbx", debugShelfCurrentShopKey, out var placement) && placement != null) { position = placement.position; val = ValidateDebugShelfScale(placement.scale); num = NormalizeYaw(placement.yaw); } debugShelfSecondaryInstance = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)debugShelfSecondaryInstance).name = "ShopPlus_DebugShelf_UserFbxPlaceholder"; Renderer component = debugShelfSecondaryInstance.GetComponent(); if ((Object)(object)component != (Object)null) { component.material.color = new Color(0.35f, 0.85f, 1f, 0.9f); } PrepareDebugShelfVisualOnly(debugShelfSecondaryInstance); ApplyDebugShelfTransformForInstance(debugShelfSecondaryInstance, position, num, val); debugShelfSecondaryStatus = "FBX 运行时无法直接加载,当前使用占位体。请后续把 gouwujia.fbx 转成 AssetBundle 或 PrefabBundle。"; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)string.Format("[ShelfDebug] Spawned secondary placeholder for {0}: position={1}, yaw={2:F1}, scale={3}.", "gouwujia.fbx", FormatVector3(position), num, FormatVector3(val))); } } private static void DestroyDebugShelfInstances(string reason) { if ((Object)(object)debugShelfInstance != (Object)null) { Object.Destroy((Object)(object)debugShelfInstance); debugShelfInstance = null; } if ((Object)(object)debugShelfSecondaryInstance != (Object)null) { Object.Destroy((Object)(object)debugShelfSecondaryInstance); debugShelfSecondaryInstance = null; } if (!string.IsNullOrEmpty(reason) && (Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[ShelfDebug] Destroyed debug shelf instances: " + reason)); } } private static GameObject GetSelectedDebugShelfInstance() { if (!(debugShelfSelectedModelId == "gouwujia_fbx")) { return debugShelfInstance; } return debugShelfSecondaryInstance; } private static string GetSelectedDebugShelfPrefabName() { if (!(debugShelfSelectedModelId == "gouwujia_fbx")) { return "custom_soda_shelf"; } return "gouwujia.fbx"; } private bool ShouldDrawDebugShelfPanel() { if (IsDebugShelfPanelRuntimeEnabled() && SemiFunc.RunIsShop()) { return debugShelfPanelVisible; } return false; } private void DrawDebugShelfPanel() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: 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) EnsureDebugShelfGuiStyles(); debugShelfWindowRect = GUI.Window(381126, debugShelfWindowRect, new WindowFunction(DrawDebugShelfWindowContents), "ShopPlus 货架调试"); } private void DrawDebugShelfWindowContents(int windowId) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty()); GUILayout.Label("图名: " + GetDebugShelfDisplayName(), debugShelfHeaderStyle, Array.Empty()); GUILayout.Label($"按 {(object)(KeyCode)282} 可显示/隐藏面板", debugShelfInfoStyle, Array.Empty()); GUILayout.Label("ShopKey: " + BuildCurrentDebugShelfShopKey(), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("Scene: " + debugShelfCurrentSceneName, debugShelfInfoStyle, Array.Empty()); GUILayout.Label("当前模型: " + GetSelectedDebugShelfPrefabName(), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("Anchor: " + debugShelfAnchorName + " " + FormatVector3(debugShelfAnchorPosition), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("Bundle: " + (string.IsNullOrEmpty(debugShelfResolvedBundlePath) ? "未解析" : debugShelfResolvedBundlePath), debugShelfInfoStyle, Array.Empty()); if (!string.IsNullOrEmpty(debugShelfSecondaryStatus)) { GUILayout.Label("用户模型状态: " + debugShelfSecondaryStatus, debugShelfInfoStyle, Array.Empty()); } if (!string.IsNullOrEmpty(debugShelfLastError)) { GUILayout.Space(4f); GUILayout.Label("错误: " + debugShelfLastError, debugShelfInfoStyle, Array.Empty()); } GUILayout.Space(6f); if ((Object)(object)debugShelfInstance == (Object)null) { GUILayout.Label("当前还没有生成调试货架。", debugShelfInfoStyle, Array.Empty()); if (GUILayout.Button("重新加载并生成", Array.Empty())) { EnsureDebugShelfSpawnedForCurrentShop(); } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f)); return; } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("选中货架A", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { debugShelfSelectedModelId = "custom_soda_shelf"; } if (GUILayout.Button("选中货架B", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { debugShelfSelectedModelId = "gouwujia_fbx"; } GUILayout.EndHorizontal(); DrawDebugShelfVectorRow("X", Vector3.right); DrawDebugShelfVectorRow("Y", Vector3.up); DrawDebugShelfVectorRow("Z", Vector3.forward); DrawDebugShelfScaleRow(); DrawDebugShelfYawRow(); GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); GUILayout.Label("当前坐标: " + (((Object)(object)selectedDebugShelfInstance != (Object)null) ? FormatVector3(selectedDebugShelfInstance.transform.position) : "未生成"), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("当前缩放: " + (((Object)(object)selectedDebugShelfInstance != (Object)null) ? FormatVector3(selectedDebugShelfInstance.transform.localScale) : "未生成"), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("当前旋转Y: " + (((Object)(object)selectedDebugShelfInstance != (Object)null) ? NormalizeYaw(selectedDebugShelfInstance.transform.eulerAngles.y).ToString("F1") : "未生成"), debugShelfInfoStyle, Array.Empty()); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button($"位移步长 {DebugShelfMoveSteps[debugShelfMoveStepIndex]:F2}", Array.Empty())) { debugShelfMoveStepIndex = (debugShelfMoveStepIndex + 1) % DebugShelfMoveSteps.Length; } if (GUILayout.Button($"缩放步长 {DebugShelfScaleSteps[debugShelfScaleStepIndex]:F2}", Array.Empty())) { debugShelfScaleStepIndex = (debugShelfScaleStepIndex + 1) % DebugShelfScaleSteps.Length; } if (GUILayout.Button($"旋转步长 {DebugShelfYawSteps[debugShelfYawStepIndex]:F0}", Array.Empty())) { debugShelfYawStepIndex = (debugShelfYawStepIndex + 1) % DebugShelfYawSteps.Length; } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("重置到锚点", Array.Empty())) { ApplyDebugShelfTransform(debugShelfAnchorPosition, NormalizeYaw(((Quaternion)(ref debugShelfAnchorRotation)).eulerAngles.y), Vector3.one); LogCurrentDebugShelfTransform("ResetToAnchor"); } if (GUILayout.Button("读取已保存", Array.Empty())) { LoadSavedDebugShelfPlacementIntoInstance(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("保存本图坐标", Array.Empty())) { SaveCurrentDebugShelfPlacement(); } if (GUILayout.Button("导出当前到日志", Array.Empty())) { ExportCurrentDebugShelfPlacementToLog(); } GUILayout.EndHorizontal(); GUILayout.Label("本地JSON: " + GetDebugShelfPlacementFilePath(), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("当前状态JSON: " + GetDebugShelfLiveStateFilePath(), debugShelfInfoStyle, Array.Empty()); GUILayout.Label("已保存坐标: " + (debugShelfHasSavedPlacement ? "有" : "无"), debugShelfInfoStyle, Array.Empty()); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f)); } private void DrawDebugShelfVectorRow(string axisLabel, Vector3 axis) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { Vector3 position = selectedDebugShelfInstance.transform.position; float num = DebugShelfMoveSteps[debugShelfMoveStepIndex]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"{axisLabel}: {GetAxisValue(position, axis):F2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) }); if (GUILayout.Button(axisLabel + "-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { Transform transform = selectedDebugShelfInstance.transform; transform.position -= axis * num; LogCurrentDebugShelfTransform("Adjust " + axisLabel + "-"); } if (GUILayout.Button(axisLabel + "+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { Transform transform2 = selectedDebugShelfInstance.transform; transform2.position += axis * num; LogCurrentDebugShelfTransform("Adjust " + axisLabel + "+"); } float num2 = num * 0.1f; if (GUILayout.Button(axisLabel + "--", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { Transform transform3 = selectedDebugShelfInstance.transform; transform3.position -= axis * num2; LogCurrentDebugShelfTransform("FineAdjust " + axisLabel + "-"); } if (GUILayout.Button(axisLabel + "++", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { Transform transform4 = selectedDebugShelfInstance.transform; transform4.position += axis * num2; LogCurrentDebugShelfTransform("FineAdjust " + axisLabel + "+"); } GUILayout.EndHorizontal(); } } private void DrawDebugShelfScaleRow() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { Vector3 localScale = selectedDebugShelfInstance.transform.localScale; float num = DebugShelfScaleSteps[debugShelfScaleStepIndex]; float num2 = num * 0.1f; float x = localScale.x; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Scale: {x:F2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) }); if (GUILayout.Button("缩小", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { SetDebugShelfUniformScale(x - num); } if (GUILayout.Button("放大", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { SetDebugShelfUniformScale(x + num); } if (GUILayout.Button("默认大小", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(92f) })) { SetDebugShelfUniformScale(1f); } if (GUILayout.Button("细缩", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { SetDebugShelfUniformScale(x - num2); } if (GUILayout.Button("细放", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { SetDebugShelfUniformScale(x + num2); } GUILayout.EndHorizontal(); } } private void DrawDebugShelfYawRow() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { float num = NormalizeYaw(selectedDebugShelfInstance.transform.eulerAngles.y); float num2 = DebugShelfYawSteps[debugShelfYawStepIndex]; float num3 = num2 * 0.1f; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Yaw: {num:F1}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) }); if (GUILayout.Button("左转", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { SetDebugShelfYaw(num - num2); } if (GUILayout.Button("右转", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { SetDebugShelfYaw(num + num2); } if (GUILayout.Button("微左", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { SetDebugShelfYaw(num - num3); } if (GUILayout.Button("微右", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { SetDebugShelfYaw(num + num3); } GUILayout.EndHorizontal(); } } private static void SetDebugShelfUniformScale(float newScale) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { float num = Mathf.Clamp(newScale, 0.25f, 3.5f); selectedDebugShelfInstance.transform.localScale = new Vector3(num, num, num); LogCurrentDebugShelfTransform("Adjust Scale"); } } private static void SetDebugShelfYaw(float yaw) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { selectedDebugShelfInstance.transform.rotation = Quaternion.Euler(0f, NormalizeYaw(yaw), 0f); LogCurrentDebugShelfTransform("Adjust Yaw"); } } private static float NormalizeYaw(float yaw) { while (yaw < 0f) { yaw += 360f; } while (yaw >= 360f) { yaw -= 360f; } return yaw; } private static float GetAxisValue(Vector3 vector, Vector3 axis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (axis == Vector3.right) { return vector.x; } if (axis == Vector3.up) { return vector.y; } return vector.z; } private static Vector3 ValidateDebugShelfScale(Vector3 scale) { //IL_0000: 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) float num = scale.x; if (num <= 0f) { num = 1f; } num = Mathf.Clamp(num, 0.25f, 3.5f); return new Vector3(num, num, num); } private static void ApplyDebugShelfTransform(Vector3 position, float yaw, Vector3 scale) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ApplyDebugShelfTransformForInstance(GetSelectedDebugShelfInstance(), position, yaw, scale); } private static void ApplyDebugShelfTransformForInstance(GameObject instance, Vector3 position, float yaw, Vector3 scale) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)instance == (Object)null)) { instance.transform.position = position; instance.transform.rotation = Quaternion.Euler(0f, NormalizeYaw(yaw), 0f); instance.transform.localScale = ValidateDebugShelfScale(scale); } } private static void LoadSavedDebugShelfPlacementIntoInstance() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); string text = debugShelfSelectedModelId; if (!((Object)(object)selectedDebugShelfInstance == (Object)null)) { if (!TryGetSavedDebugShelfPlacement(text, BuildCurrentDebugShelfShopKey(), out var placement)) { debugShelfHasSavedPlacement = false; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[ShelfDebug] No saved placement found for " + BuildCurrentDebugShelfShopKey() + " model=" + text + ".")); } else { debugShelfHasSavedPlacement = true; ApplyDebugShelfTransformForInstance(selectedDebugShelfInstance, placement.position, placement.yaw, placement.scale); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"[ShelfDebug] Loaded saved placement for {placement.shopKey} model={text}: position={FormatVector3(placement.position)}, yaw={placement.yaw:F1}, scale={FormatVector3(placement.scale)}."); LogCurrentDebugShelfTransform("LoadSavedPlacement"); } } } private static void SaveCurrentDebugShelfPlacement() { if (!((Object)(object)GetSelectedDebugShelfInstance() == (Object)null)) { DebugShelfPlacementRecord record = BuildCurrentDebugShelfPlacementRecord("Saved"); SaveDebugShelfPlacementRecord(record); debugShelfHasSavedPlacement = true; ExportPlacementSummary("Saved", record); } } private static void ExportCurrentDebugShelfPlacementToLog() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GetSelectedDebugShelfInstance() == (Object)null)) { DebugShelfPlacementRecord record = new DebugShelfPlacementRecord { shopKey = BuildCurrentDebugShelfShopKey(), levelName = debugShelfCurrentLevelName, narrativeName = debugShelfCurrentNarrativeName, sceneName = debugShelfCurrentSceneName, resourcePath = debugShelfCurrentResourcePath, prefabName = "custom_soda_shelf", lastAction = "Export", anchorName = debugShelfAnchorName, anchorPosition = debugShelfAnchorPosition, position = debugShelfInstance.transform.position, scale = debugShelfInstance.transform.localScale, yaw = NormalizeYaw(debugShelfInstance.transform.eulerAngles.y), savedAtUtc = DateTime.UtcNow.ToString("O") }; ExportPlacementSummary("Export", record); } } private static void ExportPlacementSummary(string action, DebugShelfPlacementRecord record) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && record != null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"[ShelfDebug{action}] shopKey={record.shopKey}, level={record.levelName}, narrative={record.narrativeName}, scene={record.sceneName}, resourcePath={record.resourcePath}, prefab={record.prefabName}, anchor={record.anchorName}{FormatVector3(record.anchorPosition)}, position={FormatVector3(record.position)}, yaw={record.yaw:F1}, scale={FormatVector3(record.scale)}, jsonFile={GetDebugShelfPlacementFilePath()}."); } } private static void LogCurrentDebugShelfTransform(string action) { if (!((Object)(object)GetSelectedDebugShelfInstance() == (Object)null) && !((Object)(object)Instance == (Object)null)) { DebugShelfPlacementRecord record = BuildCurrentDebugShelfPlacementRecord(action); SaveCurrentDebugShelfLiveState(record); ExportPlacementSummary(action, record); } } private static string GetDebugShelfDisplayName() { if (!string.IsNullOrWhiteSpace(debugShelfCurrentNarrativeName)) { return debugShelfCurrentNarrativeName; } if (!string.IsNullOrWhiteSpace(debugShelfCurrentLevelName)) { return debugShelfCurrentLevelName; } return "未知商店图"; } private static void CaptureDebugShelfCursorStateIfNeeded() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!debugShelfCursorStateCaptured) { debugShelfPreviousCursorVisible = Cursor.visible; debugShelfPreviousCursorLockMode = Cursor.lockState; debugShelfCursorStateCaptured = true; } } private static void ForceDebugShelfCursorUnlocked() { CaptureDebugShelfCursorStateIfNeeded(); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } private static void RestoreDebugShelfCursorState() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (debugShelfCursorStateCaptured) { Cursor.visible = debugShelfPreviousCursorVisible; Cursor.lockState = debugShelfPreviousCursorLockMode; debugShelfCursorStateCaptured = false; } } private static void CenterDebugShelfWindow() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) float num = 460f; float num2 = 420f; float num3 = Mathf.Max(12f, ((float)Screen.width - num) * 0.5f); float num4 = Mathf.Max(12f, ((float)Screen.height - num2) * 0.5f); debugShelfWindowRect = new Rect(num3, num4, num, num2); } private static string GetDebugShelfPlacementFilePath() { return BuildDebugShelfPerLevelFilePath("debug-shelf-placement-", debugShelfSelectedModelId); } private static string GetDebugShelfLiveStateFilePath() { return BuildDebugShelfPerLevelFilePath("debug-shelf-current-", debugShelfSelectedModelId); } private static string BuildDebugShelfPerLevelFilePath(string filePrefix, string modelId) { string path = filePrefix + SanitizeDebugShelfFileKey(BuildCurrentDebugShelfShopKey()) + "__" + SanitizeDebugShelfFileKey(modelId) + ".json"; if (Directory.Exists("D:\\donetProjects\\repo\\Zichen-Mods\\Zichen-ShopPlus")) { return Path.Combine("D:\\donetProjects\\repo\\Zichen-Mods\\Zichen-ShopPlus", path); } string text = (((Object)(object)Instance != (Object)null) ? Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) : null); if (!string.IsNullOrWhiteSpace(text) && Directory.Exists(text)) { return Path.Combine(text, path); } return Path.Combine(Paths.ConfigPath, path); } private static string SanitizeDebugShelfFileKey(string key) { if (string.IsNullOrWhiteSpace(key)) { return "unknown-shop-level"; } char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); char[] array = key.ToCharArray(); for (int i = 0; i < array.Length; i++) { char c = array[i]; if (Array.IndexOf(invalidFileNameChars, c) >= 0) { array[i] = '_'; } else if (char.IsWhiteSpace(c)) { array[i] = '-'; } } return new string(array); } private static void SaveCurrentDebugShelfLiveState(DebugShelfPlacementRecord record) { if (record == null) { return; } try { string contents = JsonUtility.ToJson((object)record, true); File.WriteAllText(GetDebugShelfLiveStateFilePath(), contents); } catch (Exception ex) { debugShelfLastError = "Failed to write current shelf debug JSON: " + ex.Message; if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[ShelfDebug] " + debugShelfLastError)); } } } private static DebugShelfPlacementRecord BuildCurrentDebugShelfPlacementRecord(string action) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) GameObject selectedDebugShelfInstance = GetSelectedDebugShelfInstance(); return new DebugShelfPlacementRecord { shopKey = BuildCurrentDebugShelfShopKey(), levelName = debugShelfCurrentLevelName, narrativeName = debugShelfCurrentNarrativeName, sceneName = debugShelfCurrentSceneName, resourcePath = debugShelfCurrentResourcePath, prefabName = GetSelectedDebugShelfPrefabName(), lastAction = action, anchorName = debugShelfAnchorName, anchorPosition = debugShelfAnchorPosition, position = (((Object)(object)selectedDebugShelfInstance != (Object)null) ? selectedDebugShelfInstance.transform.position : Vector3.zero), scale = (((Object)(object)selectedDebugShelfInstance != (Object)null) ? selectedDebugShelfInstance.transform.localScale : Vector3.one), yaw = (((Object)(object)selectedDebugShelfInstance != (Object)null) ? NormalizeYaw(selectedDebugShelfInstance.transform.eulerAngles.y) : 0f), savedAtUtc = DateTime.UtcNow.ToString("O") }; } private static void SaveDebugShelfPlacementRecord(DebugShelfPlacementRecord record) { if (record == null) { return; } try { string contents = JsonUtility.ToJson((object)record, true); File.WriteAllText(BuildDebugShelfPerLevelFilePath("debug-shelf-placement-", debugShelfSelectedModelId), contents); } catch (Exception ex) { debugShelfLastError = "Failed to write shelf debug placement JSON: " + ex.Message; if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[ShelfDebug] " + debugShelfLastError)); } } } private static bool TryGetSavedDebugShelfPlacement(string modelId, string shopKey, out DebugShelfPlacementRecord placement) { placement = null; string path = BuildDebugShelfPerLevelFilePath("debug-shelf-placement-", modelId); if (string.IsNullOrWhiteSpace(shopKey) || !File.Exists(path)) { return false; } try { string text = File.ReadAllText(path); placement = JsonUtility.FromJson(text); if (placement == null) { return false; } return string.Equals(placement.shopKey, shopKey, StringComparison.OrdinalIgnoreCase); } catch (Exception ex) { debugShelfLastError = "Failed to read shelf debug placement JSON: " + ex.Message; return false; } } private static void EnsureDebugShelfGuiStyles() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) //IL_0031: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b4: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (debugShelfHeaderStyle == null) { debugShelfHeaderStyle = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1, wordWrap = true }; debugShelfHeaderStyle.normal.textColor = Color.white; } if (debugShelfInfoStyle == null) { debugShelfInfoStyle = new GUIStyle(GUI.skin.label) { fontSize = 12, wordWrap = true }; debugShelfInfoStyle.normal.textColor = Color.white; } if (debugShelfBadgeStyle == null) { debugShelfBadgeStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; debugShelfBadgeStyle.normal.textColor = Color.black; } } private bool TryGetDebugShelfLabelRect(out Rect rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) rect = default(Rect); if ((Object)(object)debugShelfInstance == (Object)null || !SemiFunc.RunIsShop()) { return false; } Camera val = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.MainCamera : Camera.main); if ((Object)(object)val == (Object)null) { return false; } Renderer componentInChildren = debugShelfInstance.GetComponentInChildren(); Vector3 val2; if (!((Object)(object)componentInChildren != (Object)null)) { val2 = debugShelfInstance.transform.position + Vector3.up * 2f; } else { Bounds bounds = componentInChildren.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 up = Vector3.up; bounds = componentInChildren.bounds; val2 = center + up * (((Bounds)(ref bounds)).extents.y + 0.25f); } Vector3 val3 = val2; Vector3 val4 = val.WorldToScreenPoint(val3); if (val4.z <= 0f) { return false; } rect = new Rect(val4.x - 86f, (float)Screen.height - val4.y - 22f, 172f, 24f); return true; } private void DrawDebugShelfWorldBadge() { //IL_0010: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) EnsureDebugShelfGuiStyles(); if (TryGetDebugShelfLabelRect(out var rect)) { Color color = GUI.color; GUI.color = new Color(1f, 0.9f, 0.2f, 0.92f); GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; GUI.Label(rect, $"调试货架 [{(object)(KeyCode)282}]", debugShelfBadgeStyle); } } private void ApplyHarmonyPatches() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("zichen.shopplus"); PatchPostfix(typeof(ShopManager), "GetAllItemVolumesInScene", "ShopManagerGetAllVolumesPostfix"); PatchPrefix(typeof(ShopManager), "GetAllItemsFromStatsManager", "ShopManagerGetAllItemsPrefix"); PatchPostfix(typeof(ShopManager), "GetAllItemsFromStatsManager", "ShopManagerGetAllItemsPostfix"); PatchPrefix(typeof(ShopManager), "ShopInitialize", "ShopManagerShopInitializePrefix"); PatchPostfix(typeof(ShopManager), "ShopInitialize", "ShopManagerShopInitializePostfix"); PatchPostfix(typeof(ItemAttributes), "ShowingInfo", "ItemAttributesShowingInfoPostfix"); PatchPostfix(typeof(ExtractionPoint), "CancelExtraction", "ExtractionPointCancelExtractionPostfix"); PatchPostfix(typeof(WorldSpaceUIValue), "Show", "WorldSpaceUIValueShowPhysPostfix", new Type[4] { typeof(PhysGrabObject), typeof(int), typeof(bool), typeof(Vector3) }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ShopPlus Harmony patches applied."); } private void PatchPrefix(Type originalType, string originalName, string patchName) { PatchMethod(originalType, originalName, patchName, prefix: true, null); } private void PatchPostfix(Type originalType, string originalName, string patchName) { PatchMethod(originalType, originalName, patchName, prefix: false, null); } private void PatchPostfix(Type originalType, string originalName, string patchName, Type[] argumentTypes) { PatchMethod(originalType, originalName, patchName, prefix: false, argumentTypes); } private void PatchMethod(Type originalType, string originalName, string patchName, bool prefix, Type[] argumentTypes) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown MethodInfo methodInfo = ((argumentTypes == null) ? AccessTools.Method(originalType, originalName, (Type[])null, (Type[])null) : AccessTools.Method(originalType, originalName, argumentTypes, (Type[])null)); MethodInfo methodInfo2 = AccessTools.Method(typeof(ShopPlusPlugin), patchName, (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to find Harmony patch target: " + originalType?.Name + "." + originalName + " -> " + patchName)); } else { HarmonyMethod val = new HarmonyMethod(methodInfo2); if (prefix) { harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } private static void ShopManagerGetAllItemsPostfix(ShopManager __instance) { if (!ShouldRunMasterShopLogic()) { return; } RestoreSpoofedShopCurrency(__instance); ExpandShopSpawnTargetsToCurrentPools(__instance); int configuredItemSpawnMultiplier = GetConfiguredItemSpawnMultiplier(); if (configuredItemSpawnMultiplier > 1) { MultiplyIntField(ShopManagerItemSpawnTargetAmountField, __instance, configuredItemSpawnMultiplier); MultiplyIntField(ShopManagerItemConsumablesAmountField, __instance, configuredItemSpawnMultiplier); MultiplyIntField(ShopManagerItemUpgradesAmountField, __instance, configuredItemSpawnMultiplier); MultiplyIntField(ShopManagerItemHealthPacksAmountField, __instance, configuredItemSpawnMultiplier); MultiplyItemList(ShopManagerPotentialItemsField, __instance, configuredItemSpawnMultiplier); MultiplyItemList(ShopManagerPotentialItemConsumablesField, __instance, configuredItemSpawnMultiplier); MultiplyItemList(ShopManagerPotentialItemUpgradesField, __instance, configuredItemSpawnMultiplier); MultiplyItemList(ShopManagerPotentialItemHealthPacksField, __instance, configuredItemSpawnMultiplier); ShopPlusPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[ItemMultiplier] Applied {configuredItemSpawnMultiplier}x item spawn multiplier."); } } int num = EnforceSingleSpecialShopItemAcrossShopPools(__instance); if (num > 0) { ShopPlusPlugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"[ItemLimiter] Replaced/removed {num} extra cart/vehicle candidate(s); ShopPlus keeps max 1 big cart, 1 pocket cart, and 1 of each drivable vehicle."); } } } private static void ShopManagerGetAllItemsPrefix() { if (IsStaticModEnabled() && SemiFunc.RunIsShop()) { Instance?.ReloadRuntimeConfigForNextShop(); SpoofShopCurrencyForPoolGeneration(); } } private static void SpoofShopCurrencyForPoolGeneration() { if ((Object)(object)ShopManager.instance == (Object)null || SemiFunc.IsNotMasterClient()) { originalShopCurrency = -1; return; } originalShopCurrency = ShopManager.instance.totalCurrency; ShopManager.instance.totalCurrency = 999999; } private static void RestoreSpoofedShopCurrency(ShopManager shopManager) { if (!((Object)(object)shopManager == (Object)null) && originalShopCurrency >= 0) { shopManager.totalCurrency = originalShopCurrency; originalShopCurrency = -1; } } private static void ExpandShopSpawnTargetsToCurrentPools(ShopManager shopManager) { if (!((Object)(object)shopManager == (Object)null)) { if (ShopManagerPotentialItemConsumablesField?.GetValue(shopManager) is IList list) { shopManager.itemConsumablesAmount = list.Count; } if (ShopManagerPotentialItemUpgradesField?.GetValue(shopManager) is IList list2) { shopManager.itemUpgradesAmount = list2.Count; } if (ShopManagerPotentialItemHealthPacksField?.GetValue(shopManager) is IList list3) { shopManager.itemHealthPacksAmount = list3.Count; } if (ShopManagerPotentialItemsField?.GetValue(shopManager) is IList list4) { shopManager.itemSpawnTargetAmount = list4.Count; } } } private static void MultiplyIntField(FieldInfo field, ShopManager shopManager, int multiplier) { if (field == null || (Object)(object)shopManager == (Object)null) { return; } object value = field.GetValue(shopManager); if (value is int) { int num = (int)value; if (num > 0) { long num2 = (long)num * (long)multiplier; field.SetValue(shopManager, (int)((num2 > int.MaxValue) ? int.MaxValue : num2)); } } } private static void MultiplyItemList(FieldInfo field, ShopManager shopManager, int multiplier) { if (field == null || (Object)(object)shopManager == (Object)null || !(field.GetValue(shopManager) is IList list) || list.Count == 0) { return; } int count = list.Count; for (int i = 1; i < multiplier; i++) { for (int j = 0; j < count; j++) { list.Add(list[j]); } } } private static int EnforceSingleSpecialShopItemAcrossShopPools(ShopManager shopManager) { HashSet allowedItemKeys = new HashSet(); return 0 + LimitSpecialShopItemEntriesInList(ShopManagerPotentialItemsField, shopManager, allowedItemKeys) + LimitSpecialShopItemEntriesInList(ShopManagerPotentialItemConsumablesField, shopManager, allowedItemKeys) + LimitSpecialShopItemEntriesInList(ShopManagerPotentialItemUpgradesField, shopManager, allowedItemKeys) + LimitSpecialShopItemEntriesInList(ShopManagerPotentialItemHealthPacksField, shopManager, allowedItemKeys) + LimitSpecialShopItemEntriesInSecretLists(ShopManagerPotentialSecretItemsField, shopManager, allowedItemKeys); } private static int LimitSpecialShopItemEntriesInList(FieldInfo field, ShopManager shopManager, HashSet allowedItemKeys) { if (field == null || (Object)(object)shopManager == (Object)null) { return 0; } if (!(field.GetValue(shopManager) is IList list) || list.Count == 0) { return 0; } return LimitSpecialShopItemEntriesInIList(list, allowedItemKeys); } private static int LimitSpecialShopItemEntriesInSecretLists(FieldInfo field, ShopManager shopManager, HashSet allowedItemKeys) { if (field == null || (Object)(object)shopManager == (Object)null) { return 0; } if (!(field.GetValue(shopManager) is IDictionary dictionary) || dictionary.Count == 0) { return 0; } int num = 0; foreach (DictionaryEntry item in dictionary) { if (item.Value is IList items) { num += LimitSpecialShopItemEntriesInIList(items, allowedItemKeys); } } return num; } private static int LimitSpecialShopItemEntriesInIList(IList items, HashSet allowedItemKeys) { if (items == null || items.Count == 0) { return 0; } List replacementCandidates = BuildLimitedItemReplacementCandidates(items); int num = 0; for (int num2 = items.Count - 1; num2 >= 0; num2--) { object? obj = items[num2]; Item val = (Item)((obj is Item) ? obj : null); if (val != null) { string specialShopItemLimitKey = GetSpecialShopItemLimitKey(val); if (!string.IsNullOrEmpty(specialShopItemLimitKey) && !allowedItemKeys.Add(specialShopItemLimitKey)) { Item randomLimitedItemReplacement = GetRandomLimitedItemReplacement(replacementCandidates); if ((Object)(object)randomLimitedItemReplacement != (Object)null) { items[num2] = randomLimitedItemReplacement; } else { items.RemoveAt(num2); } num++; } } } return num; } private static List BuildLimitedItemReplacementCandidates(IList items) { List list = limitedItemReplacementCandidatesBuffer; list.Clear(); if (items == null) { return list; } for (int i = 0; i < items.Count; i++) { object? obj = items[i]; Item val = (Item)((obj is Item) ? obj : null); if (val != null && string.IsNullOrEmpty(GetSpecialShopItemLimitKey(val))) { list.Add(val); } } return list; } private static Item GetRandomLimitedItemReplacement(List replacementCandidates) { if (replacementCandidates == null || replacementCandidates.Count == 0) { return null; } return replacementCandidates[Random.Range(0, replacementCandidates.Count)]; } private static string GetSpecialShopItemLimitKey(Item item) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if ((Object)(object)item == (Object)null) { return string.Empty; } if ((int)item.itemType == 2) { return "cart:big"; } if ((int)item.itemType == 12) { return "cart:pocket"; } if ((int)item.itemType != 14) { return string.Empty; } return "vehicle:" + GetItemStableKey(item); } private static string GetItemStableKey(Item item) { if ((Object)(object)item == (Object)null) { return string.Empty; } if (item.prefab != null && !string.IsNullOrEmpty(item.prefab.ResourcePath)) { return item.prefab.ResourcePath; } if (!string.IsNullOrEmpty(((Object)item).name)) { return ((Object)item).name; } if (!string.IsNullOrEmpty(item.itemName)) { return item.itemName; } return string.Empty; } private static string GetItemLogName(Item item) { if ((Object)(object)item == (Object)null) { return "unknown"; } if (!string.IsNullOrEmpty(item.itemName) && !string.IsNullOrEmpty(((Object)item).name)) { return item.itemName + " (" + ((Object)item).name + ")"; } if (!string.IsNullOrEmpty(item.itemName)) { return item.itemName; } return ((Object)item).name; } private static void ShopManagerGetAllVolumesPostfix(ShopManager __instance) { if (ShouldRunMasterShopLogic() && itemVolumeCollectionLogFrame != Time.frameCount && ShopManagerItemVolumesField?.GetValue(__instance) is IList list) { itemVolumeCollectionLogFrame = Time.frameCount; LogGroundPack($"ShopManager collected {list.Count} item volume(s); ShopPlus generated {groundSpawnVolumeObjects.Count} ground-pack root object(s)."); } } private static void ShopManagerShopInitializePrefix() { Instance?.ReloadRuntimeConfigForNextShop(); CleanGroundSpawnVolumes(); Instance?.ResetFreeItemSelectionForShopChange(); ApplyShopPlusItemLimitOverrides(); if (IsStaticModEnabled() && SemiFunc.RunIsShop()) { ShopPlusPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[Config] Shop settings snapshot: itemMultiplier={GetConfiguredItemSpawnMultiplier()}, groundPackEnabled={IsGroundPackEnabled()}, groundPackCount={GetConfiguredGroundPackCount()}, freeItemEnabled={IsStaticRandomFreeItemEnabled()}."); } if (SemiFunc.IsNotMasterClient()) { LogGroundPack("Shop logic skipped on non-master client; waiting for host-generated shop items."); } else if (!IsGroundPackEnabled()) { LogGroundPack("Ground pack skipped: disabled by config."); } else { CreateGroundItemPacks(); } } } private static void CreateGroundItemPacks() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) LogGroundPack("=== CreateGroundItemPacks START ==="); List sceneShopItemVolumes = GetSceneShopItemVolumes(sceneShopVolumeBuffer); LogGroundPack($"Step 1: Found {sceneShopItemVolumes.Count} scene volumes"); if (sceneShopItemVolumes.Count == 0) { LogGroundPack("Ground pack skipped: no original ItemVolume objects found in current shop scene."); return; } List normalShopItemVolumes = GetNormalShopItemVolumes(sceneShopItemVolumes, normalShopVolumeBuffer); List list = ((normalShopItemVolumes.Count > 0) ? normalShopItemVolumes : sceneShopItemVolumes); LogGroundPack($"Step 2: Using {list.Count} template source volumes"); if (!TryGetShopSearchBounds(list, out var bounds)) { LogGroundPack("Ground pack skipped: failed to build shop bounds from original ItemVolume objects."); return; } LogGroundPack("Step 3: Shop bounds = " + FormatBounds(bounds)); Dictionary dictionary = BuildGroundPackCategoryCounts(); LogGroundPack($"Step 4: Category counts config has {dictionary.Count} entries"); if (dictionary.Count == 0) { LogGroundPack("Ground pack skipped: all configured ground item category counts are 0."); return; } List list2 = BuildGroundPackCategoryGroups(dictionary); LogGroundPack($"Step 5: Built {list2.Count} category groups"); if (list2.Count == 0) { LogGroundPack("Ground pack skipped: no valid category groups after filtering zero counts."); return; } list2.Sort((GroundPackCategoryGroup a, GroundPackCategoryGroup b) => GetVolumeTypePriority(b.VolumeType).CompareTo(GetVolumeTypePriority(a.VolumeType))); Transform val = FindShopExtractionTransform(); Vector3 val2 = (((Object)(object)val != (Object)null) ? val.position : ((Bounds)(ref bounds)).center); Vector3 val3 = FindGroundPackSpawnReferencePosition(bounds, val2); float approximateFloorHeight = GetApproximateFloorHeight(bounds, val2); LogGroundPack($"Height calculation: floorHeight={approximateFloorHeight:F2}, shopBounds.min.y={((Bounds)(ref bounds)).min.y:F2}, shopBounds.max.y={((Bounds)(ref bounds)).max.y:F2}, extraction.y={val2.y:F2}"); List list3 = BuildGroundPackPlacements(list2); List list4 = groundPackOccupiedPositionsBuffer; list4.Clear(); AddExistingShopVolumePositions(list, list4); AssignGroundPackCenters(list3, bounds, approximateFloorHeight, val2, val3, list4); int num = 0; int num2 = 0; Dictionary dictionary2 = groundPackCreatedCountsBuffer; dictionary2.Clear(); int num3 = 0; Dictionary dictionary3 = groundPackSkippedCountsBuffer; dictionary3.Clear(); pendingGroundPackSpawnSlots.Clear(); int num4 = 0; foreach (GroundPackPlacement item2 in list3) { num4 += item2.ItemCount; } if (list4.Capacity < num4 + list4.Count) { list4.Capacity = num4 + list4.Count; } if (pendingGroundPackSpawnSlots.Capacity < num4) { pendingGroundPackSpawnSlots.Capacity = num4; } int num5 = GetStableShopSeed(list) + list3.Count * 977; LogGroundPack($"Ground pack category-based layout: groups={list3.Count}, totalSlots={num4}, floorY={approximateFloorHeight:F2}, bounds={FormatBounds(bounds)}, extraction={FormatVector3(val2)}, spawnReference={FormatVector3(val3)}."); for (int i = 0; i < list3.Count; i++) { GroundPackPlacement groundPackPlacement = list3[i]; Vector3 center = groundPackPlacement.Center; LogGroundPack($"Ground pack group {i}: category={groundPackPlacement.VolumeType}, count={groundPackPlacement.ItemCount}, center={FormatVector3(center)}, grid={groundPackPlacement.Columns}x{groundPackPlacement.Rows}, spacing=({groundPackPlacement.SpacingX:F2}, {groundPackPlacement.SpacingZ:F2})."); for (int j = 0; j < groundPackPlacement.ItemCount; j++) { int row = j / groundPackPlacement.Columns; int column = j % groundPackPlacement.Columns; if (!TryResolveGroundSpawnPositionForGroup(GridToWorldPosition(center, column, row, groundPackPlacement.Columns, groundPackPlacement.Rows, groundPackPlacement.SpacingX, groundPackPlacement.SpacingZ), bounds, approximateFloorHeight, val2, list4, groundPackPlacement.VolumeType, out var spawnPosition, out var failureReason, out var usedFallback)) { num3++; AddStringCount(dictionary3, failureReason); continue; } GroundPackSpawnSlot groundPackSpawnSlot = default(GroundPackSpawnSlot); groundPackSpawnSlot.VolumeType = groundPackPlacement.VolumeType; groundPackSpawnSlot.Position = spawnPosition; groundPackSpawnSlot.Rotation = Quaternion.Euler(0f, (float)((num5 + i * 101 + j * 37) % 360), 0f); GroundPackSpawnSlot item = groundPackSpawnSlot; pendingGroundPackSpawnSlots.Add(item); list4.Add(spawnPosition); num++; if (usedFallback) { num2++; } AddVolumeCount(dictionary2, groundPackPlacement.VolumeType); } } if (num == 0) { LogGroundPack("Ground pack prepared 0 valid manual spawn slot(s)."); } else if (groundPackCreateLogFrame != Time.frameCount) { groundPackCreateLogFrame = Time.frameCount; LogGroundPack($"Ground pack prepared {num}/{num4} manual spawn slot(s), typeCounts={FormatVolumeCounts(dictionary2)}."); if (num2 > 0) { LogGroundPack($"Ground pack fallback search relocated {num2} slot(s) to keep them inside the shop and away from extraction."); } if (num3 > 0) { LogGroundPack($"Ground pack skipped {num3} slot(s), reasons={FormatStringCounts(dictionary3)}."); } } } private static GroundPackLayout BuildGroundPackLayout(Bounds shopBounds, int slotsPerSet) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) int configuredGroundPackCount = GetConfiguredGroundPackCount(); Transform val = FindShopExtractionTransform(); Vector3 val2 = (((Object)(object)val != (Object)null) ? val.position : ((Bounds)(ref shopBounds)).center); Vector3 spawnReferencePosition = FindGroundPackSpawnReferencePosition(shopBounds, val2); float approximateFloorHeight = GetApproximateFloorHeight(shopBounds, val2); int num = Mathf.Max(1, Mathf.CeilToInt((float)Mathf.Max(1, slotsPerSet) / 11f)); int totalRows = num * configuredGroundPackCount; float spacingX = ResolveGridSpacing(((Bounds)(ref shopBounds)).size.x, 11); float spacingZ = ResolveGridSpacing(((Bounds)(ref shopBounds)).size.z, num); Vector3 val3 = FindGroundPackCenter(shopBounds, approximateFloorHeight, val2, spawnReferencePosition, 11, num, spacingX, spacingZ); GroundPackLayout result = default(GroundPackLayout); result.PackCount = configuredGroundPackCount; result.SlotsPerSet = slotsPerSet; result.RowsPerSet = num; result.TotalRows = totalRows; result.FloorHeight = approximateFloorHeight; result.SpacingX = spacingX; result.SpacingZ = spacingZ; result.GridCenter = val3; result.PackCenters = FindGroundPackCenters(shopBounds, approximateFloorHeight, val2, spawnReferencePosition, 11, num, spacingX, spacingZ, configuredGroundPackCount, val3); result.ExtractionPosition = val2; result.SpawnReferencePosition = spawnReferencePosition; result.ShopBounds = shopBounds; return result; } private static bool TryCreateGroundPackSpawnSlot(GroundPackLayout layout, int setIndex, int slotIndex, itemVolume volumeType, int seed, List occupiedPositions, out GroundPackSpawnSlot spawnSlot, out string skipReason, out bool usedFallback) { //IL_0014: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) spawnSlot = default(GroundPackSpawnSlot); int row = slotIndex / 11; int column = slotIndex % 11; if (!TryResolveGroundSpawnPosition(GridToWorldPosition(GetGroundPackCenterForSet(layout, setIndex), column, row, 11, layout.RowsPerSet, layout.SpacingX, layout.SpacingZ), layout, occupiedPositions, out var spawnPosition, out var skipReason2, out usedFallback)) { skipReason = skipReason2; return false; } spawnSlot = new GroundPackSpawnSlot { VolumeType = volumeType, Position = spawnPosition, Rotation = Quaternion.Euler(0f, (float)((seed + setIndex * 101 + slotIndex * 37) % 360), 0f) }; occupiedPositions?.Add(spawnPosition); skipReason = null; return true; } private static void SpawnPendingGroundPackItems() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Invalid comparison between Unknown and I4 //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (pendingGroundPackSpawnSlots.Count == 0 || (Object)(object)StatsManager.instance == (Object)null || (Object)(object)ShopManager.instance == (Object)null) { LogGroundPack($"SpawnPendingGroundPackItems skipped: pendingSlots={pendingGroundPackSpawnSlots.Count}, StatsManager={(Object)(object)StatsManager.instance != (Object)null}, ShopManager={(Object)(object)ShopManager.instance != (Object)null}"); return; } LogGroundPack($"=== SpawnPendingGroundPackItems START: {pendingGroundPackSpawnSlots.Count} slots ==="); Dictionary> candidatesByVolume = BuildGroundPackItemCandidates(); Dictionary candidateIndexes = new Dictionary(); Dictionary dictionary = groundPackCreatedCountsBuffer; dictionary.Clear(); Dictionary dictionary2 = groundPackSkippedCountsBuffer; dictionary2.Clear(); Dictionary dictionary3 = groundPackUpgradeItemCountsBuffer; dictionary3.Clear(); int num = 0; int num2 = 0; for (int i = 0; i < pendingGroundPackSpawnSlots.Count; i++) { GroundPackSpawnSlot groundPackSpawnSlot = pendingGroundPackSpawnSlots[i]; if (!TryGetNextGroundPackItem(candidatesByVolume, candidateIndexes, groundPackSpawnSlot.VolumeType, out var item)) { num2++; AddStringCount(dictionary2, "no candidate for " + ((object)(itemVolume)(ref groundPackSpawnSlot.VolumeType)).ToString()); continue; } Quaternion val = ResolveItemSpawnRotation(item, groundPackSpawnSlot.Rotation); GameObject val2 = null; val2 = ((!SemiFunc.IsMultiplayer()) ? Object.Instantiate(item.prefab.Prefab, groundPackSpawnSlot.Position, val) : PhotonNetwork.InstantiateRoomObject(item.prefab.ResourcePath, groundPackSpawnSlot.Position, val, (byte)0, (object[])null)); if ((Object)(object)val2 != (Object)null && IsDebugGroundPackMarkersEnabled()) { MarkGroundPackItem(val2, groundPackSpawnSlot.VolumeType); } num++; AddVolumeCount(dictionary, groundPackSpawnSlot.VolumeType); if ((int)groundPackSpawnSlot.VolumeType == 6) { AddStringCount(dictionary3, GetItemLogName(item)); } } LogGroundPack($"Manual ground pack spawned {num}/{pendingGroundPackSpawnSlots.Count} item(s), typeCounts={FormatVolumeCounts(dictionary)}."); if (dictionary3.Count > 0) { LogGroundPack("Manual ground pack upgrade distribution: " + FormatStringCounts(dictionary3) + "."); } if (num2 > 0) { LogGroundPack($"Manual ground pack skipped {num2} slot(s), reasons={FormatStringCounts(dictionary2)}."); } pendingGroundPackSpawnSlots.Clear(); } private static Dictionary> BuildGroundPackItemCandidates() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Dictionary> dictionary = new Dictionary>(); foreach (Item value2 in StatsManager.instance.itemDictionary.Values) { if (IsGroundPackItemCandidate(value2)) { if (!dictionary.TryGetValue(value2.itemVolume, out var value)) { value = new List(); dictionary[value2.itemVolume] = value; } value.Add(value2); } } foreach (List value3 in dictionary.Values) { ShuffleList(value3); } return dictionary; } private static void ApplyShopPlusItemLimitOverrides() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } int configuredItemSpawnMultiplier = GetConfiguredItemSpawnMultiplier(); int num = (IsGroundPackEnabled() ? GetConfiguredGroundPackCount() : 0); int num2 = 0; foreach (Item value in StatsManager.instance.itemDictionary.Values) { if (TryApplyShopPlusItemLimitOverride(value, configuredItemSpawnMultiplier, num)) { num2++; } } if (num2 > 0) { ShopPlusPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[ItemLimits] Adjusted {num2} item limit(s) to match ShopPlus multiplier={configuredItemSpawnMultiplier} and groundPackSets={num}."); } } } private static bool TryApplyShopPlusItemLimitOverride(Item item, int multiplier, int groundPackCount) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || string.IsNullOrEmpty(((Object)item).name)) { return false; } ShopItemLimitState originalShopItemLimitState = GetOriginalShopItemLimitState(item); int multiplier2 = (((int)item.itemSecretShopType != 0) ? 1 : Mathf.Max(1, multiplier)); int groundPackExtraShopAllowance = GetGroundPackExtraShopAllowance(item, groundPackCount); int num = SafeAdd(SafeMultiply(originalShopItemLimitState.MaxAmountInShop, multiplier2), groundPackExtraShopAllowance); int num2 = Mathf.Max(originalShopItemLimitState.MaxAmount, num); bool flag = !ShouldDisableMaxPurchaseLimitForItem(item) && originalShopItemLimitState.MaxPurchase; int num3 = (flag ? originalShopItemLimitState.MaxPurchaseAmount : 0); if (flag) { num3 = Mathf.Max(originalShopItemLimitState.MaxPurchaseAmount, num); } bool result = item.maxAmountInShop != num || item.maxAmount != num2 || item.maxPurchase != flag || item.maxPurchaseAmount != num3; item.maxAmountInShop = num; item.maxAmount = num2; item.maxPurchase = flag; item.maxPurchaseAmount = num3; return result; } private static ShopItemLimitState GetOriginalShopItemLimitState(Item item) { if ((Object)(object)item == (Object)null) { return default(ShopItemLimitState); } if (!originalShopItemLimitStates.TryGetValue(((Object)item).name, out var value)) { ShopItemLimitState shopItemLimitState = default(ShopItemLimitState); shopItemLimitState.MaxAmountInShop = item.maxAmountInShop; shopItemLimitState.MaxAmount = item.maxAmount; shopItemLimitState.MaxPurchase = item.maxPurchase; shopItemLimitState.MaxPurchaseAmount = item.maxPurchaseAmount; value = shopItemLimitState; originalShopItemLimitStates[((Object)item).name] = value; } return value; } private static int GetGroundPackExtraShopAllowance(Item item, int groundPackCount) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || groundPackCount <= 0) { return 0; } int groundPackPerSetAllowance = GetGroundPackPerSetAllowance(item.itemVolume); if (groundPackPerSetAllowance > 0) { return SafeMultiply(groundPackPerSetAllowance, groundPackCount); } return 0; } private static bool ShouldDisableMaxPurchaseLimitForItem(Item item) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if ((Object)(object)item == (Object)null) { return false; } itemType itemType = item.itemType; if ((int)itemType <= 15) { return true; } return false; } private static int GetGroundPackPerSetAllowance(itemVolume itemVolume) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected I4, but got Unknown ShopPlusPlugin instance = Instance; return (int)itemVolume switch { 0 => ClampGroundItemVolumeCount(instance?.groundSmallItemCount, 10), 1 => ClampGroundItemVolumeCount(instance?.groundMediumItemCount, 10), 2 => ClampGroundItemVolumeCount(instance?.groundLargeItemCount, 0), 3 => ClampGroundItemVolumeCount(instance?.groundLargeWideItemCount, 0), 4 => ClampGroundItemVolumeCount(instance?.groundPowerCrystalCount, 3), 5 => ClampGroundItemVolumeCount(instance?.groundLargeHighItemCount, 2), 6 => ClampGroundItemVolumeCount(instance?.groundUpgradeItemCount, 20), 7 => ClampGroundItemVolumeCount(instance?.groundHealthPackCount, 5), 8 => ClampGroundItemVolumeCount(instance?.groundLargePlusItemCount, 0), _ => 0, }; } private static int SafeMultiply(int value, int multiplier) { if (value <= 0 || multiplier <= 0) { return 0; } long num = (long)value * (long)multiplier; if (num <= int.MaxValue) { return (int)num; } return int.MaxValue; } private static int SafeAdd(int left, int right) { if (left <= 0) { return Mathf.Max(0, right); } if (right <= 0) { return left; } long num = (long)left + (long)right; if (num <= int.MaxValue) { return (int)num; } return int.MaxValue; } private static bool IsGroundPackItemCandidate(Item item) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 if ((Object)(object)item == (Object)null || item.disabled || item.prefab == null || string.IsNullOrEmpty(item.prefab.ResourcePath)) { return false; } if ((int)item.itemSecretShopType != 0) { return false; } if ((int)item.itemType == 2 || (int)item.itemType == 12 || (int)item.itemType == 14) { return false; } if (SemiFunc.StatGetItemsPurchased(((Object)item).name) >= item.maxAmountInShop) { return false; } if (item.maxPurchase && StatsManager.instance.GetItemsUpgradesPurchasedTotal(((Object)item).name) >= item.maxPurchaseAmount) { return false; } if (item.minPlayerCount > 1 && (Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList.Count < item.minPlayerCount) { return false; } return true; } private static float GetShopItemValueMultiplier() { if ((Object)(object)ShopManager.instance == (Object)null || ShopManagerItemValueMultiplierField == null) { return 4f; } object value = ShopManagerItemValueMultiplierField.GetValue(ShopManager.instance); if (value is float) { return (float)value; } return 4f; } private static bool TryGetNextGroundPackItem(Dictionary> candidatesByVolume, Dictionary candidateIndexes, itemVolume volumeType, out Item item) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) item = null; if (!candidatesByVolume.TryGetValue(volumeType, out var value) || value.Count == 0) { return false; } candidateIndexes.TryGetValue(volumeType, out var value2); if (value2 >= value.Count) { ShuffleList(value); value2 = 0; } item = value[value2]; candidateIndexes[volumeType] = value2 + 1; return (Object)(object)item != (Object)null; } private static Quaternion ResolveItemSpawnRotation(Item item, Quaternion slotRotation) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0048: 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) //IL_0056: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || (Object)(object)ShopManager.instance == (Object)null || (Object)(object)ShopManager.instance.itemRotateHelper == (Object)null) { return slotRotation; } Transform transform = ((Component)ShopManager.instance.itemRotateHelper).transform; Transform parent = transform.parent; Quaternion rotation = transform.rotation; transform.rotation = slotRotation; transform.localRotation *= item.spawnRotationOffset; Quaternion rotation2 = transform.rotation; transform.parent = parent; transform.rotation = rotation; return rotation2; } private static void ShuffleList(List list) { if (list != null && list.Count > 1) { for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); T value = list[num]; list[num] = list[index]; list[index] = value; } } } private static List GetNormalShopItemVolumes(List sceneVolumes, List buffer) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) List list = buffer ?? new List(); list.Clear(); for (int i = 0; i < sceneVolumes.Count; i++) { ItemVolume val = sceneVolumes[i]; if ((Object)(object)val != (Object)null && (int)val.itemSecretShopType == 0) { list.Add(val); } } return list; } private static itemVolume[] BuildConfiguredGroundPackTemplate() { ShopPlusPlugin instance = Instance; List list = new List(180); AddTemplateEntries(list, (itemVolume)6, ClampGroundItemVolumeCount(instance?.groundUpgradeItemCount, 20)); AddTemplateEntries(list, (itemVolume)0, ClampGroundItemVolumeCount(instance?.groundSmallItemCount, 10)); AddTemplateEntries(list, (itemVolume)1, ClampGroundItemVolumeCount(instance?.groundMediumItemCount, 10)); AddTemplateEntries(list, (itemVolume)4, ClampGroundItemVolumeCount(instance?.groundPowerCrystalCount, 3)); AddTemplateEntries(list, (itemVolume)5, ClampGroundItemVolumeCount(instance?.groundLargeHighItemCount, 2)); AddTemplateEntries(list, (itemVolume)7, ClampGroundItemVolumeCount(instance?.groundHealthPackCount, 5)); AddTemplateEntries(list, (itemVolume)2, ClampGroundItemVolumeCount(instance?.groundLargeItemCount, 0)); AddTemplateEntries(list, (itemVolume)3, ClampGroundItemVolumeCount(instance?.groundLargeWideItemCount, 0)); AddTemplateEntries(list, (itemVolume)8, ClampGroundItemVolumeCount(instance?.groundLargePlusItemCount, 0)); return list.ToArray(); } private static Dictionary BuildGroundPackCategoryCounts() { ShopPlusPlugin instance = Instance; int configuredGroundPackCount = GetConfiguredGroundPackCount(); Dictionary dictionary = new Dictionary(); AddCategoryCount(dictionary, (itemVolume)6, ClampGroundItemVolumeCount(instance?.groundUpgradeItemCount, 20) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)0, ClampGroundItemVolumeCount(instance?.groundSmallItemCount, 10) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)1, ClampGroundItemVolumeCount(instance?.groundMediumItemCount, 10) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)4, ClampGroundItemVolumeCount(instance?.groundPowerCrystalCount, 3) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)5, ClampGroundItemVolumeCount(instance?.groundLargeHighItemCount, 2) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)7, ClampGroundItemVolumeCount(instance?.groundHealthPackCount, 5) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)2, ClampGroundItemVolumeCount(instance?.groundLargeItemCount, 0) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)3, ClampGroundItemVolumeCount(instance?.groundLargeWideItemCount, 0) * configuredGroundPackCount); AddCategoryCount(dictionary, (itemVolume)8, ClampGroundItemVolumeCount(instance?.groundLargePlusItemCount, 0) * configuredGroundPackCount); return dictionary; } private static void AddCategoryCount(Dictionary counts, itemVolume volumeType, int count) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (count > 0) { counts[volumeType] = count; } } private static List BuildGroundPackCategoryGroups(Dictionary categoryCounts) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (KeyValuePair categoryCount in categoryCounts) { if (categoryCount.Value > 0) { list.Add(new GroundPackCategoryGroup { VolumeType = categoryCount.Key, ItemCount = categoryCount.Value }); } } return list; } private static int CalculateCompactGridColumns(int itemCount) { if (itemCount <= 0) { return 1; } if (itemCount <= 4) { return 2; } if (itemCount <= 9) { return 3; } if (itemCount <= 16) { return 4; } if (itemCount <= 25) { return 5; } if (itemCount <= 36) { return 6; } return 7; } private static int GetVolumeTypePriority(itemVolume volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected I4, but got Unknown return (int)volumeType switch { 8 => 100, 3 => 90, 2 => 80, 5 => 70, 6 => 30, 1 => 20, 7 => 15, 4 => 10, 0 => 5, _ => 0, }; } private static List BuildGroundPackPlacements(List categoryGroups) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) List list = new List(categoryGroups.Count); for (int i = 0; i < categoryGroups.Count; i++) { GroundPackCategoryGroup groundPackCategoryGroup = categoryGroups[i]; int num = CalculateCompactGridColumns(groundPackCategoryGroup.ItemCount); int num2 = Mathf.CeilToInt((float)groundPackCategoryGroup.ItemCount / (float)num); float gridSpacingForVolumeType = GetGridSpacingForVolumeType(groundPackCategoryGroup.VolumeType); float num3 = 0.3f; float halfWidth = (float)(num - 1) * gridSpacingForVolumeType * 0.5f + num3; float halfDepth = (float)(num2 - 1) * gridSpacingForVolumeType * 0.5f + num3; list.Add(new GroundPackPlacement { VolumeType = groundPackCategoryGroup.VolumeType, ItemCount = groundPackCategoryGroup.ItemCount, Center = Vector3.zero, Columns = num, Rows = num2, SpacingX = gridSpacingForVolumeType, SpacingZ = gridSpacingForVolumeType, HalfWidth = halfWidth, HalfDepth = halfDepth }); } return list; } private static void AssignGroundPackCenters(List placements, Bounds shopBounds, float floorHeight, Vector3 extractionPosition, Vector3 spawnReferencePosition, List occupiedPositions) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Vector3 center = ((Bounds)(ref shopBounds)).center; center.y = floorHeight; Vector3 val = Vector3.ProjectOnPlane(center - spawnReferencePosition, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(center - extractionPosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; for (int i = 0; i < placements.Count; i++) { GroundPackPlacement groundPackPlacement = placements[i]; Vector3 position = (groundPackPlacement.Center = FindEmptyAreaForPlacement(groundPackPlacement, shopBounds, floorHeight, extractionPosition, spawnReferencePosition, occupiedPositions, list, val, normalized, center)); placements[i] = groundPackPlacement; list.Add(groundPackPlacement); LogGroundPack($"Assigned center for {groundPackPlacement.VolumeType}: {FormatVector3(position)} (footprint={groundPackPlacement.HalfWidth * 2f:F2}x{groundPackPlacement.HalfDepth * 2f:F2}m)."); } } private static Vector3 FindEmptyAreaForPlacement(GroundPackPlacement placement, Bounds shopBounds, float floorHeight, Vector3 extractionPosition, Vector3 spawnReferencePosition, List occupiedPositions, List selectedPlacements, Vector3 awayFromSpawn, Vector3 side, Vector3 shopCenter) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.6f, Mathf.Max(placement.HalfWidth, placement.HalfDepth) * 0.6f); float num2 = placement.HalfWidth + 0.38f; float num3 = placement.HalfDepth + 0.38f; float num4 = ((Bounds)(ref shopBounds)).min.x + num2; float num5 = ((Bounds)(ref shopBounds)).max.x - num2; float num6 = ((Bounds)(ref shopBounds)).min.z + num3; float num7 = ((Bounds)(ref shopBounds)).max.z - num3; if (num4 > num5 || num6 > num7) { return new Vector3(((Bounds)(ref shopBounds)).center.x, floorHeight, ((Bounds)(ref shopBounds)).center.z); } Vector3 result = default(Vector3); ((Vector3)(ref result))..ctor(((Bounds)(ref shopBounds)).center.x, floorHeight, ((Bounds)(ref shopBounds)).center.z); float num8 = float.MinValue; bool flag = false; Vector3 val = default(Vector3); Vector2 val2 = default(Vector2); Vector2 val3 = default(Vector2); Vector2 val4 = default(Vector2); for (float num9 = num4; num9 <= num5 + 0.01f; num9 += num) { for (float num10 = num6; num10 <= num7 + 0.01f; num10 += num) { ((Vector3)(ref val))..ctor(num9, floorHeight, num10); ((Vector2)(ref val2))..ctor(val.x, val.z); ((Vector2)(ref val3))..ctor(extractionPosition.x, extractionPosition.z); if (Vector2.Distance(val2, val3) < 3.65f + Mathf.Max(placement.HalfWidth, placement.HalfDepth)) { continue; } bool flag2 = false; for (int i = 0; i < selectedPlacements.Count; i++) { if (RectanglesOverlap(val, placement.HalfWidth, placement.HalfDepth, selectedPlacements[i].Center, selectedPlacements[i].HalfWidth, selectedPlacements[i].HalfDepth)) { flag2 = true; break; } } if (flag2) { continue; } int num11 = CountOccupiedInsideRect(val, placement.HalfWidth, placement.HalfDepth, occupiedPositions); float num12 = Vector2.Distance(val2, new Vector2(spawnReferencePosition.x, spawnReferencePosition.z)); float num13 = float.MaxValue; for (int j = 0; j < selectedPlacements.Count; j++) { ((Vector2)(ref val4))..ctor(selectedPlacements[j].Center.x, selectedPlacements[j].Center.z); float num14 = Vector2.Distance(val2, val4); if (num14 < num13) { num13 = num14; } } if (selectedPlacements.Count == 0) { num13 = 0f; } float num15 = num12 * 1f + num13 * 2f - (float)num11 * 5f; if (num15 > num8) { num8 = num15; result = val; flag = true; } } } if (!flag) { return new Vector3(((Bounds)(ref shopBounds)).center.x, floorHeight, ((Bounds)(ref shopBounds)).center.z); } return result; } private static bool RectanglesOverlap(Vector3 centerA, float halfWidthA, float halfDepthA, Vector3 centerB, float halfWidthB, float halfDepthB) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(centerA.x - centerB.x); float num2 = Mathf.Abs(centerA.z - centerB.z); if (num < halfWidthA + halfWidthB) { return num2 < halfDepthA + halfDepthB; } return false; } private static int CountOccupiedInsideRect(Vector3 center, float halfWidth, float halfDepth, List occupiedPositions) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_002e: Unknown result type (might be due to invalid IL or missing references) if (occupiedPositions == null) { return 0; } int num = 0; for (int i = 0; i < occupiedPositions.Count; i++) { Vector3 val = occupiedPositions[i]; if (Mathf.Abs(val.x - center.x) < halfWidth && Mathf.Abs(val.z - center.z) < halfDepth) { num++; } } return num; } private static Vector3[] FindGroundPackGroupCenters(Bounds shopBounds, float floorHeight, Vector3 extractionPosition, Vector3 spawnReferencePosition, int groupCount) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004b: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) if (groupCount <= 0) { return (Vector3[])(object)new Vector3[0]; } Vector3[] array = (Vector3[])(object)new Vector3[groupCount]; Vector3 center = ((Bounds)(ref shopBounds)).center; center.y = floorHeight; Vector3 val = Vector3.ProjectOnPlane(center - spawnReferencePosition, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(center - extractionPosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = ((Bounds)(ref shopBounds)).extents.x * 0.65f; float num2 = ((Bounds)(ref shopBounds)).extents.z * 0.65f; float num3 = ((Bounds)(ref shopBounds)).extents.x * 0.42f; float num4 = ((Bounds)(ref shopBounds)).extents.z * 0.42f; List list = new List(); list.Add(center + val * num2 + normalized * num); list.Add(center + val * num2 - normalized * num); list.Add(center - val * num2 + normalized * num); list.Add(center - val * num2 - normalized * num); list.Add(center + val * num2); list.Add(center - val * num2); list.Add(center + normalized * num); list.Add(center - normalized * num); list.Add(center + val * num4 + normalized * num3); list.Add(center + val * num4 - normalized * num3); list.Add(center - val * num4 + normalized * num3); list.Add(center - val * num4 - normalized * num3); float num5 = 2.5f * 2.5f; List list2 = new List(); Vector2 val5 = default(Vector2); for (int i = 0; i < groupCount; i++) { int num6 = -1; float num7 = float.MinValue; for (int j = 0; j < list.Count; j++) { Vector3 val3 = list[j]; bool flag = false; for (int k = 0; k < list2.Count; k++) { Vector2 val4 = new Vector2(val3.x, val3.z); ((Vector2)(ref val5))..ctor(list2[k].x, list2[k].z); Vector2 val6 = val4 - val5; if (((Vector2)(ref val6)).sqrMagnitude < num5) { flag = true; break; } } if (!flag) { float num8 = Vector2.Distance(new Vector2(val3.x, val3.z), new Vector2(extractionPosition.x, extractionPosition.z)); float num9 = Vector2.Distance(new Vector2(val3.x, val3.z), new Vector2(spawnReferencePosition.x, spawnReferencePosition.z)); float minGroundPackCenterDistance = GetMinGroundPackCenterDistance(val3, list2); float num10 = (float)(list.Count - j) * 0.5f; float num11 = num9 * 1.5f + num8 * 0.3f + minGroundPackCenterDistance * 5f + num10; if (num11 > num7) { num7 = num11; num6 = j; } } } if (num6 < 0) { for (int l = 0; l < list.Count; l++) { float num12 = GetMinGroundPackCenterDistance(list[l], list2) * 10f + (float)(list.Count - l) * 0.5f; if (num12 > num7) { num7 = num12; num6 = l; } } } if (num6 < 0) { num6 = 0; } array[i] = list[num6]; list2.Add(list[num6]); list.RemoveAt(num6); if (list.Count == 0 && i + 1 < groupCount) { list.Add(center); } } return array; } private static bool TryResolveGroundSpawnPositionForGroup(Vector3 targetPosition, Bounds shopBounds, float floorHeight, Vector3 extractionPosition, List occupiedPositions, itemVolume volumeType, out Vector3 spawnPosition, out string failureReason, out bool usedFallback) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) spawnPosition = targetPosition; usedFallback = false; if (TryComputeGroundSpawnY(targetPosition, shopBounds, floorHeight, out var spawnPosition2) && IsGroundSpawnPositionValid(spawnPosition2, shopBounds, extractionPosition, occupiedPositions, volumeType)) { spawnPosition = spawnPosition2; failureReason = null; return true; } float[] array = new float[6] { 0.4f, 0.7f, 1f, 1.4f, 1.8f, 2.2f }; foreach (float num in array) { for (int j = 0; j < GroundPackFallbackAngles.Length; j++) { float num2 = GroundPackFallbackAngles[j] * ((float)Math.PI / 180f); if (TryComputeGroundSpawnY(new Vector3(targetPosition.x + Mathf.Sin(num2) * num, targetPosition.y, targetPosition.z + Mathf.Cos(num2) * num), shopBounds, floorHeight, out var spawnPosition3) && IsGroundSpawnPositionValid(spawnPosition3, shopBounds, extractionPosition, occupiedPositions, volumeType)) { spawnPosition = spawnPosition3; usedFallback = true; failureReason = null; return true; } } } failureReason = "invalid position"; return false; } private static bool TryComputeGroundSpawnY(Vector3 targetPosition, Bounds shopBounds, float floorHeight, out Vector3 spawnPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) spawnPosition = targetPosition; if (!TryGetHighestFloorHit(new Vector3(targetPosition.x, ((Bounds)(ref shopBounds)).max.y + 8f, targetPosition.z), out var floorHit)) { spawnPosition.y = floorHeight + 1.25f; return true; } float num = ((RaycastHit)(ref floorHit)).point.y + 1.25f; if (TryGetLowestCeilingHit(new Vector3(targetPosition.x, num, targetPosition.z), 5f, out var ceilingHit)) { float num2 = ((RaycastHit)(ref ceilingHit)).point.y - 0.55f; spawnPosition.y = Mathf.Max(((RaycastHit)(ref floorHit)).point.y + 0.45f, Mathf.Min(num, num2)); } else { spawnPosition.y = num; } return true; } private static float GetMinDistanceForVolumeType(itemVolume volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown return (volumeType - 2) switch { 6 => 1.2f, 1 => 1f, 0 => 0.8f, 3 => 0.6f, _ => 0.3f, }; } private static float GetGridSpacingForVolumeType(itemVolume volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown return (volumeType - 2) switch { 6 => 1.5f, 1 => 1.2f, 0 => 1f, 3 => 0.7f, _ => 0.35f, }; } private static bool IsGroundSpawnPositionValid(Vector3 position, Bounds shopBounds, Vector3 extractionPosition, List occupiedPositions, itemVolume volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ClampGroundPackTargetToBounds(position, shopBounds); if (Vector3.Distance(position, val) > 0.1f) { return false; } Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(position.x, position.z); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(extractionPosition.x, extractionPosition.z); if (Vector2.Distance(val2, val3) < 3.65f) { return false; } if (occupiedPositions != null && occupiedPositions.Count > 0) { float minDistanceForVolumeType = GetMinDistanceForVolumeType(volumeType); float num = minDistanceForVolumeType * minDistanceForVolumeType; Vector2 val4 = default(Vector2); for (int i = 0; i < occupiedPositions.Count; i++) { ((Vector2)(ref val4))..ctor(occupiedPositions[i].x, occupiedPositions[i].z); Vector2 val5 = val2 - val4; if (((Vector2)(ref val5)).sqrMagnitude < num) { return false; } } } return true; } private static void AddTemplateEntries(List template, itemVolume volumeType, int count) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < count; i++) { template.Add(volumeType); } } private static itemVolume[] CopyGroundPackTemplate(itemVolume[] template) { itemVolume[] array = (itemVolume[])(object)new itemVolume[template.Length]; Array.Copy(template, array, template.Length); return array; } private static List GetSceneShopItemVolumes(List buffer) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) List list = buffer ?? new List(); list.Clear(); ItemVolume[] array = Object.FindObjectsOfType(); foreach (ItemVolume val in array) { if (!((Object)(object)val == (Object)null)) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Component)val).gameObject.activeInHierarchy && !IsShopPlusGeneratedVolume(val)) { list.Add(val); } } } return list; } private static bool IsShopPlusGeneratedVolume(ItemVolume itemVolume) { Transform val = (((Object)(object)itemVolume != (Object)null) ? ((Component)itemVolume).transform : null); while ((Object)(object)val != (Object)null) { if (((Object)val).name.StartsWith("ShopPlus_GroundPack", StringComparison.OrdinalIgnoreCase)) { return true; } val = val.parent; } return false; } private static bool TryGetShopSearchBounds(List volumes, out Bounds bounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) bounds = new Bounds(Vector3.zero, Vector3.zero); bool flag = false; for (int i = 0; i < volumes.Count; i++) { ItemVolume val = volumes[i]; if (!((Object)(object)val == (Object)null)) { Vector3 position = ((Component)val).transform.position; if (!flag) { bounds = new Bounds(position, Vector3.zero); flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(position); } } } if (!flag) { return false; } ((Bounds)(ref bounds)).Expand(new Vector3(1.1f, 1.5f, 1.1f)); return true; } private static Transform FindShopExtractionTransform() { //IL_001d: 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) ExtractionPoint[] array = Object.FindObjectsOfType(); bool flag = default(bool); foreach (ExtractionPoint val in array) { if ((Object)(object)val == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Component)val).gameObject.activeInHierarchy) { if (ExtractionPointIsShopField == null) { return ((Component)val).transform; } object value = ExtractionPointIsShopField.GetValue(val); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return ((Component)val).transform; } } } return null; } private static Vector3 FindGroundPackSpawnReferencePosition(Bounds shopBounds, Vector3 fallbackPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { List playerList = GameDirector.instance.PlayerList; for (int i = 0; i < playerList.Count; i++) { PlayerAvatar val2 = playerList[i]; if (!((Object)(object)val2 == (Object)null) && ((Component)val2).gameObject.activeInHierarchy) { Vector3 position = ((Component)val2).transform.position; if (IsGroundPackReferenceInsideShopArea(position, shopBounds)) { val += position; num++; } } } } if (num > 0) { Vector3 result = val / (float)num; result.y = fallbackPosition.y; return result; } if ((Object)(object)PlayerAvatar.instance != (Object)null) { Vector3 position2 = ((Component)PlayerAvatar.instance).transform.position; if (IsGroundPackReferenceInsideShopArea(position2, shopBounds)) { position2.y = fallbackPosition.y; return position2; } } return fallbackPosition; } private static bool IsGroundPackReferenceInsideShopArea(Vector3 position, Bounds shopBounds) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Bounds val = shopBounds; ((Bounds)(ref val)).Expand(new Vector3(8f, 6f, 8f)); return ((Bounds)(ref val)).Contains(position); } private static float GetApproximateFloorHeight(Bounds shopBounds, Vector3 extractionPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (TryGetHighestFloorHit(new Vector3(extractionPosition.x, ((Bounds)(ref shopBounds)).max.y + 8f, extractionPosition.z), out var floorHit)) { return ((RaycastHit)(ref floorHit)).point.y; } int num = 0; num += TryStoreFloorHeightSample(new Vector3(((Bounds)(ref shopBounds)).center.x, ((Bounds)(ref shopBounds)).max.y + 8f, ((Bounds)(ref shopBounds)).center.z), num); num += TryStoreFloorHeightSample(new Vector3(((Bounds)(ref shopBounds)).min.x, ((Bounds)(ref shopBounds)).max.y + 8f, ((Bounds)(ref shopBounds)).min.z), num); num += TryStoreFloorHeightSample(new Vector3(((Bounds)(ref shopBounds)).max.x, ((Bounds)(ref shopBounds)).max.y + 8f, ((Bounds)(ref shopBounds)).min.z), num); num += TryStoreFloorHeightSample(new Vector3(((Bounds)(ref shopBounds)).min.x, ((Bounds)(ref shopBounds)).max.y + 8f, ((Bounds)(ref shopBounds)).max.z), num); num += TryStoreFloorHeightSample(new Vector3(((Bounds)(ref shopBounds)).max.x, ((Bounds)(ref shopBounds)).max.y + 8f, ((Bounds)(ref shopBounds)).max.z), num); if (num == 0) { return ((Bounds)(ref shopBounds)).min.y; } Array.Sort(groundPackHeightSampleBuffer, 0, num); return groundPackHeightSampleBuffer[num / 2]; } private static int TryStoreFloorHeightSample(Vector3 sampleOrigin, int writeIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!TryGetHighestFloorHit(sampleOrigin, out var floorHit)) { return 0; } groundPackHeightSampleBuffer[writeIndex] = ((RaycastHit)(ref floorHit)).point.y; return 1; } private static float ResolveGridSpacing(float boundsSize, int slotCount) { if (slotCount <= 1) { return 0.62f; } return Mathf.Clamp(Mathf.Max(0.2f, boundsSize - 1.2f) / (float)(slotCount - 1), 0.38f, 0.62f); } private static Vector3 FindGroundPackCenter(Bounds shopBounds, float floorHeight, Vector3 extractionPosition, Vector3 spawnReferencePosition, int columns, int rows, float spacingX, float spacingZ) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref shopBounds)).center.x, floorHeight, ((Bounds)(ref shopBounds)).center.z); Vector3 val2 = Vector3.ProjectOnPlane(val - spawnReferencePosition, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.1f) { val2 = Vector3.ProjectOnPlane(val - extractionPosition, Vector3.up); } if (((Vector3)(ref val2)).sqrMagnitude < 0.1f) { val2 = Vector3.back; } ((Vector3)(ref val2)).Normalize(); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f - val2.z, 0f, val2.x); float num = Mathf.Min(((Bounds)(ref shopBounds)).extents.x, ((Bounds)(ref shopBounds)).extents.z) * 0.38f; float num2 = (float)(columns - 1) * spacingX; float num3 = (float)(rows - 1) * spacingZ; Vector3 best = val; float bestScore = float.MinValue; TrySelectGroundPackCenterCandidate(val + val2 * num, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); Vector3 val4 = val; Vector3 val5 = val2 + val3; TrySelectGroundPackCenterCandidate(val4 + ((Vector3)(ref val5)).normalized * num, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); Vector3 val6 = val; val5 = val2 - val3; TrySelectGroundPackCenterCandidate(val6 + ((Vector3)(ref val5)).normalized * num, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); TrySelectGroundPackCenterCandidate(val + val3 * num, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); TrySelectGroundPackCenterCandidate(val - val3 * num, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); TrySelectGroundPackCenterCandidate(val, floorHeight, val, extractionPosition, spawnReferencePosition, shopBounds, num2, num3, ref best, ref bestScore); if (bestScore == float.MinValue) { LogGroundPack($"Ground pack grid does not fully fit inside bounds at current spacing; using shop center fallback. gridSize=({num2:F2}, {num3:F2}), bounds={FormatBounds(shopBounds)}."); } return best; } private static void TrySelectGroundPackCenterCandidate(Vector3 candidate, float floorHeight, Vector3 center, Vector3 extractionPosition, Vector3 spawnReferencePosition, Bounds shopBounds, float gridWidth, float gridDepth, ref Vector3 best, ref float bestScore) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0023: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) candidate.y = floorHeight; if (GridFitsBounds(candidate, shopBounds, gridWidth, gridDepth)) { float num = Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(extractionPosition.x, extractionPosition.z)); float num2 = Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(spawnReferencePosition.x, spawnReferencePosition.z)); float num3 = Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(center.x, center.z)) * 0.15f; float num4 = num2 * 2.2f + num * 0.45f - num3; if (!(num4 <= bestScore)) { bestScore = num4; best = candidate; } } } private static bool GridFitsBounds(Vector3 center, Bounds bounds, float gridWidth, float gridDepth) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (center.x - gridWidth * 0.5f >= ((Bounds)(ref bounds)).min.x + 0.38f && center.x + gridWidth * 0.5f <= ((Bounds)(ref bounds)).max.x - 0.38f && center.z - gridDepth * 0.5f >= ((Bounds)(ref bounds)).min.z + 0.38f) { return center.z + gridDepth * 0.5f <= ((Bounds)(ref bounds)).max.z - 0.38f; } return false; } private static Vector3[] FindGroundPackCenters(Bounds shopBounds, float floorHeight, Vector3 extractionPosition, Vector3 spawnReferencePosition, int columns, int rows, float spacingX, float spacingZ, int packCount, Vector3 fallbackCenter) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[Mathf.Max(1, packCount)]; List list = new List(13); Vector3 center = ((Bounds)(ref shopBounds)).center; center.y = floorHeight; Vector3 val = Vector3.ProjectOnPlane(center - spawnReferencePosition, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(center - extractionPosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Mathf.Min(((Bounds)(ref shopBounds)).size.x, ((Bounds)(ref shopBounds)).size.z) * 0.26f; AddGroundPackCenterCandidate(list, fallbackCenter, shopBounds, columns, rows, spacingX, spacingZ); AddGroundPackCenterCandidate(list, center + val * num, shopBounds, columns, rows, spacingX, spacingZ); AddGroundPackCenterCandidate(list, center - val * num, shopBounds, columns, rows, spacingX, spacingZ); AddGroundPackCenterCandidate(list, center + normalized * num, shopBounds, columns, rows, spacingX, spacingZ); AddGroundPackCenterCandidate(list, center - normalized * num, shopBounds, columns, rows, spacingX, spacingZ); Vector3 val3 = center; val2 = val + normalized; AddGroundPackCenterCandidate(list, val3 + ((Vector3)(ref val2)).normalized * num, shopBounds, columns, rows, spacingX, spacingZ); Vector3 val4 = center; val2 = val - normalized; AddGroundPackCenterCandidate(list, val4 + ((Vector3)(ref val2)).normalized * num, shopBounds, columns, rows, spacingX, spacingZ); Vector3 val5 = center; val2 = -val + normalized; AddGroundPackCenterCandidate(list, val5 + ((Vector3)(ref val2)).normalized * num, shopBounds, columns, rows, spacingX, spacingZ); Vector3 val6 = center; val2 = -val - normalized; AddGroundPackCenterCandidate(list, val6 + ((Vector3)(ref val2)).normalized * num, shopBounds, columns, rows, spacingX, spacingZ); if (list.Count == 0) { list.Add(fallbackCenter); } List list2 = new List(array.Length); for (int i = 0; i < array.Length; i++) { int index = 0; float num2 = float.MinValue; for (int j = 0; j < list.Count; j++) { Vector3 val7 = list[j]; float num3 = Vector2.Distance(new Vector2(val7.x, val7.z), new Vector2(extractionPosition.x, extractionPosition.z)); float num4 = Vector2.Distance(new Vector2(val7.x, val7.z), new Vector2(spawnReferencePosition.x, spawnReferencePosition.z)); float minGroundPackCenterDistance = GetMinGroundPackCenterDistance(val7, list2); float num5 = Vector2.Distance(new Vector2(val7.x, val7.z), new Vector2(center.x, center.z)) * 0.05f; float num6 = num4 * 2.2f + num3 * 0.45f + minGroundPackCenterDistance * 1.6f - num5; if (num6 > num2) { num2 = num6; index = j; } } array[i] = list[index]; list2.Add(list[index]); list.RemoveAt(index); if (list.Count == 0 && i + 1 < array.Length) { list.Add(fallbackCenter); } } return array; } private static void AddGroundPackCenterCandidate(List candidates, Vector3 candidate, Bounds shopBounds, int columns, int rows, float spacingX, float spacingZ) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) candidate.y = ((Bounds)(ref shopBounds)).center.y; float gridWidth = (float)(columns - 1) * spacingX; float gridDepth = (float)(rows - 1) * spacingZ; if (!GridFitsBounds(candidate, shopBounds, gridWidth, gridDepth)) { return; } for (int i = 0; i < candidates.Count; i++) { if (Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(candidates[i].x, candidates[i].z)) < 0.35f) { return; } } candidates.Add(candidate); } private static float GetMinGroundPackCenterDistance(Vector3 candidate, List selected) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (selected == null || selected.Count == 0) { return 0f; } float num = float.MaxValue; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(candidate.x, candidate.z); for (int i = 0; i < selected.Count; i++) { float num2 = Vector2.Distance(val, new Vector2(selected[i].x, selected[i].z)); if (num2 < num) { num = num2; } } return num; } private static Vector3 GetGroundPackCenterForSet(GroundPackLayout layout, int setIndex) { //IL_0012: 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) if (layout.PackCenters == null || layout.PackCenters.Length == 0) { return layout.GridCenter; } return layout.PackCenters[Mathf.Clamp(setIndex, 0, layout.PackCenters.Length - 1)]; } private static Vector3 GridToWorldPosition(Vector3 center, int column, int row, int columns, int rows, float spacingX, float spacingZ) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) float num = ((float)column - (float)(columns - 1) * 0.5f) * spacingX; float num2 = ((float)row - (float)(rows - 1) * 0.5f) * spacingZ; return center + new Vector3(num, 0f, num2); } private static void AddExistingShopVolumePositions(List sourceVolumes, List occupiedPositions) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (sourceVolumes == null || occupiedPositions == null) { return; } int num = 0; for (int i = 0; i < sourceVolumes.Count; i++) { ItemVolume val = sourceVolumes[i]; if (!((Object)(object)val == (Object)null)) { occupiedPositions.Add(((Component)val).transform.position); num++; } } if (num > 0) { LogGroundPack($"Ground pack reserved {num} original shop volume position(s) before placing ShopPlus ground items."); } } private static bool TryResolveGroundSpawnPosition(Vector3 targetPosition, GroundPackLayout layout, List occupiedPositions, out Vector3 spawnPosition, out string skipReason, out bool usedFallback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) spawnPosition = Vector3.zero; skipReason = null; usedFallback = false; if (TryResolveGroundSpawnPositionAt(targetPosition, layout, occupiedPositions, out spawnPosition, out skipReason)) { return true; } string text = skipReason; Vector3 groundPackFallbackDirection = GetGroundPackFallbackDirection(targetPosition, layout); float num = Mathf.Max(0.4f, Mathf.Min(layout.SpacingX, layout.SpacingZ)); float num2 = Vector2.Distance(new Vector2(targetPosition.x, targetPosition.z), new Vector2(layout.ExtractionPosition.x, layout.ExtractionPosition.z)); for (int i = 1; i <= 3; i++) { float radius = num * (0.55f + (float)i * 0.6f); if (TrySearchGroundSpawnFallback(targetPosition, layout, occupiedPositions, groundPackFallbackDirection, radius, out spawnPosition)) { usedFallback = true; skipReason = null; return true; } } float num3 = Mathf.Max(3.7900002f, num2 + num * 0.35f); for (int j = 0; j < 4; j++) { float radius2 = num3 + num * (float)j; if (TrySearchGroundSpawnFallback(layout.ExtractionPosition, layout, occupiedPositions, groundPackFallbackDirection, radius2, out spawnPosition)) { usedFallback = true; skipReason = null; return true; } } skipReason = text; return false; } private static bool TryResolveGroundSpawnPositionAt(Vector3 targetPosition, GroundPackLayout layout, List occupiedPositions, out Vector3 spawnPosition, out string failureReason) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) spawnPosition = Vector3.zero; failureReason = null; Vector3 val = ClampGroundPackTargetToBounds(targetPosition, layout.ShopBounds); Vector2 val2 = new Vector2(val.x, val.z); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(layout.ExtractionPosition.x, layout.ExtractionPosition.z); float num = Vector2.Distance(val2, val3); if (num < 3.65f) { failureReason = $"too close to extraction point ({num:F2})"; return false; } if (!TryGetFloorHitNearHeight(new Vector3(val.x, layout.FloorHeight + 8f, val.z), layout.FloorHeight, 1.1f, out var floorHit)) { failureReason = "no matching floor hit near target shop floor"; return false; } float num2 = ResolveGroundSpawnHeight(((RaycastHit)(ref floorHit)).point); spawnPosition = new Vector3(((RaycastHit)(ref floorHit)).point.x, ((RaycastHit)(ref floorHit)).point.y + num2, ((RaycastHit)(ref floorHit)).point.z); if (IsGroundPackPositionOccupied(spawnPosition, occupiedPositions, layout)) { failureReason = "too close to another ShopPlus ground slot"; return false; } return true; } private static bool TrySearchGroundSpawnFallback(Vector3 center, GroundPackLayout layout, List occupiedPositions, Vector3 baseDirection, float radius, out Vector3 spawnPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0027: Unknown result type (might be due to invalid IL or missing references) spawnPosition = Vector3.zero; for (int i = 0; i < GroundPackFallbackAngles.Length; i++) { Vector3 val = RotateDirectionOnXZ(baseDirection, GroundPackFallbackAngles[i]); if (TryResolveGroundSpawnPositionAt(center + val * radius, layout, occupiedPositions, out spawnPosition, out var _)) { return true; } } return false; } private static Vector3 GetGroundPackFallbackDirection(Vector3 targetPosition, GroundPackLayout layout) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(targetPosition - layout.SpawnReferencePosition, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(layout.GridCenter - layout.SpawnReferencePosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(targetPosition - layout.ExtractionPosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(((Bounds)(ref layout.ShopBounds)).center - layout.ExtractionPosition, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } return ((Vector3)(ref val)).normalized; } private static Vector3 RotateDirectionOnXZ(Vector3 direction, float angleDegrees) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(0f, angleDegrees, 0f) * direction; } private static Vector3 ClampGroundPackTargetToBounds(Vector3 targetPosition, Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) float num = ((Bounds)(ref bounds)).min.x + 0.38f; float num2 = ((Bounds)(ref bounds)).max.x - 0.38f; float num3 = ((Bounds)(ref bounds)).min.z + 0.38f; float num4 = ((Bounds)(ref bounds)).max.z - 0.38f; return new Vector3(Mathf.Clamp(targetPosition.x, num, num2), targetPosition.y, Mathf.Clamp(targetPosition.z, num3, num4)); } private static bool IsGroundPackPositionOccupied(Vector3 candidatePosition, List occupiedPositions, GroundPackLayout layout) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (occupiedPositions == null || occupiedPositions.Count == 0) { return false; } float num = Mathf.Max(new float[3] { 0.48f, 0.26f, Mathf.Min(layout.SpacingX, layout.SpacingZ) * 0.68f }); float num2 = num * num; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(candidatePosition.x, candidatePosition.z); Vector2 val3 = default(Vector2); for (int i = 0; i < occupiedPositions.Count; i++) { Vector3 val2 = occupiedPositions[i]; ((Vector2)(ref val3))..ctor(val2.x, val2.z); Vector2 val4 = val - val3; if (((Vector2)(ref val4)).sqrMagnitude < num2) { return true; } } return false; } private static float ResolveGroundSpawnHeight(Vector3 floorPoint) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) float num = 1.25f; if (TryGetLowestCeilingHit(floorPoint + Vector3.up * 0.08f, 6.5f, out var ceilingHit)) { float num2 = Mathf.Max(0.45f, ((RaycastHit)(ref ceilingHit)).point.y - floorPoint.y - 0.55f); num = Mathf.Min(num, num2); } return Mathf.Max(0.45f, num); } private static bool TryGetLowestCeilingHit(Vector3 sampleOrigin, float maxDistance, out RaycastHit ceilingHit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) ceilingHit = default(RaycastHit); int num = Physics.RaycastNonAlloc(sampleOrigin, Vector3.up, GroundPackCeilingRaycastHits, maxDistance, -5, (QueryTriggerInteraction)1); if (num <= 0) { return false; } float num2 = float.MaxValue; bool result = false; for (int i = 0; i < num; i++) { RaycastHit val = GroundPackCeilingRaycastHits[i]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) && !((RaycastHit)(ref val)).collider.isTrigger && !(((RaycastHit)(ref val)).normal.y > -0.15f) && !(((RaycastHit)(ref val)).distance >= num2)) { num2 = ((RaycastHit)(ref val)).distance; ceilingHit = val; result = true; } } return result; } private static bool TryGetFloorHitNearHeight(Vector3 sampleOrigin, float targetFloorHeight, float maxDelta, out RaycastHit floorHit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) floorHit = default(RaycastHit); int num = Physics.RaycastNonAlloc(sampleOrigin, Vector3.down, GroundPackFloorRaycastHits, 24f, -5, (QueryTriggerInteraction)1); if (num <= 0) { return false; } float num2 = float.MaxValue; bool result = false; for (int i = 0; i < num; i++) { RaycastHit val = GroundPackFloorRaycastHits[i]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) && !((RaycastHit)(ref val)).collider.isTrigger && !(((RaycastHit)(ref val)).normal.y < 0.8f)) { float num3 = Mathf.Abs(((RaycastHit)(ref val)).point.y - targetFloorHeight); if (!(num3 > maxDelta) && !(num3 >= num2)) { num2 = num3; floorHit = val; result = true; } } } return result; } private static bool TryGetHighestFloorHit(Vector3 sampleOrigin, out RaycastHit floorHit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) floorHit = default(RaycastHit); int num = Physics.RaycastNonAlloc(sampleOrigin, Vector3.down, GroundPackFloorRaycastHits, 24f, -5, (QueryTriggerInteraction)1); if (num <= 0) { return false; } float num2 = float.MaxValue; bool result = false; for (int i = 0; i < num; i++) { RaycastHit val = GroundPackFloorRaycastHits[i]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) && !((RaycastHit)(ref val)).collider.isTrigger && !(((RaycastHit)(ref val)).normal.y < 0.8f) && !(((RaycastHit)(ref val)).point.y >= num2)) { num2 = ((RaycastHit)(ref val)).point.y; floorHit = val; result = true; } } return result; } private static int GetStableShopSeed(List volumes) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected I4, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) int num = 17; num = num * 31 + (((Object)(object)RunManager.instance != (Object)null) ? RunManager.instance.levelsCompleted : 0); num = num * 31 + (volumes?.Count ?? 0); if (volumes != null) { for (int i = 0; i < volumes.Count; i++) { ItemVolume val = volumes[i]; if (!((Object)(object)val == (Object)null)) { Vector3 position = ((Component)val).transform.position; num = num * 31 + val.itemVolume; num = num * 31 + Mathf.RoundToInt(position.x * 100f); num = num * 31 + Mathf.RoundToInt(position.y * 100f); num = num * 31 + Mathf.RoundToInt(position.z * 100f); } } } if (num != int.MinValue) { return Mathf.Abs(num); } return 0; } private static void ShuffleArray(T[] array, int seed) { if (array != null && array.Length > 1) { Random random = new Random(seed); for (int num = array.Length - 1; num > 0; num--) { int num2 = random.Next(num + 1); T val = array[num]; array[num] = array[num2]; array[num2] = val; } } } private static Dictionary CountVolumeTypes(IEnumerable volumeTypes) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); foreach (itemVolume volumeType in volumeTypes) { AddVolumeCount(dictionary, volumeType); } return dictionary; } private static void AddVolumeCount(Dictionary counts, itemVolume volumeType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) counts.TryGetValue(volumeType, out var value); counts[volumeType] = value + 1; } private static void AddStringCount(Dictionary counts, string key) { if (string.IsNullOrEmpty(key)) { key = "unknown"; } counts.TryGetValue(key, out var value); counts[key] = value + 1; } private static string FormatVolumeCounts(Dictionary counts) { if (counts == null || counts.Count == 0) { return "none"; } itemVolume[] array = new itemVolume[10]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); itemVolume[] array2 = (itemVolume[])(object)array; List list = new List(array2.Length); for (int i = 0; i < array2.Length; i++) { if (counts.TryGetValue(array2[i], out var value) && value > 0) { list.Add($"{array2[i]}={value}"); } } return string.Join(", ", list.ToArray()); } private static string FormatStringCounts(Dictionary counts) { if (counts == null || counts.Count == 0) { return "none"; } List list = new List(counts.Count); foreach (KeyValuePair count in counts) { list.Add($"{count.Key}={count.Value}"); } return string.Join(", ", list.ToArray()); } private static void CleanGroundSpawnVolumes() { foreach (GameObject groundSpawnVolumeObject in groundSpawnVolumeObjects) { if ((Object)(object)groundSpawnVolumeObject != (Object)null) { Object.Destroy((Object)(object)groundSpawnVolumeObject); } } groundSpawnVolumeObjects.Clear(); CleanGroundPackMarkedItems(); pendingGroundPackSpawnSlots.Clear(); groundPackCreateLogFrame = -1; itemVolumeCollectionLogFrame = -1; } private static void LogGroundPack(string message) { if (!((Object)(object)Instance == (Object)null)) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[GroundPack] " + message)); } } private static void MarkGroundPackItem(GameObject itemObject, itemVolume volumeType) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)itemObject == (Object)null)) { groundPackMarkedItems.Add(itemObject); ShopPlusGroundPackMarker shopPlusGroundPackMarker = itemObject.AddComponent(); if ((Object)(object)shopPlusGroundPackMarker != (Object)null) { shopPlusGroundPackMarker.VolumeType = volumeType; } } } private static void CleanGroundPackMarkedItems() { for (int num = groundPackMarkedItems.Count - 1; num >= 0; num--) { if ((Object)(object)groundPackMarkedItems[num] != (Object)null) { Object.Destroy((Object)(object)groundPackMarkedItems[num]); } } groundPackMarkedItems.Clear(); } private static string FormatVector3(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return $"({position.x:F2}, {position.y:F2}, {position.z:F2})"; } private static string FormatPackCenters(Vector3[] centers) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (centers == null || centers.Length == 0) { return "none"; } List list = new List(centers.Length); for (int i = 0; i < centers.Length; i++) { list.Add($"#{i + 1}{FormatVector3(centers[i])}"); } return string.Join(", ", list.ToArray()); } private static string FormatBounds(Bounds bounds) { //IL_0012: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) return "center=" + FormatVector3(((Bounds)(ref bounds)).center) + ", size=" + FormatVector3(((Bounds)(ref bounds)).size) + ", min=" + FormatVector3(((Bounds)(ref bounds)).min) + ", max=" + FormatVector3(((Bounds)(ref bounds)).max); } private static void ShopManagerShopInitializePostfix() { if (ShouldRunMasterShopLogic()) { SpawnPendingGroundPackItems(); } EnsureDebugShelfSpawnedForCurrentShop(); EnsureFreeItemNetworkSync(); if (IsStaticRandomFreeItemEnabled() && (!SemiFunc.IsMultiplayer() || !SemiFunc.IsNotMasterClient())) { Instance.ScheduleRandomFreeItemSelection(); } } private static void ItemAttributesShowingInfoPostfix(ItemAttributes __instance) { if (IsCurrentFreeShopItem(__instance) && IsStaticRandomFreeItemEnabled() && SemiFunc.RunIsShop() && !(ItemAttributesPromptNameField == null)) { string text = ItemAttributesPromptNameField.GetValue(__instance) as string; if (!string.IsNullOrEmpty(text) && !text.Contains("[FREE]")) { ItemAttributesPromptNameField.SetValue(__instance, text + " [FREE]"); } } } private static void ExtractionPointCancelExtractionPostfix(ExtractionPoint __instance, ref bool __result) { if (__result && IsStaticRandomFreeItemEnabled() && !(ExtractionPointIsShopField == null) && (bool)ExtractionPointIsShopField.GetValue(__instance) && HasPurchasableZeroCostShopItems()) { __result = false; LogGroundPack("CancelExtraction override: allowing checkout to continue with zero-cost shop item(s)."); } } private static void WorldSpaceUIValueShowPhysPostfix(WorldSpaceUIValue __instance, PhysGrabObject _grabObject, bool _cost) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)currentFreeShopItem == (Object)null || !_cost || (Object)(object)_grabObject == (Object)null || !IsStaticRandomFreeItemEnabled() || !IsCurrentFreeShopItem(((Component)_grabObject).GetComponent())) { return; } object obj = WorldSpaceUIValueTextField?.GetValue(__instance); if (obj != null) { if (worldSpaceUITextProperty == null) { worldSpaceUITextProperty = obj.GetType().GetProperty("text"); } if (worldSpaceUIColorProperty == null) { worldSpaceUIColorProperty = obj.GetType().GetProperty("color"); } worldSpaceUITextProperty?.SetValue(obj, "-$0K", null); worldSpaceUIColorProperty?.SetValue(obj, __instance.colorCost, null); } } private void Update() { UpdateDebugShelfRuntime(); if ((Object)(object)currentFreeShopItem != (Object)null || freeItemSelectionCoroutine != null) { if (!SemiFunc.RunIsShop()) { ClearCurrentFreeShopItem(restoreOriginalValue: false); } else if (!IsRandomFreeItemRuntimeEnabled()) { ResetFreeItemSelectionForShopChange(); } else if ((Object)(object)currentFreeShopItem != (Object)null && (!Object.op_Implicit((Object)(object)currentFreeShopItem) || !((Component)currentFreeShopItem).gameObject.activeInHierarchy)) { ClearCurrentFreeShopItem(restoreOriginalValue: false); } else if (currentFreeShopItemUsesNativeNetworkSync) { EnforceNativeFreeItemState(); } } } private void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0041: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; bool flag = ShouldDrawDebugShelfPanel(); if (!flag && current != null && (int)current.type != 7) { return; } if (flag) { DrawDebugShelfPanel(); } if (current != null && (int)current.type == 7) { if (TryGetCachedFreeItemLabelRect(out var rect)) { EnsureFreeItemLabelStyle(); Color color = GUI.color; GUI.color = FreeItemLabelBackgroundColor; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; GUI.Label(rect, "free", freeItemLabelStyle); } DrawDebugShelfWorldBadge(); } } private bool TryGetCachedFreeItemLabelRect(out Rect rect) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (cachedFreeItemLabelFrame != Time.frameCount) { cachedFreeItemLabelFrame = Time.frameCount; TryGetFreeItemLabelRect(out cachedFreeItemLabelRect); } rect = cachedFreeItemLabelRect; if (((Rect)(ref rect)).width > 0f) { return ((Rect)(ref rect)).height > 0f; } return false; } private bool TryGetFreeItemLabelRect(out Rect rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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) rect = default(Rect); if (!SemiFunc.RunIsShop() || !IsRandomFreeItemRuntimeEnabled()) { return false; } if (!Object.op_Implicit((Object)(object)currentFreeShopItem) || !((Component)currentFreeShopItem).gameObject.activeInHierarchy) { return false; } Camera val = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.MainCamera : Camera.main); if ((Object)(object)val == (Object)null) { return false; } Vector3 val2 = val.WorldToScreenPoint(GetFreeItemWorldLabelPosition(currentFreeShopItem)); if (val2.z <= 0f) { return false; } rect = new Rect(val2.x - 34f, (float)Screen.height - val2.y - 26f, 68f, 26f); return true; } private void ScheduleRandomFreeItemSelection() { if (freeItemSelectionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(freeItemSelectionCoroutine); } freeItemSelectionCoroutine = ((MonoBehaviour)this).StartCoroutine(AssignRandomFreeItemWhenReady()); } private static void EnsureFreeItemNetworkSync() { if (SemiFunc.IsMultiplayer() && !((Object)(object)freeItemNetworkSync != (Object)null) && !((Object)(object)PunManager.instance == (Object)null)) { freeItemNetworkSync = ((Component)PunManager.instance).GetComponent(); if ((Object)(object)freeItemNetworkSync == (Object)null) { freeItemNetworkSync = ((Component)PunManager.instance).gameObject.AddComponent(); } } } private void ScheduleSyncedFreeItemSelection(int photonViewId, bool nativeScaleApplied) { if (photonViewId > 0) { if (freeItemSelectionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(freeItemSelectionCoroutine); } freeItemSelectionCoroutine = ((MonoBehaviour)this).StartCoroutine(AssignSyncedFreeItemWhenReady(photonViewId, nativeScaleApplied)); } } [IteratorStateMachine(typeof(d__356))] private IEnumerator AssignRandomFreeItemWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__356(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__357))] private IEnumerator AssignSyncedFreeItemWhenReady(int photonViewId, bool nativeScaleApplied) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__357(0) { <>4__this = this, photonViewId = photonViewId, nativeScaleApplied = nativeScaleApplied }; } private bool TryAssignRandomFreeItem() { List list = FindEligibleFreeItemCandidates(); if (list.Count == 0) { return false; } int deterministicFreeItemIndex = GetDeterministicFreeItemIndex(list); ItemAttributes val = list[deterministicFreeItemIndex]; bool nativeScaleApplied = false; if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { val = TryCreateNativeSyncedFreeItemReplacement(val, out nativeScaleApplied) ?? val; } string localizedItemName = GetLocalizedItemName(val); ApplyFreeItemSelection(val, !nativeScaleApplied, !nativeScaleApplied); BroadcastFreeItemSelection(val, localizedItemName, nativeScaleApplied); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Random free shop item selected for this shop visit: " + localizedItemName)); return true; } private bool TryAssignSyncedFreeItem(int photonViewId, bool nativeScaleApplied) { PhotonView val = PhotonView.Find(photonViewId); if ((Object)(object)val == (Object)null) { return false; } ItemAttributes component = ((Component)val).GetComponent(); if ((Object)(object)component == (Object)null || !((Component)component).gameObject.activeInHierarchy) { return false; } string localizedItemName = GetLocalizedItemName(component); ApplyFreeItemSelection(component, !nativeScaleApplied, !nativeScaleApplied); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Synced free shop item applied on client: {localizedItemName} (ViewID: {photonViewId})"); return true; } private void ApplyFreeItemSelection(ItemAttributes selectedItem, bool scaleItemLocally, bool restoreOriginalStateOnClear) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)selectedItem == (Object)null)) { ClearCurrentFreeShopItem(restoreOriginalValue: true); currentFreeShopItem = selectedItem; currentFreeShopItemOriginalValue = GetItemValue(selectedItem); currentFreeShopItemOriginalScale = ((Component)selectedItem).transform.localScale; currentFreeShopItemShouldRestoreOriginalState = restoreOriginalStateOnClear; currentFreeShopItemUsesNativeNetworkSync = !scaleItemLocally; SetItemValue(selectedItem, 0); if (scaleItemLocally) { ((Component)selectedItem).transform.localScale = currentFreeShopItemOriginalScale * 3f; } InvalidateFreeItemLabelCache(); string localizedItemName = GetLocalizedItemName(selectedItem); SemiFunc.UIFocusText("free:" + localizedItemName, Color.white, FreeItemHighlightColor, 3f); } } private void BroadcastFreeItemSelection(ItemAttributes selectedItem, string itemName, bool nativeScaleApplied) { if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { EnsureFreeItemNetworkSync(); PhotonView val = (((Object)(object)selectedItem != (Object)null) ? ((Component)selectedItem).GetComponent() : null); if ((Object)(object)freeItemNetworkSync == (Object)null || (Object)(object)val == (Object)null || val.ViewID == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to sync free shop item to other clients: " + itemName)); return; } freeItemNetworkSync.BroadcastFreeItemSelection(val.ViewID, nativeScaleApplied); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Broadcast free shop item to clients: {itemName} (ViewID: {val.ViewID})"); } } internal static void ReceiveSyncedFreeItem(int photonViewId, bool nativeScaleApplied) { if (!((Object)(object)Instance == (Object)null) && photonViewId > 0) { Instance.ScheduleSyncedFreeItemSelection(photonViewId, nativeScaleApplied); } } private ItemAttributes TryCreateNativeSyncedFreeItemReplacement(ItemAttributes selectedItem, out bool nativeScaleApplied) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) nativeScaleApplied = false; if ((Object)(object)selectedItem == (Object)null || !SemiFunc.IsMultiplayer() || !SemiFunc.IsMasterClient()) { return selectedItem; } PhotonView component = ((Component)selectedItem).GetComponent(); Item item = selectedItem.item; object obj; if (item == null) { obj = null; } else { PrefabRef prefab = item.prefab; obj = ((prefab != null) ? prefab.ResourcePath : null); } string text = (string)obj; if ((Object)(object)component == (Object)null || component.ViewID == 0 || string.IsNullOrEmpty(text)) { return selectedItem; } Vector3 position = ((Component)selectedItem).transform.position; Quaternion rotation = ((Component)selectedItem).transform.rotation; Vector3 val = ((Component)selectedItem).transform.localScale * 3f; object[] array = new object[3] { val.x, val.y, val.z }; GameObject val2 = PhotonNetwork.InstantiateRoomObject(text, position, rotation, (byte)0, array); ItemAttributes val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent() : null); if ((Object)(object)val3 == (Object)null) { if ((Object)(object)val2 != (Object)null) { PhotonNetwork.Destroy(val2); } ((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to create native-synced free item replacement, falling back to local scale adjustment."); return selectedItem; } PhotonNetwork.Destroy(((Component)selectedItem).gameObject); SyncFreeItemValueToAllClients(val3); nativeScaleApplied = true; return val3; } private List FindEligibleFreeItemCandidates() { List list = freeItemCandidateBuffer; list.Clear(); ItemAttributes[] array = Object.FindObjectsOfType(); foreach (ItemAttributes val in array) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (Object)(object)((Component)val).GetComponent() == (Object)null) { continue; } RoomVolumeCheck component = ((Component)val).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } component.CheckSet(); bool num = RoomVolumeCheckInTruckField != null && (bool)RoomVolumeCheckInTruckField.GetValue(component); bool flag = RoomVolumeCheckInExtractionPointField != null && (bool)RoomVolumeCheckInExtractionPointField.GetValue(component); if (!(num || flag)) { int itemValue = GetItemValue(val); if (itemValue > 0 && itemValue <= 10) { list.Add(val); } } } list.Sort(FreeItemCandidateComparison); return list; } private static int CompareFreeItemCandidates(ItemAttributes left, ItemAttributes right) { int stableItemId = GetStableItemId(left); int stableItemId2 = GetStableItemId(right); int num = stableItemId.CompareTo(stableItemId2); if (num != 0) { return num; } return string.CompareOrdinal(((Object)(object)left != (Object)null) ? ((Object)left).name : string.Empty, ((Object)(object)right != (Object)null) ? ((Object)right).name : string.Empty); } private int GetDeterministicFreeItemIndex(List candidates) { int num = 17; num = num * 31 + candidates.Count; num = num * 31 + RunManager.instance.levelsCompleted; num = num * 31 + SemiFunc.StatGetRunCurrency(); for (int i = 0; i < candidates.Count; i++) { num = num * 31 + GetStableItemId(candidates[i]); num = num * 31 + GetItemValue(candidates[i]); } if (num == int.MinValue) { num = 0; } return Mathf.Abs(num) % candidates.Count; } private static int GetStableItemId(ItemAttributes item) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) PhotonView val = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent() : null); if ((Object)(object)val != (Object)null && val.ViewID != 0) { return val.ViewID; } Vector3 val2 = (((Object)(object)item != (Object)null) ? ((Component)item).transform.position : Vector3.zero); return (((17 * 31 + Mathf.RoundToInt(val2.x * 100f)) * 31 + Mathf.RoundToInt(val2.y * 100f)) * 31 + Mathf.RoundToInt(val2.z * 100f)) * 31 + (((Object)(object)item != (Object)null) ? ((Object)item).name.GetHashCode() : 0); } private static string GetLocalizedItemName(ItemAttributes item) { if ((Object)(object)item == (Object)null || (Object)(object)item.item == (Object)null) { return "未知商品"; } LocalizedAsset itemNameLocalized = item.item.itemNameLocalized; return ((itemNameLocalized != null) ? itemNameLocalized.GetLocalizedString() : null) ?? item.item.itemName; } private static int GetItemValue(ItemAttributes item) { if ((Object)(object)item == (Object)null || ItemAttributesValueField == null) { return 0; } return (int)ItemAttributesValueField.GetValue(item); } private static void SetItemValue(ItemAttributes item, int value) { if (!((Object)(object)item == (Object)null) && !(ItemAttributesValueField == null)) { ItemAttributesValueField.SetValue(item, value); } } private void EnforceNativeFreeItemState() { if (!((Object)(object)currentFreeShopItem == (Object)null) && Object.op_Implicit((Object)(object)currentFreeShopItem) && ((Component)currentFreeShopItem).gameObject.activeInHierarchy && SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient() && GetItemValue(currentFreeShopItem) != 0) { SyncFreeItemValueToAllClients(currentFreeShopItem); } } private void SyncFreeItemValueToAllClients(ItemAttributes item) { if (!((Object)(object)item == (Object)null)) { SetItemValue(item, 0); PhotonView component = ((Component)item).GetComponent(); if ((Object)(object)component != (Object)null && component.ViewID != 0 && SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { component.RPC("GetValueRPC", (RpcTarget)1, new object[1] { 0 }); } } } private static bool IsCurrentFreeShopItem(ItemAttributes item) { if ((Object)(object)item != (Object)null && (Object)(object)currentFreeShopItem != (Object)null) { return (Object)(object)item == (Object)(object)currentFreeShopItem; } return false; } private static bool HasPurchasableZeroCostShopItems() { if (!(ShopManagerShoppingListField?.GetValue(ShopManager.instance) is IList list) || list.Count == 0) { return false; } for (int i = 0; i < list.Count; i++) { object? obj = list[i]; ItemAttributes val = (ItemAttributes)((obj is ItemAttributes) ? obj : null); if (!((Object)(object)val == (Object)null) && GetItemValue(val) == 0) { return true; } } return false; } private void ResetFreeItemSelectionForShopChange() { if (freeItemSelectionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(freeItemSelectionCoroutine); freeItemSelectionCoroutine = null; } ClearCurrentFreeShopItem(restoreOriginalValue: true); } private static void ClearCurrentFreeShopItem(bool restoreOriginalValue) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (restoreOriginalValue && currentFreeShopItemShouldRestoreOriginalState && (Object)(object)currentFreeShopItem != (Object)null && currentFreeShopItemOriginalValue >= 0 && Object.op_Implicit((Object)(object)currentFreeShopItem)) { SetItemValue(currentFreeShopItem, currentFreeShopItemOriginalValue); } if (currentFreeShopItemShouldRestoreOriginalState && (Object)(object)currentFreeShopItem != (Object)null && Object.op_Implicit((Object)(object)currentFreeShopItem)) { ((Component)currentFreeShopItem).transform.localScale = currentFreeShopItemOriginalScale; } currentFreeShopItem = null; currentFreeShopItemOriginalValue = -1; currentFreeShopItemOriginalScale = Vector3.one; currentFreeShopItemShouldRestoreOriginalState = true; currentFreeShopItemUsesNativeNetworkSync = false; InvalidateStaticFreeItemLabelCache(); } private void InvalidateFreeItemLabelCache() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) cachedFreeItemLabelRect = default(Rect); cachedFreeItemLabelFrame = -1; } private static void InvalidateStaticFreeItemLabelCache() { if ((Object)(object)Instance != (Object)null) { Instance.InvalidateFreeItemLabelCache(); } } private static Vector3 GetFreeItemWorldLabelPosition(ItemAttributes item) { //IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject val = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent() : null); if ((Object)(object)val != (Object)null) { return val.centerPoint + Vector3.up * 0.45f; } Renderer val2 = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponentInChildren() : null); if ((Object)(object)val2 != (Object)null) { Bounds bounds = val2.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 up = Vector3.up; bounds = val2.bounds; return center + up * (((Bounds)(ref bounds)).extents.y + 0.2f); } if (!((Object)(object)item != (Object)null)) { return Vector3.zero; } return ((Component)item).transform.position + Vector3.up * 0.5f; } private static void EnsureFreeItemLabelStyle() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (freeItemLabelStyle == null) { freeItemLabelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 14, fontStyle = (FontStyle)1 }; freeItemLabelStyle.normal.textColor = Color.black; } } } internal sealed class ConfigurationManagerAttributes { public bool? ShowRangeAsPercent; public Action CustomDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public int? Order; public bool? ReadOnly; } public class ShopPlusGroundPackMarker : MonoBehaviour { public itemVolume VolumeType; private static GUIStyle labelStyle; private static readonly Color LabelBackgroundColor = new Color(0.2f, 0.8f, 1f, 0.9f); private void OnGUI() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if ((Object)(object)Camera.main == (Object)null) { return; } Vector3 val = Camera.main.WorldToScreenPoint(((Component)this).transform.position); if (!(val.z <= 0f)) { if (labelStyle == null) { GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.white; labelStyle = val2; } string text = $"[{VolumeType}]"; Vector2 val3 = labelStyle.CalcSize(new GUIContent(text)); float num = 4f; Rect val4 = new Rect(val.x - val3.x * 0.5f - num, (float)Screen.height - val.y - val3.y * 0.5f - num, val3.x + num * 2f, val3.y + num * 2f); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = LabelBackgroundColor; GUI.Box(val4, ""); GUI.backgroundColor = backgroundColor; GUI.Label(val4, text, labelStyle); } } } internal sealed class ShopPlusFreeItemSync : MonoBehaviourPun { internal void BroadcastFreeItemSelection(int photonViewId, bool nativeScaleApplied) { if (photonViewId > 0 && !((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null)) { ((MonoBehaviourPun)this).photonView.RPC("SyncFreeShopItemRPC", (RpcTarget)1, new object[2] { photonViewId, nativeScaleApplied }); } } [PunRPC] private void SyncFreeShopItemRPC(int photonViewId, bool nativeScaleApplied, PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { ShopPlusPlugin.ReceiveSyncedFreeItem(photonViewId, nativeScaleApplied); } } }