Decompiled source of UltimatePrediction v1.0.0

plugins/UltimatePrediction.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltimatePrediction")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3bf7381f01bbcd64ef855b67a16b0e1e3b5b9c90")]
[assembly: AssemblyProduct("UltimatePrediction")]
[assembly: AssemblyTitle("UltimatePrediction")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UltimatePrediction
{
	internal enum PreviewColor
	{
		青色,
		天蓝,
		蓝色,
		绿色,
		黄绿色,
		黄色,
		橙色,
		红色,
		品红,
		紫色,
		白色
	}
	internal static class Palette
	{
		internal static Color Of(PreviewColor c)
		{
			//IL_0046: 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_0070: 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_009a: 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_00c4: 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_00ee: 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_0118: 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)
			return (Color)(c switch
			{
				PreviewColor.青色 => new Color(0f, 1f, 1f), 
				PreviewColor.天蓝 => new Color(0.05f, 0.7f, 1f), 
				PreviewColor.蓝色 => new Color(0.15f, 0.35f, 1f), 
				PreviewColor.绿色 => new Color(0.1f, 1f, 0.2f), 
				PreviewColor.黄绿色 => new Color(0.55f, 1f, 0.15f), 
				PreviewColor.黄色 => new Color(1f, 0.9f, 0.05f), 
				PreviewColor.橙色 => new Color(1f, 0.45f, 0.05f), 
				PreviewColor.红色 => new Color(1f, 0.15f, 0.1f), 
				PreviewColor.品红 => new Color(1f, 0.2f, 0.85f), 
				PreviewColor.紫色 => new Color(0.65f, 0.3f, 1f), 
				PreviewColor.白色 => new Color(1f, 1f, 1f), 
				_ => Color.white, 
			});
		}
	}
	internal static class Cfg
	{
		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<float> PreviewTransparency;

		internal static ConfigEntry<bool> HideHeldItem;

		internal static ConfigEntry<bool> ShowTrajectory;

		internal static ConfigEntry<PreviewColor> TrajectoryColor;

		internal static ConfigEntry<float> TrajectoryWidth;

		internal static ConfigEntry<bool> ShowLandingMarker;

		internal static ConfigEntry<PreviewColor> MarkerColor;

		internal static ConfigEntry<bool> ShowColliderBox;

		internal static ConfigEntry<PreviewColor> ColliderBoxColor;

		internal static ConfigEntry<bool> ShowResultGhost;

		internal static ConfigEntry<bool> ShowRadius;

		internal static ConfigEntry<PreviewColor> ExplosionColor;

		internal static ConfigEntry<PreviewColor> HealColor;

		internal static ConfigEntry<float> ColorBoost;

		internal static ConfigEntry<float> PulseSpeed;

		internal static ConfigEntry<bool> RangeScreenOverlay;

		internal static ConfigEntry<float> RangeScreenOverlayMaxAlpha;

		internal static ConfigEntry<bool> EnableMagicBean;

		internal static ConfigEntry<bool> EnableCloudFungus;

		internal static ConfigEntry<bool> EnableBounceFungus;

		internal static ConfigEntry<bool> EnableShelfFungus;

		internal static ConfigEntry<bool> EnableWarpFungus;

		internal static ConfigEntry<bool> EnableRemedyFungus;

		internal static ConfigEntry<bool> EnableDynamite;

		internal static ConfigEntry<bool> DynamiteUseFuseTime;

		internal static ConfigEntry<bool> EnableRopeCannon;

		internal static ConfigEntry<bool> EnableChainLauncher;

		internal static ConfigEntry<bool> EnableLaunchers;

		internal static ConfigEntry<bool> EnableGenericThrowables;

		internal static ConfigEntry<float> RopePreviewTransparency;

		internal static ConfigEntry<PreviewColor> ChainPreviewColor;

		internal static ConfigEntry<bool> EnableObserver;

		internal static ConfigEntry<float> ObserverWidth;

		internal static ConfigEntry<float> ObserverX;

		internal static ConfigEntry<float> ObserverY;

		internal static ConfigEntry<float> ObserverDistance;

		internal static ConfigEntry<float> ObserverElevation;

		internal static ConfigEntry<float> ObserverFov;

		internal static ConfigEntry<KeyCode> ObserverDragModifier;

		internal static ConfigEntry<bool> DebugLog;

		internal static ConfigEntry<bool> EnablePrecision;

		internal static ConfigEntry<KeyCode> PrecisionKey;

		internal static int Revision;

		internal static void Init(ConfigFile config)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Expected O, but got Unknown
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Expected O, but got Unknown
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Expected O, but got Unknown
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Expected O, but got Unknown
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Expected O, but got Unknown
			Enabled = config.Bind<bool>("1-通用", "启用模组", true, "总开关。关闭后不显示任何预测。");
			PreviewTransparency = config.Bind<float>("1-通用", "预览透明度", 0.72f, new ConfigDescription("落点结果预览、轨迹、标记的透明度(0=完全透明,1=完全不透明)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f), Array.Empty<object>()));
			HideHeldItem = config.Bind<bool>("1-通用", "预览时隐藏手中道具", false, "按住预览/使用键显示预览时,隐藏手中的道具模型(对发射类与绳索炮生效),避免遮挡视线。");
			ShowTrajectory = config.Bind<bool>("2-视觉", "显示轨迹线", true, "显示投掷物的飞行轨迹线。");
			TrajectoryColor = config.Bind<PreviewColor>("2-视觉", "轨迹颜色", PreviewColor.天蓝, "轨迹线的主颜色(下拉选择)。");
			TrajectoryWidth = config.Bind<float>("2-视觉", "轨迹线宽", 0.07f, new ConfigDescription("轨迹线起点宽度(米)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.3f), Array.Empty<object>()));
			ShowLandingMarker = config.Bind<bool>("2-视觉", "显示落点标记", true, "在预测落点显示脉冲光环标记。");
			MarkerColor = config.Bind<PreviewColor>("2-视觉", "落点标记颜色", PreviewColor.黄色, "落点光环颜色(下拉选择)。");
			ShowColliderBox = config.Bind<bool>("2-视觉", "显示碰撞箱", true, "在预测落点显示最终物体的碰撞箱线框。");
			ColliderBoxColor = config.Bind<PreviewColor>("2-视觉", "碰撞箱颜色", PreviewColor.绿色, "碰撞箱线框颜色(下拉选择)。");
			ShowResultGhost = config.Bind<bool>("2-视觉", "显示结果幽灵", true, "在预测落点显示将要生成物体的半透明预览。");
			ShowRadius = config.Bind<bool>("2-视觉", "显示范围预测", true, "显示爆炸/治疗效果的作用半径。");
			ExplosionColor = config.Bind<PreviewColor>("2-视觉", "爆炸范围颜色", PreviewColor.橙色, "爆炸半径颜色(下拉选择)。");
			HealColor = config.Bind<PreviewColor>("2-视觉", "治疗范围颜色", PreviewColor.绿色, "治疗半径颜色(下拉选择)。");
			ColorBoost = config.Bind<float>("2-视觉", "颜色加深", 1.35f, new ConfigDescription("统一加深轨迹/标记/碰撞箱/范围的颜色(1=原始,越大越浓)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2.5f), Array.Empty<object>()));
			PulseSpeed = config.Bind<float>("2-视觉", "脉冲速度", 2.5f, new ConfigDescription("落点光环与半径脉冲动画速度。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			RangeScreenOverlay = config.Bind<bool>("2-视觉", "范围屏幕遮罩", true, "当玩家自身处于爆炸/治疗范围内时,屏幕叠加一层与范围同色的遮罩,避免误以为没有效果。");
			RangeScreenOverlayMaxAlpha = config.Bind<float>("2-视觉", "范围遮罩最大强度", 0.4f, new ConfigDescription("屏幕遮罩在范围正中心时的最大不透明度。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 0.8f), Array.Empty<object>()));
			EnableMagicBean = config.Bind<bool>("3-道具", "魔豆预测", true, "预测魔豆落点、生长方向与藤蔓长度/碰撞箱。");
			EnableCloudFungus = config.Bind<bool>("3-道具", "云雾菇预测", true, "预测云雾菇破碎位置与云台落点。");
			EnableBounceFungus = config.Bind<bool>("3-道具", "弹力菇预测", true, "预测弹力菇破碎位置与弹力平台落点。");
			EnableShelfFungus = config.Bind<bool>("3-道具", "踏板菇预测", true, "预测踏板菇破碎位置与平台落点。");
			EnableWarpFungus = config.Bind<bool>("3-道具", "曲迁菇预测", true, "预测曲迁菇/传送篮球的飞行轨迹与传送落点。");
			EnableRemedyFungus = config.Bind<bool>("3-道具", "灵药菇预测", true, "预测灵药菇破碎位置与治疗范围。");
			EnableDynamite = config.Bind<bool>("3-道具", "炸药预测", true, "预测炸药最终位置与爆炸范围。");
			DynamiteUseFuseTime = config.Bind<bool>("3-道具", "炸药按引信时间预测", false, "关闭时以炸药最终静止位置显示爆炸范围(稳定、直观);开启则按剩余引信时间采样爆炸位置(引信很短时会显示空中炸点,并随引信倒计时移动)。");
			EnableRopeCannon = config.Bind<bool>("3-道具", "绳索炮预测", true, "按住精确预览键显示绳索锚点、绳索长度与下垂。");
			EnableChainLauncher = config.Bind<bool>("3-道具", "锁链发射器预测", true, "按住使用键(默认左键)显示锁链落点、长度与下垂。");
			EnableLaunchers = config.Bind<bool>("3-道具", "发射类道具预测", true, "为反重炮、治疗飞镖等射线发射类道具显示命中落点预测(按住左键使用/瞄准时显示)。");
			EnableGenericThrowables = config.Bind<bool>("3-道具", "通用投掷物预测", true, "为篮球,以及其它具有特殊投掷效果(破碎生成、粘附、碰撞触发等)的道具提供落点与碰撞箱预测。");
			RopePreviewTransparency = config.Bind<float>("4-绳索锁链", "绳索预览透明度", 0.9f, new ConfigDescription("绳索预览的透明度(越高越实)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>()));
			ChainPreviewColor = config.Bind<PreviewColor>("4-绳索锁链", "锁链预览颜色", PreviewColor.白色, "锁链预览的着色(下拉选择)。");
			EnableObserver = config.Bind<bool>("6-落点观察窗", "启用落点观察窗", true, "为投掷类道具(魔豆/云雾菇/踏板菇/曲迁菇/灵药菇/炸药/通用投掷物)在屏幕角落显示一个小窗,用独立相机聚焦落点,方便看清落点位置。发射类(反重卡/治疗飞镖、绳索炮、锁链)不显示。");
			ObserverWidth = config.Bind<float>("6-落点观察窗", "观察窗宽度(像素)", 360f, new ConfigDescription("小窗宽度,高度按 16:9 自动计算。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(120f, 960f), Array.Empty<object>()));
			ObserverX = config.Bind<float>("6-落点观察窗", "观察窗 X(像素)", 1385f, "小窗左边距。按住位置调整修饰键(默认右 Alt)+ 方向键可随时摆放;按住修饰键时即使没有预测也会显示占位小窗。");
			ObserverY = config.Bind<float>("6-落点观察窗", "观察窗 Y(像素)", 700f, "小窗上边距。");
			ObserverDistance = config.Bind<float>("6-落点观察窗", "观察窗相机距离(米)", 4f, new ConfigDescription("小窗相机到落点的固定距离(不再随地形变化,避免闪烁)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			ObserverElevation = config.Bind<float>("6-落点观察窗", "观察窗俯仰角(度)", 25f, new ConfigDescription("小窗相机相对落点表面的抬高角度。墙面略有俯角、地面俯视、天花板仰视。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-30f, 89f), Array.Empty<object>()));
			ObserverFov = config.Bind<float>("6-落点观察窗", "观察窗视野角度(度)", 60f, new ConfigDescription("小窗相机视野角,越大越广角。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 110f), Array.Empty<object>()));
			ObserverDragModifier = config.Bind<KeyCode>("6-落点观察窗", "观察窗位置调整修饰键", (KeyCode)307, "按住此键时:方向键(↑↓←→)移动小窗位置,加号/减号(= / - 或小键盘)缩放小窗大小;同时即使没有预测也会显示占位小窗。打开菜单/物品轮盘、光标解锁时,也可按住此键并用鼠标左键拖动。");
			DebugLog = config.Bind<bool>("5-高级", "调试日志", false, "输出详细调试日志,排查问题用。");
			EnablePrecision = config.Bind<bool>("5-高级", "启用精确物理预览", true, "按住精确预览键时,在场景里用**游戏真实物理**跑完整条轨迹,给出与游戏完全一致的落点。它不复制任何几何、不创建物理场景,因此不产生卡顿;代价是需要按真实时间等 1~2 秒。绳索炮只有这一种预览方式。");
			PrecisionKey = config.Bind<KeyCode>("5-高级", "精确预览按键", (KeyCode)324, "按住此键启动精确物理预览,松开立即取消。默认鼠标右键。");
		}
	}
	internal sealed class ConfigWatcher : MonoBehaviour
	{
		internal static bool SuppressNextReload;

		private DateTime _lastWrite = DateTime.MinValue;

		private float _timer;

		private void Start()
		{
			RefreshTimestamp();
		}

		private void Update()
		{
			_timer += Time.unscaledDeltaTime;
			if (_timer < 1f)
			{
				return;
			}
			_timer = 0f;
			if (SuppressNextReload)
			{
				SuppressNextReload = false;
				RefreshTimestamp();
				return;
			}
			UltimatePredictionPlugin instance = UltimatePredictionPlugin.Instance;
			if ((Object)(object)instance == (Object)null || ((BaseUnityPlugin)instance).Config == null)
			{
				return;
			}
			string configFilePath = ((BaseUnityPlugin)instance).Config.ConfigFilePath;
			if (string.IsNullOrEmpty(configFilePath) || !File.Exists(configFilePath))
			{
				return;
			}
			try
			{
				DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(configFilePath);
				if (lastWriteTimeUtc == _lastWrite)
				{
					return;
				}
				_lastWrite = lastWriteTimeUtc;
				((BaseUnityPlugin)instance).Config.Reload();
				Cfg.Revision++;
				try
				{
					if (File.Exists(configFilePath))
					{
						_lastWrite = File.GetLastWriteTimeUtc(configFilePath);
					}
				}
				catch
				{
				}
				ManualLogSource log = UltimatePredictionPlugin.Log;
				if (log != null)
				{
					log.LogInfo((object)"[UP] 检测到配置文件变化,已热重载。");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = UltimatePredictionPlugin.Log;
				if (log2 != null)
				{
					log2.LogWarning((object)("[UP] 配置热重载失败:" + ex.Message));
				}
			}
		}

		private void RefreshTimestamp()
		{
			try
			{
				UltimatePredictionPlugin instance = UltimatePredictionPlugin.Instance;
				if ((Object)(object)instance != (Object)null && ((BaseUnityPlugin)instance).Config != null && File.Exists(((BaseUnityPlugin)instance).Config.ConfigFilePath))
				{
					_lastWrite = File.GetLastWriteTimeUtc(((BaseUnityPlugin)instance).Config.ConfigFilePath);
				}
			}
			catch
			{
			}
		}
	}
	internal static class GameUtil
	{
		internal static bool IsTerrainLayer(int layer)
		{
			return (((LayerMask)(ref HelperFunctions.terrainMapMask)).value & (1 << layer)) != 0;
		}

		internal static int CollisionMaskForLayer(int layer)
		{
			int num = 0;
			for (int i = 0; i < 32; i++)
			{
				if (!Physics.GetIgnoreLayerCollision(layer, i))
				{
					num |= 1 << i;
				}
			}
			return num;
		}

		internal static int WorldMaskForLayer(int layer)
		{
			int mask = LayerMask.GetMask(new string[3] { "Terrain", "Map", "Default" });
			int num = 0;
			for (int i = 0; i < 32; i++)
			{
				if ((mask & (1 << i)) != 0 && !Physics.GetIgnoreLayerCollision(layer, i))
				{
					num |= 1 << i;
				}
			}
			return num;
		}

		internal static Vector3 LookDirection(Vector2 lookValues)
		{
			//IL_0000: 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_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_001c: 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_0038: 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)
			Vector3 val = Quaternion.Euler(0f - lookValues.y, lookValues.x, 0f) * Vector3.forward;
			if (((Vector3)(ref val)).sqrMagnitude < 1E-06f)
			{
				return Vector3.forward;
			}
			return ((Vector3)(ref val)).normalized;
		}

		internal static Vector3 ComputeThrowVelocity(Item item, Vector3 lookDir, float chargeForce)
		{
			//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_000c: 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_001c: 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_002b: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = lookDir * chargeForce * 0.5f * item.throwForceMultiplier;
			if ((Object)(object)item.rig != (Object)null)
			{
				val += item.rig.linearVelocity;
			}
			return val;
		}

		internal static Vector3 ComputeThrowAngularVelocity(Item item, Vector3 lookDir, float chargeForce)
		{
			//IL_0001: 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_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_0038: 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)
			if (((Enum)item.itemTags).HasFlag((Enum)(object)(ItemTags)1024))
			{
				return Vector3.zero;
			}
			return Vector3.Cross(lookDir, Vector3.up) * chargeForce * 0.5f;
		}

		internal static float GetItemRadius(Item item)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01a7: 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_0140: 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_014b: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: 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_0105: 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_00e8: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			if ((Object)(object)item != (Object)null && item.colliders != null)
			{
				for (int i = 0; i < item.colliders.Length; i++)
				{
					Collider val = item.colliders[i];
					if ((Object)(object)val == (Object)null || val.isTrigger || !val.enabled)
					{
						continue;
					}
					Vector3 lossyScale = ((Component)val).transform.lossyScale;
					SphereCollider val2 = (SphereCollider)(object)((val is SphereCollider) ? val : null);
					float num2;
					if (val2 != null)
					{
						num2 = val2.radius * Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Max(Mathf.Abs(lossyScale.y), Mathf.Abs(lossyScale.z)));
					}
					else
					{
						CapsuleCollider val3 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null);
						if (val3 != null)
						{
							float num3 = ((val3.direction == 0) ? Mathf.Max(Mathf.Abs(lossyScale.y), Mathf.Abs(lossyScale.z)) : ((val3.direction == 2) ? Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.y)) : Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.z))));
							num2 = val3.radius * num3;
						}
						else
						{
							BoxCollider val4 = (BoxCollider)(object)((val is BoxCollider) ? val : null);
							if (val4 != null)
							{
								Vector3 val5 = Vector3.Scale(val4.size * 0.5f, lossyScale);
								num2 = (Mathf.Abs(val5.x) + Mathf.Abs(val5.y) + Mathf.Abs(val5.z)) / 3f;
							}
							else
							{
								Bounds bounds = val.bounds;
								Vector3 extents = ((Bounds)(ref bounds)).extents;
								num2 = (Mathf.Abs(extents.x) + Mathf.Abs(extents.y) + Mathf.Abs(extents.z)) / 3f;
							}
						}
					}
					if (num2 > num)
					{
						num = num2;
					}
				}
			}
			if (num < 0.02f)
			{
				num = 0.12f;
			}
			return Mathf.Clamp(num, 0.05f, 0.6f);
		}

		internal static float GetHitBounciness(Collider col)
		{
			if ((Object)(object)col != (Object)null && (Object)(object)col.sharedMaterial != (Object)null)
			{
				return Mathf.Clamp01(col.sharedMaterial.bounciness);
			}
			return 0f;
		}

		internal static float GetHitFriction(Collider col)
		{
			if ((Object)(object)col != (Object)null && (Object)(object)col.sharedMaterial != (Object)null)
			{
				return Mathf.Max(0f, col.sharedMaterial.dynamicFriction);
			}
			return 0.6f;
		}

		internal static float GetHitStaticFriction(Collider col)
		{
			if ((Object)(object)col != (Object)null && (Object)(object)col.sharedMaterial != (Object)null)
			{
				return Mathf.Max(0f, col.sharedMaterial.staticFriction);
			}
			return 0.6f;
		}

		internal static PhysicsMaterialCombine GetHitBounceCombine(Collider col)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)col != (Object)null) || !((Object)(object)col.sharedMaterial != (Object)null))
			{
				return (PhysicsMaterialCombine)0;
			}
			return col.sharedMaterial.bounceCombine;
		}

		internal static PhysicsMaterialCombine GetHitFrictionCombine(Collider col)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)col != (Object)null) || !((Object)(object)col.sharedMaterial != (Object)null))
			{
				return (PhysicsMaterialCombine)0;
			}
			return col.sharedMaterial.frictionCombine;
		}

		internal static string PrefabNameOf(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return null;
			}
			string text = ((Object)((Component)item).gameObject).name;
			if (text.EndsWith("(Clone)"))
			{
				text = text.Substring(0, text.Length - "(Clone)".Length);
			}
			return text;
		}

		internal static GameObject LoadItemPrefab(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			GameObject val = Resources.Load<GameObject>("0_Items/" + name);
			if ((Object)(object)val == (Object)null)
			{
				val = Resources.Load<GameObject>(name);
			}
			return val;
		}

		internal static void SetLayerRecursively(GameObject go, int layer)
		{
			if (!((Object)(object)go == (Object)null))
			{
				go.layer = layer;
				for (int i = 0; i < go.transform.childCount; i++)
				{
					SetLayerRecursively(((Component)go.transform.GetChild(i)).gameObject, layer);
				}
			}
		}

		internal static Quaternion FromUpAndRightPrioUp(Vector3 wantedRight, Vector3 wantedUp)
		{
			//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_000a: 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_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_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_0063: 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_0065: 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_0043: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 normalized = ((Vector3)(ref wantedUp)).normalized;
			Vector3 val = Vector3.ProjectOnPlane(wantedRight, normalized);
			Vector3 val2 = Vector3.Cross(((Vector3)(ref val)).normalized, normalized);
			if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f)
			{
				val2 = Vector3.Cross((((Vector3)(ref wantedRight)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref wantedRight)).normalized : Vector3.forward, normalized);
			}
			if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f)
			{
				return Quaternion.identity;
			}
			return Quaternion.LookRotation(val2, normalized);
		}
	}
	internal enum SimMode
	{
		Full,
		FirstAnyImpact,
		FirstTerrainImpact,
		FirstWarpImpact,
		FirstVelocityBreak
	}
	internal struct StopRule
	{
		public SimMode Mode;

		public float MinSpeed;

		public float MinTime;

		public float MaxTime;

		public float BreakVy;

		public bool HasBreakVy;
	}
	internal struct SimImpact
	{
		public Vector3 Point;

		public Vector3 Normal;

		public int Layer;

		public float Speed;

		public float Time;
	}
	internal enum CastShape
	{
		Sphere,
		Capsule,
		Box,
		Hull
	}
	internal sealed class ShapeProbe
	{
		internal Collider Source;

		internal CastShape Shape;

		internal Vector3 LocalCenter;

		internal Quaternion LocalRotation = Quaternion.identity;

		internal Vector3 LocalPosePosition;

		internal Quaternion LocalPoseRotation = Quaternion.identity;

		internal float Radius;

		internal float CapRadius;

		internal float CapHeight;

		internal int CapDirection;

		internal Vector3 BoxHalf;

		internal Vector3[] HullPoints;

		internal Vector3 LastSupportLocal;

		internal float Bounciness;

		internal float Friction;

		internal float StaticFriction;

		internal PhysicsMaterialCombine BounceCombine;

		internal PhysicsMaterialCombine FrictionCombine;

		internal float ContactOffset = 0.01f;

		internal float BoundingRadius()
		{
			switch (Shape)
			{
			case CastShape.Sphere:
				return Radius;
			case CastShape.Capsule:
				return CapHeight * 0.5f + CapRadius;
			case CastShape.Hull:
			{
				float num = 0f;
				for (int i = 0; i < HullPoints.Length; i++)
				{
					num = Mathf.Max(num, ((Vector3)(ref HullPoints[i])).magnitude);
				}
				return num;
			}
			default:
				return ((Vector3)(ref BoxHalf)).magnitude;
			}
		}

		internal Vector3 WorldCenter(Vector3 rootPos, Quaternion rootRot)
		{
			//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_0003: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			return rootPos + rootRot * LocalCenter;
		}

		internal Quaternion WorldRotation(Quaternion rootRot)
		{
			//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)
			return rootRot * LocalRotation;
		}

		internal float Support(Vector3 n, Quaternion worldRot)
		{
			//IL_0029: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_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_00cb: 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_00d1: 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_00e3: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			switch (Shape)
			{
			case CastShape.Sphere:
				return Radius;
			case CastShape.Capsule:
			{
				Vector3 val4 = worldRot * DirectionVector(CapDirection);
				float num3 = Mathf.Max(0f, CapHeight * 0.5f - CapRadius);
				return CapRadius + num3 * Mathf.Abs(Vector3.Dot(val4, n));
			}
			case CastShape.Hull:
			{
				float num = 0f;
				for (int i = 0; i < HullPoints.Length; i++)
				{
					float num2 = Vector3.Dot(worldRot * HullPoints[i], n);
					if (num2 > num)
					{
						num = num2;
					}
				}
				return num;
			}
			default:
			{
				Vector3 val = worldRot * Vector3.right;
				Vector3 val2 = worldRot * Vector3.up;
				Vector3 val3 = worldRot * Vector3.forward;
				return Mathf.Abs(BoxHalf.x * Vector3.Dot(n, val)) + Mathf.Abs(BoxHalf.y * Vector3.Dot(n, val2)) + Mathf.Abs(BoxHalf.z * Vector3.Dot(n, val3));
			}
			}
		}

		internal static Vector3 DirectionVector(int dir)
		{
			//IL_0009: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			return (Vector3)(dir switch
			{
				0 => Vector3.right, 
				2 => Vector3.forward, 
				_ => Vector3.up, 
			});
		}
	}
	internal sealed class InstantPredictor
	{
		private const float MaxTime = 6f;

		private const int MaxSteps = 900;

		private const int MaxBounces = 20;

		private const float RestSpeed = 0.45f;

		private const float RestHold = 0.25f;

		private const float MinCastStep = 0.8f;

		private const int MaxCastSteps = 4;

		private const float SettleTime = 2.5f;

		internal readonly List<Vector3> Path = new List<Vector3>(256);

		internal readonly List<Vector3> Velocities = new List<Vector3>(256);

		internal readonly List<float> Times = new List<float>(256);

		internal readonly List<SimImpact> Impacts = new List<SimImpact>(8);

		internal Vector3 RestPoint;

		internal bool Rested;

		internal bool TimedOut;

		internal bool Finished;

		internal float TotalTime;

		internal int BounceCount;

		internal int CastCount;

		internal float LastCostMs;

		private readonly List<ShapeProbe> _probes = new List<ShapeProbe>(4);

		private readonly RaycastHit[] _castHits = (RaycastHit[])(object)new RaycastHit[64];

		private readonly Collider[] _overlapHits = (Collider[])(object)new Collider[32];

		private Item _item;

		private Character _owner;

		private int _mask;

		private int _itemLayer;

		private float _castStep;

		private float _drag;

		private float _angDrag;

		private float _maxAngularSpeed;

		private float _bounceThreshold;

		private StopRule _stopRule;

		private int _bounceCap = 20;

		private Basketball _basketball;

		private float _basketballXzLoss;

		private float _basketballYFall;

		private bool _ignoreOwner;

		private Collider _lastImpactCollider;

		private Vector3 _lastImpactNormal;

		private float _lastImpactTime = -999f;

		internal string StopReason = "未运行";

		private static readonly Dictionary<int, Vector3[]> _rawHullCache = new Dictionary<int, Vector3[]>();

		private static readonly Dictionary<(int, Vector3), Vector3[]> _scaledHullCache = new Dictionary<(int, Vector3), Vector3[]>();

		internal bool HasImpact => Impacts.Count > 0;

		internal SimImpact FirstImpact => Impacts[0];

		private static bool IsFinite(float f)
		{
			if (!float.IsNaN(f))
			{
				return !float.IsInfinity(f);
			}
			return false;
		}

		private static bool IsFinite(Vector3 v)
		{
			//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			if (IsFinite(v.x) && IsFinite(v.y))
			{
				return IsFinite(v.z);
			}
			return false;
		}

		private static bool IsFinite(Quaternion q)
		{
			//IL_0000: 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_001a: 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 (IsFinite(q.x) && IsFinite(q.y) && IsFinite(q.z))
			{
				return IsFinite(q.w);
			}
			return false;
		}

		internal void Reset()
		{
			//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)
			Path.Clear();
			Velocities.Clear();
			Times.Clear();
			Impacts.Clear();
			RestPoint = Vector3.zero;
			Rested = false;
			TimedOut = false;
			Finished = false;
			TotalTime = 0f;
			BounceCount = 0;
			CastCount = 0;
			StopReason = "运行中";
			_lastImpactCollider = null;
			_lastImpactTime = -999f;
		}

		internal void Simulate(Item item, Character owner, Vector3 startPos, Quaternion startRot, Vector3 startVel, Vector3 startAngVel, StopRule stopRule = default(StopRule))
		{
			//IL_0043: 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_0054: 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_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_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: 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_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: 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_02b8: 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_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			Reset();
			_item = item;
			_owner = owner;
			_stopRule = stopRule;
			SimMode mode = stopRule.Mode;
			_bounceCap = ((mode == SimMode.Full || mode == SimMode.FirstWarpImpact) ? 100000 : 20);
			if ((Object)(object)item == (Object)null || !IsFinite(startPos) || !IsFinite(startRot) || !IsFinite(startVel) || !IsFinite(startAngVel) || ((Vector3)(ref startVel)).sqrMagnitude < 0.0001f)
			{
				StopReason = "初值无效";
				return;
			}
			if (!BuildProbes(item))
			{
				StopReason = "无可用碰撞体";
				return;
			}
			_basketball = ((Component)item).GetComponentInChildren<Basketball>(true);
			if ((Object)(object)_basketball != (Object)null)
			{
				_basketballXzLoss = _basketball.xzBounceLoss;
				_basketballYFall = _basketball.yFall;
			}
			_mask = GameUtil.CollisionMaskForLayer(((Component)item).gameObject.layer);
			_itemLayer = ((Component)item).gameObject.layer;
			_drag = (((Object)(object)item.rig != (Object)null) ? Mathf.Max(0f, item.rig.linearDamping) : 0f);
			_angDrag = (((Object)(object)item.rig != (Object)null) ? Mathf.Max(0f, item.rig.angularDamping) : 0f);
			_maxAngularSpeed = (((Object)(object)item.rig != (Object)null && item.rig.maxAngularVelocity > 0.01f) ? item.rig.maxAngularVelocity : Physics.defaultMaxAngularSpeed);
			_bounceThreshold = Mathf.Max(0f, Physics.bounceThreshold);
			float num = 0.15f;
			for (int i = 0; i < _probes.Count; i++)
			{
				num = Mathf.Max(num, _probes[i].Support(Vector3.up, Quaternion.identity));
			}
			_castStep = Mathf.Max(0.8f, num * 3f);
			float num2 = Mathf.Clamp(Time.fixedDeltaTime, 0.005f, 0.05f);
			Vector3 gravity = Physics.gravity;
			Vector3 p = startPos;
			Quaternion rot = startRot;
			Vector3 v = startVel;
			Vector3 w = startAngVel;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			_ignoreOwner = true;
			Depenetrate(ref p, ref rot);
			Path.Add(p);
			Velocities.Add(v);
			Times.Add(num3);
			Vector3 val = p;
			Quaternion val2 = rot;
			int num6 = 0;
			int num7 = Mathf.Max(900, Mathf.CeilToInt(6f / num2) + 4);
			for (int j = 0; j < num7; j++)
			{
				_ignoreOwner = num3 < 0.5f;
				v += gravity * num2;
				if (_drag > 0f)
				{
					v *= Mathf.Max(0f, 1f - _drag * num2);
				}
				if (_angDrag > 0f && ((Vector3)(ref w)).sqrMagnitude > 1E-08f)
				{
					w *= Mathf.Max(0f, 1f - _angDrag * num2);
				}
				if (((Vector3)(ref w)).sqrMagnitude > 1E-08f)
				{
					float magnitude = ((Vector3)(ref w)).magnitude;
					if (magnitude > _maxAngularSpeed)
					{
						w *= _maxAngularSpeed / magnitude;
					}
				}
				p += v * num2;
				if (((Vector3)(ref w)).sqrMagnitude > 1E-08f)
				{
					float magnitude2 = ((Vector3)(ref w)).magnitude;
					rot = Quaternion.Normalize(Quaternion.AngleAxis(magnitude2 * num2 * 57.29578f, w / magnitude2) * rot);
				}
				num3 += num2;
				if (!IsFinite(p) || !IsFinite(v) || !IsFinite(w))
				{
					StopReason = "非有限值";
					RestPoint = p;
					TotalTime = num3;
					return;
				}
				num6++;
				Vector3 seg = p - val;
				if (((Vector3)(ref seg)).sqrMagnitude >= _castStep * _castStep || num6 >= 4 || j == num7 - 1)
				{
					num6 = 0;
					if (((Vector3)(ref seg)).sqrMagnitude > 1E-08f && Sweep(val, val2, seg, out var hit, out var probe))
					{
						if (Resolve(ref p, ref rot, ref v, ref w, hit, probe, val2, num3, seg, mode))
						{
							Path.Add(p);
							Velocities.Add(v);
							Times.Add(num3);
							TotalTime = num3;
							return;
						}
						val = p;
						val2 = rot;
					}
					else
					{
						Depenetrate(ref p, ref rot);
						val = p;
						val2 = rot;
					}
				}
				if (mode == SimMode.FirstVelocityBreak && _stopRule.HasBreakVy && num3 - num2 > _stopRule.MinTime && v.y < _stopRule.BreakVy)
				{
					StopReason = "云雾菇空中破碎";
					Path.Add(p);
					Velocities.Add(v);
					Times.Add(num3);
					RestPoint = p;
					TotalTime = num3;
					return;
				}
				Path.Add(p);
				Velocities.Add(v);
				Times.Add(num3);
				if (((Vector3)(ref v)).sqrMagnitude < 0.20249999f)
				{
					num4 += num2;
					if (num4 >= 0.25f)
					{
						StopReason = "静止";
						RestPoint = p;
						Rested = true;
						TotalTime = num3;
						return;
					}
				}
				else
				{
					num4 = 0f;
				}
				if (HasImpact)
				{
					if (((Vector3)(ref v)).sqrMagnitude < _bounceThreshold * _bounceThreshold)
					{
						num5 += num2;
						if (num5 >= 2.5f)
						{
							StopReason = "撞击后滑行超时";
							RestPoint = p;
							Rested = true;
							TotalTime = num3;
							return;
						}
					}
					else
					{
						num5 = 0f;
					}
				}
				if (num3 >= 6f)
				{
					StopReason = "最大时间";
					TimedOut = true;
					RestPoint = p;
					TotalTime = num3;
					return;
				}
			}
			StopReason = "最大步数";
			RestPoint = p;
			TotalTime = num3;
			TimedOut = true;
		}

		private bool Sweep(Vector3 origin, Quaternion rot, Vector3 seg, out RaycastHit hit, out ShapeProbe probe)
		{
			//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_000d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0058: 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_005e: 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_00a7: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: 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_013f: 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_0145: 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_014c: 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_016c: 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_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)
			//IL_01a8: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: 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_01d5: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: 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_02f4: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = seg / ((Vector3)(ref seg)).magnitude;
			float magnitude = ((Vector3)(ref seg)).magnitude;
			float num = float.MaxValue;
			hit = default(RaycastHit);
			probe = null;
			CastCount++;
			for (int i = 0; i < _probes.Count; i++)
			{
				ShapeProbe shapeProbe = _probes[i];
				Vector3 val2 = shapeProbe.WorldCenter(origin, rot);
				Quaternion val3 = shapeProbe.WorldRotation(rot);
				float num2 = 0f;
				float num3 = shapeProbe.ContactOffset + Physics.defaultContactOffset;
				int num4;
				switch (shapeProbe.Shape)
				{
				case CastShape.Sphere:
					num4 = Physics.SphereCastNonAlloc(val2, shapeProbe.Radius + num3, val, _castHits, magnitude, _mask, (QueryTriggerInteraction)1);
					break;
				case CastShape.Capsule:
				{
					Vector3 val7 = val3 * ShapeProbe.DirectionVector(shapeProbe.CapDirection);
					float num8 = Mathf.Max(0f, shapeProbe.CapHeight * 0.5f - shapeProbe.CapRadius);
					num4 = Physics.CapsuleCastNonAlloc(val2 + val7 * num8, val2 - val7 * num8, shapeProbe.CapRadius + num3, val, _castHits, magnitude, _mask, (QueryTriggerInteraction)1);
					break;
				}
				case CastShape.Hull:
				{
					Vector3 val4 = Quaternion.Inverse(val3) * val;
					Vector3 val5 = Vector3.zero;
					float num5 = float.MinValue;
					Vector3[] hullPoints = shapeProbe.HullPoints;
					for (int j = 0; j < hullPoints.Length; j++)
					{
						float num6 = Vector3.Dot(hullPoints[j], val4);
						if (num6 > num5)
						{
							num5 = num6;
							val5 = hullPoints[j];
						}
					}
					shapeProbe.LastSupportLocal = val5;
					Vector3 val6 = val2 + val3 * val5;
					float num7 = shapeProbe.ContactOffset + Physics.defaultContactOffset;
					num4 = Physics.RaycastNonAlloc(val6 + val * 0.002f, val, _castHits, magnitude + 0.002f + num7, _mask, (QueryTriggerInteraction)1);
					num2 = 0.002f;
					break;
				}
				default:
					num4 = Physics.BoxCastNonAlloc(val2, shapeProbe.BoxHalf + Vector3.one * num3, val, _castHits, val3, magnitude, _mask, (QueryTriggerInteraction)1);
					break;
				}
				for (int k = 0; k < num4; k++)
				{
					RaycastHit val8 = _castHits[k];
					if ((Object)(object)((RaycastHit)(ref val8)).collider == (Object)null || IsIgnored(((RaycastHit)(ref val8)).collider) || ((RaycastHit)(ref val8)).distance <= 0f || !IsFinite(((RaycastHit)(ref val8)).distance) || !IsFinite(((RaycastHit)(ref val8)).point) || !IsFinite(((RaycastHit)(ref val8)).normal))
					{
						continue;
					}
					Vector3 val9 = ((RaycastHit)(ref val8)).point;
					if (((Vector3)(ref val9)).sqrMagnitude < 1E-06f)
					{
						continue;
					}
					val9 = ((RaycastHit)(ref val8)).normal;
					if (!(((Vector3)(ref val9)).sqrMagnitude < 1E-06f))
					{
						float num9 = ((RaycastHit)(ref val8)).distance + num2;
						if (IsFinite(num9) && num9 < num)
						{
							num = num9;
							hit = val8;
							probe = shapeProbe;
						}
					}
				}
			}
			return probe != null;
		}

		private bool Depenetrate(ref Vector3 p, ref Quaternion rot)
		{
			//IL_002f: 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_008d: 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_0099: 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_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_00ab: 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_00b6: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00dc: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_013a: 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_0142: 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_014c: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_016e: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_01f8: 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_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			bool result = false;
			Vector3 val4 = default(Vector3);
			float num3 = default(float);
			for (int i = 0; i < _probes.Count; i++)
			{
				ShapeProbe shapeProbe = _probes[i];
				if ((Object)(object)shapeProbe.Source == (Object)null)
				{
					continue;
				}
				int num2 = Physics.OverlapSphereNonAlloc(shapeProbe.WorldCenter(p, rot), shapeProbe.BoundingRadius() + 0.02f, _overlapHits, _mask, (QueryTriggerInteraction)1);
				for (int j = 0; j < num2; j++)
				{
					Collider val = _overlapHits[j];
					if ((Object)(object)val == (Object)null || IsIgnored(val))
					{
						continue;
					}
					Vector3 val2 = p + rot * shapeProbe.LocalPosePosition;
					Quaternion val3 = rot * shapeProbe.LocalPoseRotation;
					if (Physics.ComputePenetration(shapeProbe.Source, val2, val3, val, ((Component)val).transform.position, ((Component)val).transform.rotation, ref val4, ref num3) && IsFinite(val4) && IsFinite(num3) && !(num3 <= 0f))
					{
						float num4 = shapeProbe.ContactOffset + Physics.defaultContactOffset;
						if (shapeProbe.Shape == CastShape.Box)
						{
							Vector3 val5 = rot * Vector3.right;
							Vector3 val6 = rot * Vector3.up;
							Vector3 val7 = rot * Vector3.forward;
							float num5 = Mathf.Abs(Vector3.Dot(val4, val5)) + Mathf.Abs(Vector3.Dot(val4, val6)) + Mathf.Abs(Vector3.Dot(val4, val7));
							num4 *= Mathf.Max(1f, num5);
						}
						float num6 = num3 + num4 + 0.002f;
						float num7 = shapeProbe.BoundingRadius() * 2f + 0.5f;
						if (num6 > num7)
						{
							num6 = num7;
						}
						if (num + num6 > 5f)
						{
							num6 = Mathf.Max(0f, 5f - num);
						}
						if (!(num6 <= 0f))
						{
							p += val4 * num6;
							num += num6;
							result = true;
						}
					}
				}
			}
			return result;
		}

		private bool Resolve(ref Vector3 p, ref Quaternion rot, ref Vector3 v, ref Vector3 w, RaycastHit hit, ShapeProbe probe, Quaternion castRot, float t, Vector3 seg, SimMode mode)
		{
			//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_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_0045: 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_00d5: 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_00dc: 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_0093: 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_009f: 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_00fe: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_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_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_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_0137: 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_0141: 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_01c6: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: 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_0156: 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_015c: 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_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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0199: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: 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_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: 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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: 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_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: 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_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: 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_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 normal = ((RaycastHit)(ref hit)).normal;
			float magnitude = ((Vector3)(ref v)).magnitude;
			int layer = ((Component)((RaycastHit)(ref hit)).collider).gameObject.layer;
			bool num = (Object)(object)((RaycastHit)(ref hit)).collider == (Object)(object)_lastImpactCollider && t - _lastImpactTime < 0.15f && Vector3.Dot(normal, _lastImpactNormal) > 0.99f && magnitude < 1f;
			_lastImpactCollider = ((RaycastHit)(ref hit)).collider;
			_lastImpactNormal = normal;
			_lastImpactTime = t;
			if (!num)
			{
				Impacts.Add(new SimImpact
				{
					Point = ((RaycastHit)(ref hit)).point,
					Normal = normal,
					Layer = layer,
					Speed = magnitude,
					Time = t
				});
				BounceCount++;
			}
			Quaternion val = probe.WorldRotation(castRot);
			float num2 = probe.ContactOffset + Physics.defaultContactOffset;
			Vector3 val2 = p;
			Vector3 val4;
			if (probe.Shape == CastShape.Hull)
			{
				Vector3 val3 = castRot * probe.LocalCenter + val * probe.LastSupportLocal;
				val4 = ((RaycastHit)(ref hit)).point - val3 + normal * (num2 + 0.002f);
			}
			else
			{
				float num3 = num2;
				if (probe.Shape == CastShape.Box)
				{
					Vector3 val5 = val * Vector3.right;
					Vector3 val6 = val * Vector3.up;
					Vector3 val7 = val * Vector3.forward;
					float num4 = Mathf.Abs(Vector3.Dot(normal, val5)) + Mathf.Abs(Vector3.Dot(normal, val6)) + Mathf.Abs(Vector3.Dot(normal, val7));
					num3 = num2 * Mathf.Max(1f, num4);
				}
				float num5 = probe.Support(normal, val);
				val4 = ((RaycastHit)(ref hit)).point + normal * (num5 + num3 + 0.002f);
			}
			float num6 = ((Vector3)(ref seg)).magnitude + probe.BoundingRadius() * 2f + 0.5f;
			if (IsFinite(val4))
			{
				Vector3 val8 = val4 - val2;
				if (((Vector3)(ref val8)).sqrMagnitude <= num6 * num6)
				{
					p = val4;
				}
			}
			float num7 = Vector3.Dot(v, normal);
			Vector3 val9 = num7 * normal;
			Vector3 val10 = v - val9;
			float num8 = CombineValue(probe.Bounciness, probe.BounceCombine, GameUtil.GetHitBounciness(((RaycastHit)(ref hit)).collider), GameUtil.GetHitBounceCombine(((RaycastHit)(ref hit)).collider));
			if (num8 > 0f && num7 >= 0f - _bounceThreshold)
			{
				num8 = 0f;
			}
			float num9 = CombineValue(probe.Friction, probe.FrictionCombine, GameUtil.GetHitFriction(((RaycastHit)(ref hit)).collider), GameUtil.GetHitFrictionCombine(((RaycastHit)(ref hit)).collider));
			float num10 = CombineValue(probe.StaticFriction, probe.FrictionCombine, GameUtil.GetHitStaticFriction(((RaycastHit)(ref hit)).collider), GameUtil.GetHitFrictionCombine(((RaycastHit)(ref hit)).collider));
			if (num10 < num9)
			{
				num10 = num9;
			}
			float num11 = (1f + num8) * Mathf.Max(0f, 0f - num7);
			float magnitude2 = ((Vector3)(ref val10)).magnitude;
			if (magnitude2 > 0.0001f)
			{
				float num12 = magnitude2;
				float num13 = Mathf.Min(((num12 <= num10 * num11) ? num10 : num9) * num11, num12);
				val10 -= val10 / magnitude2 * num13;
			}
			v = val10 - num8 * val9;
			if ((Object)(object)_basketball != (Object)null && (Object)(object)((RaycastHit)(ref hit)).collider != (Object)null && (Object)(object)((RaycastHit)(ref hit)).collider.attachedRigidbody == (Object)null && Mathf.Abs(Vector3.Dot(normal, Vector3.up)) < 0.2f)
			{
				v = new Vector3(v.x * _basketballXzLoss, v.y - _basketballYFall, v.z * _basketballXzLoss);
			}
			w *= 0.6f;
			if (mode switch
			{
				SimMode.FirstAnyImpact => magnitude > _stopRule.MinSpeed, 
				SimMode.FirstTerrainImpact => GameUtil.IsTerrainLayer(layer), 
				SimMode.FirstWarpImpact => GameUtil.IsTerrainLayer(layer) && magnitude > _stopRule.MinSpeed && t > _stopRule.MinTime && t < _stopRule.MaxTime, 
				_ => false, 
			})
			{
				StopReason = ((mode == SimMode.FirstTerrainImpact) ? "地形种植" : "撞击消耗");
				RestPoint = ((RaycastHit)(ref hit)).point;
				TotalTime = t;
				return true;
			}
			if (BounceCount >= _bounceCap)
			{
				StopReason = "弹跳上限";
				RestPoint = p;
				Rested = true;
				TotalTime = t;
				return true;
			}
			if (normal.y > 0.5f && ((Vector3)(ref v)).sqrMagnitude < 0.5f)
			{
				StopReason = "低速落地";
				RestPoint = p;
				Rested = true;
				TotalTime = t;
				return true;
			}
			return false;
		}

		internal static float CombineValue(float a, PhysicsMaterialCombine modeA, float b, PhysicsMaterialCombine modeB)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected I4, but got Unknown
			PhysicsMaterialCombine val = HigherPriority(modeA, modeB);
			return (val - 1) switch
			{
				1 => Mathf.Min(a, b), 
				0 => a * b, 
				2 => Mathf.Max(a, b), 
				_ => (a + b) * 0.5f, 
			};
		}

		internal static PhysicsMaterialCombine HigherPriority(PhysicsMaterialCombine a, PhysicsMaterialCombine b)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Priority(a) < Priority(b))
			{
				return b;
			}
			return a;
		}

		private static int Priority(PhysicsMaterialCombine m)
		{
			//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_0014: Expected I4, but got Unknown
			return (m - 1) switch
			{
				1 => 1, 
				0 => 2, 
				2 => 3, 
				_ => 0, 
			};
		}

		private bool BuildProbes(Item item)
		{
			_probes.Clear();
			Collider[] array = item.colliders;
			if (array == null || array.Length == 0)
			{
				array = ((Component)item).GetComponentsInChildren<Collider>(true);
			}
			if (array == null)
			{
				return false;
			}
			Transform transform = item.transform;
			foreach (Collider val in array)
			{
				if (!((Object)(object)val == (Object)null) && val.enabled && !val.isTrigger && ((Component)val).gameObject.activeInHierarchy)
				{
					ShapeProbe shapeProbe = BuildProbe(val, transform);
					if (shapeProbe != null)
					{
						_probes.Add(shapeProbe);
					}
				}
			}
			return _probes.Count > 0;
		}

		private static ShapeProbe BuildProbe(Collider c, Transform root)
		{
			//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_0019: 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_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_0041: 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_0058: 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_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_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_007a: 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_0097: 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_009f: 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_00b5: 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_00e6: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: 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_0156: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: 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_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: 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_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			Quaternion val = Quaternion.Inverse(root.rotation);
			ShapeProbe shapeProbe = new ShapeProbe
			{
				Source = c,
				LocalCenter = val * (((Component)c).transform.TransformPoint(CenterOf(c)) - root.position),
				LocalRotation = val * ((Component)c).transform.rotation,
				LocalPosePosition = val * (((Component)c).transform.position - root.position),
				LocalPoseRotation = val * ((Component)c).transform.rotation
			};
			Vector3 lossyScale = ((Component)c).transform.lossyScale;
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.y), Mathf.Abs(lossyScale.z));
			SphereCollider val3 = (SphereCollider)(object)((c is SphereCollider) ? c : null);
			if (val3 != null)
			{
				shapeProbe.Shape = CastShape.Sphere;
				shapeProbe.Radius = val3.radius * Mathf.Max(val2.x, Mathf.Max(val2.y, val2.z));
			}
			else
			{
				CapsuleCollider val4 = (CapsuleCollider)(object)((c is CapsuleCollider) ? c : null);
				if (val4 != null)
				{
					shapeProbe.Shape = CastShape.Capsule;
					shapeProbe.CapDirection = val4.direction;
					float num = ((val4.direction == 0) ? Mathf.Max(val2.y, val2.z) : ((val4.direction == 2) ? Mathf.Max(val2.x, val2.y) : Mathf.Max(val2.x, val2.z)));
					shapeProbe.CapRadius = val4.radius * num;
					shapeProbe.CapHeight = Mathf.Max(shapeProbe.CapRadius * 2f, val4.height * ((Vector3)(ref val2))[val4.direction]);
				}
				else
				{
					BoxCollider val5 = (BoxCollider)(object)((c is BoxCollider) ? c : null);
					if (val5 != null)
					{
						shapeProbe.Shape = CastShape.Box;
						shapeProbe.BoxHalf = new Vector3(Mathf.Abs(val5.size.x) * 0.5f * val2.x, Mathf.Abs(val5.size.y) * 0.5f * val2.y, Mathf.Abs(val5.size.z) * 0.5f * val2.z);
					}
					else
					{
						Vector3[] array = null;
						MeshCollider val6 = (MeshCollider)(object)((c is MeshCollider) ? c : null);
						float num2;
						Vector3 val8;
						if (val6 != null && (Object)(object)val6.sharedMesh != (Object)null)
						{
							Bounds bounds = val6.sharedMesh.bounds;
							Vector3 val7 = Vector3.Scale(((Bounds)(ref bounds)).extents, val2);
							num2 = (Mathf.Abs(val7.x) + Mathf.Abs(val7.y) + Mathf.Abs(val7.z)) / 3f;
							val8 = ((Bounds)(ref bounds)).center;
							array = TryReadHull(val6.sharedMesh, val2);
						}
						else
						{
							Bounds bounds2 = c.bounds;
							Vector3 extents = ((Bounds)(ref bounds2)).extents;
							num2 = (Mathf.Abs(extents.x) + Mathf.Abs(extents.y) + Mathf.Abs(extents.z)) / 3f;
							val8 = Vector3.zero;
						}
						if (array != null && array.Length != 0)
						{
							shapeProbe.Shape = CastShape.Hull;
							shapeProbe.HullPoints = array;
						}
						else
						{
							Vector3 localHalfExtents = GetLocalHalfExtents(c, val2);
							float num3 = Mathf.Min(localHalfExtents.x, Mathf.Min(localHalfExtents.y, localHalfExtents.z));
							float num4 = Mathf.Max(localHalfExtents.x, Mathf.Max(localHalfExtents.y, localHalfExtents.z));
							if (num4 > 0.01f && num3 / num4 < 0.6f)
							{
								shapeProbe.Shape = CastShape.Box;
								shapeProbe.BoxHalf = localHalfExtents;
							}
							else
							{
								shapeProbe.Shape = CastShape.Sphere;
								shapeProbe.Radius = Mathf.Clamp(num2, 0.03f, 2f);
							}
							shapeProbe.LocalCenter = Quaternion.Inverse(root.rotation) * (((Component)c).transform.TransformPoint(val8) - root.position);
						}
					}
				}
			}
			PhysicsMaterial sharedMaterial = c.sharedMaterial;
			shapeProbe.ContactOffset = Mathf.Max(0f, c.contactOffset);
			if ((Object)(object)sharedMaterial != (Object)null)
			{
				shapeProbe.Bounciness = Mathf.Clamp01(sharedMaterial.bounciness);
				shapeProbe.Friction = Mathf.Max(0f, sharedMaterial.dynamicFriction);
				shapeProbe.StaticFriction = Mathf.Max(shapeProbe.Friction, Mathf.Max(0f, sharedMaterial.staticFriction));
				shapeProbe.BounceCombine = sharedMaterial.bounceCombine;
				shapeProbe.FrictionCombine = sharedMaterial.frictionCombine;
			}
			else
			{
				shapeProbe.Bounciness = 0f;
				shapeProbe.Friction = 0.6f;
				shapeProbe.StaticFriction = 0.6f;
			}
			return shapeProbe;
		}

		private static Vector3 GetLocalHalfExtents(Collider c, Vector3 abs)
		{
			//IL_0033: 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_003b: 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_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_002c: Unknown result type (might be due to invalid IL or missing references)
			MeshCollider val = (MeshCollider)(object)((c is MeshCollider) ? c : null);
			Bounds bounds;
			if (val != null && (Object)(object)val.sharedMesh != (Object)null)
			{
				bounds = val.sharedMesh.bounds;
				return Vector3.Scale(((Bounds)(ref bounds)).extents, abs);
			}
			bounds = c.bounds;
			return ((Bounds)(ref bounds)).extents;
		}

		private static Vector3[] TryReadHull(Mesh mesh, Vector3 abs)
		{
			//IL_001d: 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_0068: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mesh == (Object)null || !mesh.isReadable)
			{
				return null;
			}
			int instanceID = ((Object)mesh).GetInstanceID();
			(int, Vector3) key = (instanceID, abs);
			if (_scaledHullCache.TryGetValue(key, out var value))
			{
				return value;
			}
			Vector3[] array = ReadRawHull(mesh, instanceID);
			if (array == null)
			{
				_scaledHullCache[key] = null;
				return null;
			}
			Vector3[] array2 = (Vector3[])(object)new Vector3[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array2[i] = Vector3.Scale(array[i], abs);
			}
			_scaledHullCache[key] = array2;
			return array2;
		}

		private static Vector3[] ReadRawHull(Mesh mesh, int id)
		{
			//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)
			if (_rawHullCache.TryGetValue(id, out var value))
			{
				return value;
			}
			Vector3[] array = null;
			try
			{
				Vector3[] vertices = mesh.vertices;
				if (vertices != null && vertices.Length != 0)
				{
					int num = Mathf.Max(1, Mathf.CeilToInt((float)vertices.Length / 256f));
					int num2 = (vertices.Length + num - 1) / num;
					array = (Vector3[])(object)new Vector3[num2];
					int num3 = 0;
					int num4 = 0;
					while (num3 < vertices.Length && num4 < num2)
					{
						array[num4] = vertices[num3];
						num3 += num;
						num4++;
					}
				}
			}
			catch (Exception)
			{
				array = null;
			}
			_rawHullCache[id] = array;
			return array;
		}

		private static Vector3 CenterOf(Collider c)
		{
			//IL_0021: 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_002f: 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)
			SphereCollider val = (SphereCollider)(object)((c is SphereCollider) ? c : null);
			if (val == null)
			{
				CapsuleCollider val2 = (CapsuleCollider)(object)((c is CapsuleCollider) ? c : null);
				if (val2 == null)
				{
					BoxCollider val3 = (BoxCollider)(object)((c is BoxCollider) ? c : null);
					if (val3 != null)
					{
						return val3.center;
					}
					return Vector3.zero;
				}
				return val2.center;
			}
			return val.center;
		}

		private bool IsIgnored(Collider col)
		{
			if ((Object)(object)col == (Object)null)
			{
				return true;
			}
			Transform transform = ((Component)col).transform;
			if ((Object)(object)_item != (Object)null && ((Object)(object)transform == (Object)(object)_item.transform || transform.IsChildOf(_item.transform)))
			{
				return true;
			}
			if (_ignoreOwner && (Object)(object)_owner != (Object)null && ((Object)(object)transform == (Object)(object)((Component)_owner).transform || transform.IsChildOf(((Component)_owner).transform)))
			{
				return true;
			}
			return IsLayerExcluded(col);
		}

		private bool IsLayerExcluded(Collider col)
		{
			//IL_004c: 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_005d: 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_006a: 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)
			int num = 1 << _itemLayer;
			Rigidbody attachedRigidbody = col.attachedRigidbody;
			if ((Object)(object)attachedRigidbody != (Object)null)
			{
				if ((LayerMask.op_Implicit(attachedRigidbody.excludeLayers) & num) != 0)
				{
					return true;
				}
				if (LayerMask.op_Implicit(attachedRigidbody.includeLayers) != 0 && (LayerMask.op_Implicit(attachedRigidbody.includeLayers) & num) == 0)
				{
					return true;
				}
			}
			if ((LayerMask.op_Implicit(col.excludeLayers) & num) != 0)
			{
				return true;
			}
			if (LayerMask.op_Implicit(col.includeLayers) != 0)
			{
				return (LayerMask.op_Implicit(col.includeLayers) & num) == 0;
			}
			return false;
		}

		internal bool TryGetFirstTerrainImpact(out SimImpact impact)
		{
			for (int i = 0; i < Impacts.Count; i++)
			{
				if (GameUtil.IsTerrainLayer(Impacts[i].Layer))
				{
					impact = Impacts[i];
					return true;
				}
			}
			impact = default(SimImpact);
			return false;
		}

		internal bool TryGetFirstImpactAbove(float minSpeed, out SimImpact impact)
		{
			for (int i = 0; i < Impacts.Count; i++)
			{
				if (Impacts[i].Speed > minSpeed)
				{
					impact = Impacts[i];
					return true;
				}
			}
			impact = default(SimImpact);
			return false;
		}

		internal bool TryFindBreakByVelocity(float breakTime, float breakVy, out Vector3 point)
		{
			//IL_004e: 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_002f: 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)
			for (int i = 0; i < Times.Count; i++)
			{
				if (Times[i] > breakTime && Velocities[i].y < breakVy)
				{
					point = Path[i];
					return true;
				}
			}
			point = default(Vector3);
			return false;
		}

		internal bool TryFindImpactInWindow(float minTime, float maxTime, float minVelocity, out SimImpact impact)
		{
			for (int i = 0; i < Impacts.Count; i++)
			{
				SimImpact simImpact = Impacts[i];
				if (GameUtil.IsTerrainLayer(simImpact.Layer) && !(simImpact.Speed <= minVelocity) && simImpact.Time > minTime && simImpact.Time < maxTime)
				{
					impact = simImpact;
					return true;
				}
			}
			impact = default(SimImpact);
			return false;
		}
	}
	internal enum ItemKind
	{
		None,
		MagicBean,
		CloudFungus,
		BounceFungus,
		ShelfFungus,
		WarpFungus,
		RemedyFungus,
		Dynamite,
		RopeCannon,
		ChainLauncher,
		Launcher,
		GenericBreakable,
		GenericImpact,
		Bouncing
	}
	internal sealed class ItemInfo
	{
		internal Item Item;

		internal ItemKind Kind;

		internal MagicBean MagicBean;

		internal MagicBeanVine BeanVinePrefab;

		internal CloudFungus CloudFungus;

		internal ShelfShroom ShelfShroom;

		internal WarpOnThrow Warp;

		internal Dynamite Dynamite;

		internal RopeShooter RopeShooter;

		internal VineShooter VineShooter;

		internal Breakable Breakable;

		internal Action_RaycastSpawnSomething RaycastSpawn;

		internal Action_RaycastDart RaycastDart;

		internal Basketball Basketball;
	}
	internal static class ItemClassifier
	{
		private static readonly Dictionary<int, KeyValuePair<float, bool>> EffectRadiusCache = new Dictionary<int, KeyValuePair<float, bool>>();

		internal static ItemInfo Classify(Item item)
		{
			ItemInfo it