Decompiled source of ShopCart v1.3.6

ShopCart.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.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 ShopCartMod
{
	internal sealed class ShopCartMarker : MonoBehaviour
	{
		private ValueScreen _screen;

		private TextMeshPro _display;

		private TextMeshPro[] _displays;

		private int _total;

		private int _count;

		private bool _hasSnapshot;

		private static readonly FieldInfo ShopItemField = AccessTools.Field(typeof(ItemAttributes), "shopItem");

		private static readonly FieldInfo InStartRoomField = AccessTools.Field(typeof(ItemAttributes), "inStartRoom");

		private static readonly FieldInfo ItemValueField = AccessTools.Field(typeof(ItemAttributes), "value");

		private static readonly FieldInfo ItemsInCartField = AccessTools.Field(typeof(PhysGrabCart), "itemsInCart");

		private static readonly FieldInfo CartPhysicalField = AccessTools.Field(typeof(PhysGrabCart), "physGrabObject");

		private static readonly Color Affordable = new Color(0.35f, 1f, 0.48f);

		private static readonly Color TooExpensive = new Color(1f, 0.24f, 0.18f);

		private static readonly Color Empty = new Color(0.55f, 0.86f, 1f);

		private void Start()
		{
			PhysGrabCart component = ((Component)this).GetComponent<PhysGrabCart>();
			_screen = (((Object)(object)component != (Object)null) ? component.valueScreen : ((Component)this).GetComponentInChildren<ValueScreen>(true));
			_display = (((Object)(object)_screen != (Object)null) ? _screen.displayText : ((Component)this).GetComponentInChildren<TextMeshPro>(true));
			Transform val = ((Component)this).transform.Find("SHOPPING C.A.R.T. Model");
			_displays = (TextMeshPro[])(((Object)(object)val != (Object)null) ? ((Array)((Component)val).GetComponentsInChildren<TextMeshPro>(true)) : ((Array)new TextMeshPro[1] { _display }));
			ItemAttributes component2 = ((Component)this).GetComponent<ItemAttributes>();
			if ((Object)(object)component2 != (Object)null)
			{
				ShopItemField?.SetValue(component2, false);
				InStartRoomField?.SetValue(component2, false);
				component2.DisableUI(false);
			}
		}

		internal void RefreshFromCart(PhysGrabCart cart)
		{
			if ((Object)(object)cart == (Object)null)
			{
				return;
			}
			int num = 0;
			int num2 = 0;
			HashSet<PhysGrabObject> hashSet = new HashSet<PhysGrabObject>();
			List<PhysGrabObject> list = ItemsInCartField?.GetValue(cart) as List<PhysGrabObject>;
			object? obj = CartPhysicalField?.GetValue(cart);
			PhysGrabObject val = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null);
			if (list == null)
			{
				return;
			}
			foreach (PhysGrabObject item in list)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)val) && hashSet.Add(item))
				{
					ItemAttributes val2 = ((Component)item).GetComponent<ItemAttributes>();
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = ((Component)item).GetComponentInChildren<ItemAttributes>(true);
					}
					if (!((Object)(object)val2 == (Object)null) && !(ShopItemField == null) && (bool)ShopItemField.GetValue(val2))
					{
						num += Mathf.Max(0, (ItemValueField != null) ? ((int)ItemValueField.GetValue(val2)) : 0);
						num2++;
					}
				}
			}
			if (!_hasSnapshot || num != _total)
			{
				ValueScreen screen = _screen;
				if (screen != null)
				{
					screen.UpdateValue(num);
				}
				_total = num;
			}
			_count = num2;
			_hasSnapshot = true;
		}

		private void LateUpdate()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_display == (Object)null || !SemiFunc.RunIsShop())
			{
				return;
			}
			long num = (long)SemiFunc.StatGetRunCurrency() - (long)_total;
			bool flag = num >= 0;
			Color color = ((_count == 0) ? Empty : (flag ? Affordable : TooExpensive));
			string text = ((_count == 0) ? "#8CD9FF" : (flag ? "#59FF7A" : "#FF3D2E"));
			string text2 = ((_count == 0) ? "EMPTY" : ((!flag) ? ("OVER $" + SemiFunc.DollarGetString((int)Math.Min(2147483647L, -num)) + "K") : ("LEFT $" + SemiFunc.DollarGetString((int)Math.Min(2147483647L, num)) + "K")));
			string text3 = "<color=" + text + ">$" + SemiFunc.DollarGetString(_total) + "K\n<size=42%>" + _count + " ITEMS  |  " + text2 + "</size></color>";
			TextMeshPro[] displays = _displays;
			foreach (TextMeshPro val in displays)
			{
				if (!((Object)(object)val == (Object)null))
				{
					((Graphic)val).color = color;
					((TMP_Text)val).text = text3;
				}
			}
		}
	}
	[BepInPlugin("uz.cherdak.repo.shopcart", "Shop Cart", "1.3.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class ShopCartPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private const string NetworkPrefabName = "SosoTeam Shop Cart";

		internal const string DisplayName = "SHOPPING C.A.R.T.";

		private PrefabRef _cartPrefab;

		private float _nextPrepareAttempt;

		private float _shopSpawnAt;

		private bool _wasInShop;

		private static readonly FieldInfo ShopItemField = AccessTools.Field(typeof(ItemAttributes), "shopItem");

		private static readonly FieldInfo InStartRoomField = AccessTools.Field(typeof(ItemAttributes), "inStartRoom");

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("uz.cherdak.repo.shopcart").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Shop Cart 1.3.6 loaded");
		}

		private void Update()
		{
			bool flag = SemiFunc.RunIsShop();
			if (flag && !_wasInShop)
			{
				_shopSpawnAt = Time.unscaledTime + 2.5f;
			}
			_wasInShop = flag;
			if ((_cartPrefab == null || !((PrefabRef<GameObject>)(object)_cartPrefab).IsValid()) && Time.unscaledTime >= _nextPrepareAttempt)
			{
				_nextPrepareAttempt = Time.unscaledTime + 2f;
				TryPrepareCartPrefab();
			}
			if (flag && !(Time.unscaledTime < _shopSpawnAt) && _cartPrefab != null && ((PrefabRef<GameObject>)(object)_cartPrefab).IsValid() && SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)Object.FindObjectOfType<ShopCartMarker>() != (Object)null))
			{
				SpawnCart();
			}
		}

		private void TryPrepareCartPrefab()
		{
			if (NetworkPrefabs.TryGetNetworkPrefabRef("SosoTeam Shop Cart", ref _cartPrefab))
			{
				return;
			}
			PhysGrabCart val = FindBestCartSource();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject);
			((Object)val2).name = "SosoTeam Shop Cart";
			val2.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val2);
			ItemAttributes component = val2.GetComponent<ItemAttributes>();
			if ((Object)(object)component != (Object)null)
			{
				ShopItemField?.SetValue(component, false);
				InStartRoomField?.SetValue(component, false);
				component.DisableUI(false);
				if ((Object)(object)component.item != (Object)null)
				{
					Item val3 = Object.Instantiate<Item>(component.item);
					((Object)val3).name = "SHOPPING C.A.R.T.";
					val3.itemName = "SHOPPING C.A.R.T.";
					val3.itemNameLocalized = null;
					component.item = val3;
				}
			}
			ShoppingCartVisuals.Build(val2, val2.GetComponent<PhysGrabCart>());
			if ((Object)(object)val2.GetComponent<ShopCartMarker>() == (Object)null)
			{
				val2.AddComponent<ShopCartMarker>();
			}
			_cartPrefab = NetworkPrefabs.RegisterNetworkPrefab("SosoTeam Shop Cart", val2);
			if (_cartPrefab != null && ((PrefabRef<GameObject>)(object)_cartPrefab).IsValid())
			{
				Log.LogInfo((object)("Prepared the permanent shop cart from " + ((Object)((Component)val).gameObject).name + "."));
			}
		}

		private static PhysGrabCart FindBestCartSource()
		{
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			List<PhysGrabCart> list = new List<PhysGrabCart>();
			AddItemCart(Resources.Load<Item>("Items/Item Cart Medium"), list);
			foreach (Item item in Items.AllItems.Where((Item item) => (Object)(object)item != (Object)null))
			{
				AddItemCart(item, list);
			}
			Item[] array = Resources.LoadAll<Item>("ScriptableObjects");
			for (int num = 0; num < array.Length; num++)
			{
				AddItemCart(array[num], list);
			}
			if ((Object)(object)StatsManager.instance != (Object)null && StatsManager.instance.itemDictionary != null)
			{
				foreach (Item value in StatsManager.instance.itemDictionary.Values)
				{
					AddItemCart(value, list);
				}
			}
			PhysGrabCart[] array2 = Resources.FindObjectsOfTypeAll<PhysGrabCart>();
			foreach (PhysGrabCart val in array2)
			{
				if ((Object)(object)val != (Object)null && !list.Contains(val))
				{
					list.Add(val);
				}
			}
			PhysGrabCart result = null;
			int num2 = int.MinValue;
			foreach (PhysGrabCart item2 in list)
			{
				if (!((Object)(object)item2 == (Object)null) && !((Object)(object)((Component)item2).GetComponent<ShopCartMarker>() != (Object)null))
				{
					string obj = ((Object)((Component)item2).gameObject).name ?? string.Empty;
					int num3 = 0;
					if (!item2.isSmallCart)
					{
						num3 += 100;
					}
					if (obj.IndexOf("cart", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 += 20;
					}
					if (obj.IndexOf("medium", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 += 250;
					}
					if (obj.IndexOf("big", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 += 100;
					}
					if (obj.IndexOf("small", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 -= 150;
					}
					if (obj.IndexOf("cannon", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 -= 500;
					}
					if (obj.IndexOf("laser", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						num3 -= 500;
					}
					if ((Object)(object)item2.valueScreen != (Object)null)
					{
						num3 += 30;
					}
					if ((Object)(object)((Component)item2).GetComponent<PhysGrabObject>() != (Object)null)
					{
						num3 += 20;
					}
					Scene scene = ((Component)item2).gameObject.scene;
					if (((Scene)(ref scene)).IsValid())
					{
						num3 -= 5;
					}
					if (num3 > num2)
					{
						result = item2;
						num2 = num3;
					}
				}
			}
			return result;
		}

		private static void AddItemCart(Item item, List<PhysGrabCart> candidates)
		{
			if (!((Object)(object)item == (Object)null) && item.prefab != null && !((Object)(object)((PrefabRef<GameObject>)(object)item.prefab).Prefab == (Object)null) && ((item.itemName ?? string.Empty) + " " + (((Object)item).name ?? string.Empty)).IndexOf("cart", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				PhysGrabCart component = ((PrefabRef<GameObject>)(object)item.prefab).Prefab.GetComponent<PhysGrabCart>();
				if ((Object)(object)component != (Object)null && !candidates.Contains(component))
				{
					candidates.Add(component);
				}
			}
		}

		private void SpawnCart()
		{
			//IL_0025: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00de: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (((Object)(object)ShopManager.instance != (Object)null) ? ShopManager.instance.extractionPoint : null);
			Vector3 val2;
			Quaternion val3;
			if ((Object)(object)val != (Object)null)
			{
				val2 = val.position - val.forward * 3.2f + val.right * 2.4f + Vector3.up * 1.2f;
				val3 = Quaternion.Euler(0f, val.eulerAngles.y + 180f, 0f);
			}
			else
			{
				if (!((Object)(object)PlayerAvatar.instance != (Object)null))
				{
					return;
				}
				Transform transform = ((Component)PlayerAvatar.instance).transform;
				val2 = transform.position + transform.forward * 2.5f + Vector3.up * 1.2f;
				val3 = Quaternion.Euler(0f, transform.eulerAngles.y, 0f);
			}
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val2 + Vector3.up * 4f, Vector3.down, ref val4, 10f, -1, (QueryTriggerInteraction)1))
			{
				val2.y = ((RaycastHit)(ref val4)).point.y + 0.55f;
			}
			if ((Object)(object)NetworkPrefabs.SpawnNetworkPrefab(_cartPrefab, val2, val3, (byte)0, (object[])null) != (Object)null)
			{
				Log.LogInfo((object)"Spawned the shop cart beside the checkout station.");
			}
		}
	}
	[HarmonyPatch(typeof(ItemAttributes), "ShopInTruckLogic")]
	internal static class KeepCartOutOfShoppingListPatch
	{
		private static bool Prefix(ItemAttributes __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				return (Object)(object)((Component)__instance).GetComponent<ShopCartMarker>() == (Object)null;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PhysGrabCart), "ObjectsInCart")]
	internal static class ShopCartPricePatch
	{
		private static void Postfix(PhysGrabCart __instance)
		{
			ShopCartMarker shopCartMarker = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent<ShopCartMarker>() : null);
			if ((Object)(object)shopCartMarker != (Object)null)
			{
				shopCartMarker.RefreshFromCart(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(WorldSpaceUIValue), "Show", new Type[]
	{
		typeof(PhysGrabObject),
		typeof(int),
		typeof(bool),
		typeof(Vector3)
	})]
	internal static class HideShopCartHoverPricePatch
	{
		private static bool Prefix(PhysGrabObject __0)
		{
			if (!((Object)(object)__0 == (Object)null))
			{
				return (Object)(object)((Component)__0).GetComponent<ShopCartMarker>() == (Object)null;
			}
			return true;
		}
	}
	internal static class ShoppingCartVisuals
	{
		private static Material _metal;

		private static Material _darkMetal;

		private static Material _rubber;

		private static Material _handle;

		private static Material _screen;

		private static PhysicMaterial _smoothPhysics;

		private static readonly FieldInfo CartGrabPointField = AccessTools.Field(typeof(PhysGrabCart), "cartGrabPoint");

		private static readonly FieldInfo HandlePointField = AccessTools.Field(typeof(PhysGrabCart), "handlePoint");

		private static readonly FieldInfo GrabAreasField = AccessTools.Field(typeof(PhysGrabObjectGrabArea), "grabAreas");

		internal static void Build(GameObject prefab, PhysGrabCart cart)
		{
			//IL_00b5: 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)
			if (!((Object)(object)prefab == (Object)null) && !((Object)(object)cart == (Object)null) && !((Object)(object)prefab.transform.Find("SHOPPING C.A.R.T. Model") != (Object)null))
			{
				EnsureMaterials((from renderer in prefab.GetComponentsInChildren<Renderer>(true)
					select renderer.sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material material) => (Object)(object)material != (Object)null)));
				Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
				for (int num = 0; num < componentsInChildren.Length; num++)
				{
					componentsInChildren[num].enabled = false;
				}
				float num2 = FindPhysicalFloor(prefab);
				DisableOriginalSolidColliders(prefab);
				Transform transform = new GameObject("SHOPPING C.A.R.T. Model").transform;
				transform.SetParent(prefab.transform, false);
				transform.localPosition = new Vector3(0f, num2, 0f);
				BuildBasket(transform);
				BuildFrame(transform);
				BuildWheels(transform);
				BuildDashboard(transform, cart);
				AddBasketColliders(transform);
				AddWheelColliders(transform);
				ConfigureHandle(prefab, transform, cart);
				Rigidbody component = prefab.GetComponent<Rigidbody>();
				if ((Object)(object)component != (Object)null)
				{
					component.collisionDetectionMode = (CollisionDetectionMode)2;
				}
			}
		}

		private static void BuildBasket(Transform root)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: 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_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			Rod("Top Left", root, new Vector3(-0.64f, 1.16f, -0.67f), new Vector3(-0.64f, 1.16f, 0.71f), 0.024f, _metal);
			Rod("Top Right", root, new Vector3(0.64f, 1.16f, -0.67f), new Vector3(0.64f, 1.16f, 0.71f), 0.024f, _metal);
			Rod("Top Front", root, new Vector3(-0.64f, 1.16f, 0.71f), new Vector3(0.64f, 1.16f, 0.71f), 0.024f, _metal);
			Rod("Top Rear", root, new Vector3(-0.64f, 1.16f, -0.67f), new Vector3(0.64f, 1.16f, -0.67f), 0.024f, _metal);
			Rod("Bottom Left", root, new Vector3(-0.53f, 0.46f, -0.57f), new Vector3(-0.53f, 0.46f, 0.5f), 0.023f, _metal);
			Rod("Bottom Right", root, new Vector3(0.53f, 0.46f, -0.57f), new Vector3(0.53f, 0.46f, 0.5f), 0.023f, _metal);
			Rod("Bottom Front", root, new Vector3(-0.53f, 0.46f, 0.5f), new Vector3(0.53f, 0.46f, 0.5f), 0.023f, _metal);
			Rod("Bottom Rear", root, new Vector3(-0.53f, 0.46f, -0.57f), new Vector3(0.53f, 0.46f, -0.57f), 0.023f, _metal);
			for (int i = 0; i <= 11; i++)
			{
				float num = (float)i / 11f;
				float num2 = Mathf.Lerp(-0.57f, 0.5f, num);
				float num3 = Mathf.Lerp(-0.67f, 0.71f, num);
				Rod("Left Vertical " + i, root, new Vector3(-0.53f, 0.46f, num2), new Vector3(-0.64f, 1.16f, num3), 0.011f, _metal);
				Rod("Right Vertical " + i, root, new Vector3(0.53f, 0.46f, num2), new Vector3(0.64f, 1.16f, num3), 0.011f, _metal);
			}
			for (int j = 0; j <= 10; j++)
			{
				float num4 = (float)j / 10f;
				float num5 = Mathf.Lerp(-0.53f, 0.53f, num4);
				float num6 = Mathf.Lerp(-0.64f, 0.64f, num4);
				Rod("Front Vertical " + j, root, new Vector3(num5, 0.46f, 0.5f), new Vector3(num6, 1.16f, 0.71f), 0.011f, _metal);
				Rod("Rear Vertical " + j, root, new Vector3(num5, 0.46f, -0.57f), new Vector3(num6, 1.16f, -0.67f), 0.011f, _metal);
			}
			for (int k = 1; k <= 6; k++)
			{
				float num7 = (float)k / 7f;
				float num8 = Mathf.Lerp(0.46f, 1.16f, num7);
				float num9 = Mathf.Lerp(0.53f, 0.64f, num7);
				float num10 = Mathf.Lerp(-0.57f, -0.67f, num7);
				float num11 = Mathf.Lerp(0.5f, 0.71f, num7);
				Rod("Left Horizontal " + k, root, new Vector3(0f - num9, num8, num10), new Vector3(0f - num9, num8, num11), 0.011f, _metal);
				Rod("Right Horizontal " + k, root, new Vector3(num9, num8, num10), new Vector3(num9, num8, num11), 0.011f, _metal);
				Rod("Front Horizontal " + k, root, new Vector3(0f - num9, num8, num11), new Vector3(num9, num8, num11), 0.011f, _metal);
				Rod("Rear Horizontal " + k, root, new Vector3(0f - num9, num8, num10), new Vector3(num9, num8, num10), 0.011f, _metal);
			}
			for (int l = 0; l <= 10; l++)
			{
				float num12 = Mathf.Lerp(-0.53f, 0.53f, (float)l / 10f);
				Rod("Floor Long " + l, root, new Vector3(num12, 0.46f, -0.57f), new Vector3(num12, 0.46f, 0.5f), 0.011f, _metal);
			}
			for (int m = 0; m <= 10; m++)
			{
				float num13 = Mathf.Lerp(-0.57f, 0.5f, (float)m / 10f);
				Rod("Floor Cross " + m, root, new Vector3(-0.53f, 0.46f, num13), new Vector3(0.53f, 0.46f, num13), 0.011f, _metal);
			}
			Part("Child Seat", (PrimitiveType)3, root, new Vector3(0f, 0.94f, -0.6f), new Vector3(0.84f, 0.26f, 0.025f), new Vector3(-8f, 0f, 0f), _handle);
		}

		private static void BuildFrame(Transform root)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			Rail("Left Upper Frame", root, new Vector3(-0.48f, 0.4f, 0.02f), new Vector3(0.06f, 0.12f, 1.18f));
			Rail("Right Upper Frame", root, new Vector3(0.48f, 0.4f, 0.02f), new Vector3(0.06f, 0.12f, 1.18f));
			Rail("Left Leg", root, new Vector3(-0.43f, 0.31f, -0.36f), new Vector3(0.055f, 0.3f, 0.055f));
			Rail("Right Leg", root, new Vector3(0.43f, 0.31f, -0.36f), new Vector3(0.055f, 0.3f, 0.055f));
			Rail("Front Axle", root, new Vector3(0f, 0.25f, 0.52f), new Vector3(1.02f, 0.055f, 0.055f));
			Rail("Rear Axle", root, new Vector3(0f, 0.25f, -0.5f), new Vector3(1.02f, 0.055f, 0.055f));
			Rod("Handle Left Support", root, new Vector3(-0.6f, 1.03f, -0.67f), new Vector3(-0.6f, 1.23f, -0.91f), 0.035f, _metal);
			Rod("Handle Right Support", root, new Vector3(0.6f, 1.03f, -0.67f), new Vector3(0.6f, 1.23f, -0.91f), 0.035f, _metal);
			Rod("Red Push Handle", root, new Vector3(-0.7f, 1.23f, -0.91f), new Vector3(0.7f, 1.23f, -0.91f), 0.065f, _handle);
		}

		private static void BuildWheels(Transform root)
		{
			//IL_005e: 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_0077: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: 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_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[2] { -0.48f, 0.48f };
			float[] array2 = new float[2] { -0.5f, 0.52f };
			float[] array3 = array;
			foreach (float num in array3)
			{
				float[] array4 = array2;
				foreach (float num2 in array4)
				{
					Part("Caster Mounting Plate", (PrimitiveType)3, root, new Vector3(num, 0.285f, num2), new Vector3(0.25f, 0.025f, 0.2f), Vector3.zero, _metal);
					Part("Caster Swivel Bearing", (PrimitiveType)2, root, new Vector3(num, 0.255f, num2), new Vector3(0.085f, 0.035f, 0.085f), Vector3.zero, _metal);
					Part("Caster Stem", (PrimitiveType)2, root, new Vector3(num, 0.215f, num2), new Vector3(0.035f, 0.045f, 0.035f), Vector3.zero, _metal);
					Part("Caster Fork Crown", (PrimitiveType)3, root, new Vector3(num, 0.185f, num2), new Vector3(0.25f, 0.045f, 0.075f), Vector3.zero, _metal);
					Part("Caster Fork Left", (PrimitiveType)3, root, new Vector3(num - 0.105f, 0.135f, num2), new Vector3(0.035f, 0.13f, 0.06f), new Vector3(-10f, 0f, 0f), _metal);
					Part("Caster Fork Right", (PrimitiveType)3, root, new Vector3(num + 0.105f, 0.135f, num2), new Vector3(0.035f, 0.13f, 0.06f), new Vector3(-10f, 0f, 0f), _metal);
					Part("Caster Rubber Tire", (PrimitiveType)2, root, new Vector3(num, 0.11f, num2 + 0.012f), new Vector3(0.105f, 0.075f, 0.105f), new Vector3(0f, 0f, 90f), _rubber);
					Part("Wheel Hub Left", (PrimitiveType)2, root, new Vector3(num - 0.079f, 0.11f, num2 + 0.012f), new Vector3(0.052f, 0.012f, 0.052f), new Vector3(0f, 0f, 90f), _metal);
					Part("Wheel Hub Right", (PrimitiveType)2, root, new Vector3(num + 0.079f, 0.11f, num2 + 0.012f), new Vector3(0.052f, 0.012f, 0.052f), new Vector3(0f, 0f, 90f), _metal);
					Rod("Wheel Axle", root, new Vector3(num - 0.125f, 0.11f, num2 + 0.012f), new Vector3(num + 0.125f, 0.11f, num2 + 0.012f), 0.012f, _darkMetal);
				}
			}
		}

		private static void BuildDashboard(Transform root, PhysGrabCart cart)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0055: 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)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: 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_0219: 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_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			Part("Rear Dashboard Housing", (PrimitiveType)3, root, new Vector3(0f, 0.99f, -0.705f), new Vector3(0.82f, 0.3f, 0.1f), Vector3.zero, _darkMetal);
			Part("Rear Dashboard Face", (PrimitiveType)3, root, new Vector3(0f, 0.99f, -0.762f), new Vector3(0.74f, 0.25f, 0.018f), Vector3.zero, _screen);
			Part("Front Dashboard Housing", (PrimitiveType)3, root, new Vector3(0f, 0.99f, 0.745f), new Vector3(0.82f, 0.3f, 0.1f), Vector3.zero, _darkMetal);
			Part("Front Dashboard Face", (PrimitiveType)3, root, new Vector3(0f, 0.99f, 0.802f), new Vector3(0.74f, 0.25f, 0.018f), Vector3.zero, _screen);
			if (!((Object)(object)cart.valueScreen == (Object)null))
			{
				TextMeshPro val = cart.valueScreen.displayText;
				if ((Object)(object)val == (Object)null)
				{
					val = new GameObject("Cart Total Display", new Type[2]
					{
						typeof(RectTransform),
						typeof(TextMeshPro)
					}).GetComponent<TextMeshPro>();
				}
				((Object)((Component)val).gameObject).name = "Cart Total Display";
				val.transform.SetParent(root, false);
				val.transform.localPosition = new Vector3(0f, 0.99f, -0.775f);
				val.transform.localRotation = Quaternion.identity;
				val.transform.localScale = Vector3.one;
				((Component)val).gameObject.SetActive(true);
				((Behaviour)val).enabled = true;
				Renderer component = ((Component)val).GetComponent<Renderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.enabled = true;
				}
				((TMP_Text)val).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val).fontSize = 1.8f;
				((TMP_Text)val).enableAutoSizing = true;
				((TMP_Text)val).fontSizeMin = 0.35f;
				((TMP_Text)val).fontSizeMax = 1.8f;
				((TMP_Text)val).rectTransform.sizeDelta = new Vector2(0.7f, 0.23f);
				((Graphic)val).color = Color.white;
				((TMP_Text)val).text = "$0K\n0 ITEMS | EMPTY";
				cart.valueScreen.displayText = val;
				TextMeshPro component2 = Object.Instantiate<GameObject>(((Component)val).gameObject, root).GetComponent<TextMeshPro>();
				((Object)((Component)component2).gameObject).name = "Front Cart Total Display";
				component2.transform.localPosition = new Vector3(0f, 0.99f, 0.815f);
				component2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
				component2.transform.localScale = Vector3.one;
				((Component)component2).gameObject.SetActive(true);
				((Behaviour)component2).enabled = true;
				Renderer component3 = ((Component)component2).GetComponent<Renderer>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.enabled = true;
				}
			}
		}

		private static void AddBasketColliders(Transform root)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			PassiveBox("Basket Floor Ray Pass", root, new Vector3(0f, 0.42f, -0.035f), new Vector3(1.16f, 0.18f, 1.18f));
			PassiveBox("Basket Safety Floor Collider", root, new Vector3(0f, 0.33f, -0.035f), new Vector3(1.1f, 0.1f, 1.12f));
			PassiveBox("Basket Lower Left Ray Pass", root, new Vector3(-0.55f, 0.61f, 0.02f), new Vector3(0.15f, 0.36f, 1.28f));
			PassiveBox("Basket Lower Right Ray Pass", root, new Vector3(0.55f, 0.61f, 0.02f), new Vector3(0.15f, 0.36f, 1.28f));
			PassiveBox("Basket Lower Front Ray Pass", root, new Vector3(0f, 0.61f, 0.55f), new Vector3(1.18f, 0.36f, 0.2f));
			PassiveBox("Basket Lower Rear Ray Pass", root, new Vector3(0f, 0.61f, -0.59f), new Vector3(1.18f, 0.36f, 0.18f));
			PassiveBox("Basket Upper Left Ray Pass", root, new Vector3(-0.61f, 0.98f, 0.02f), new Vector3(0.16f, 0.42f, 1.44f));
			PassiveBox("Basket Upper Right Ray Pass", root, new Vector3(0.61f, 0.98f, 0.02f), new Vector3(0.16f, 0.42f, 1.44f));
			PassiveBox("Basket Upper Front Ray Pass", root, new Vector3(0f, 0.98f, 0.67f), new Vector3(1.3f, 0.42f, 0.2f));
			PassiveBox("Basket Upper Rear Ray Pass", root, new Vector3(0f, 0.98f, -0.65f), new Vector3(1.3f, 0.42f, 0.18f));
		}

		private static void AddWheelColliders(Transform root)
		{
			//IL_0099: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[2] { -0.48f, 0.48f };
			float[] array2 = new float[2] { -0.5f, 0.52f };
			float[] array3 = array;
			foreach (float num in array3)
			{
				float[] array4 = array2;
				foreach (float num2 in array4)
				{
					PassiveSphere("Smooth Caster Collider", root, new Vector3(num, 0.11f, num2 + 0.012f), 0.108f);
				}
			}
			PassiveCapsule("Left Smooth Underside", root, new Vector3(-0.39f, 0.085f, 0.01f), 0.055f, 1.02f);
			PassiveCapsule("Right Smooth Underside", root, new Vector3(0.39f, 0.085f, 0.01f), 0.055f, 1.02f);
		}

		private static void Rail(string name, Transform root, Vector3 position, Vector3 scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			AxisRod(name, root, position, scale, _metal);
		}

		private static void Wire(string name, Transform root, Vector3 position, Vector3 scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			AxisRod(name, root, position, scale, _metal);
		}

		private static void AxisRod(string name, Transform root, Vector3 position, Vector3 size, Material material)
		{
			//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_003d: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_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)
			Vector3 val;
			float num;
			float num2;
			if (size.x >= size.y && size.x >= size.z)
			{
				val = Vector3.right;
				num = size.x;
				num2 = Mathf.Max(size.y, size.z);
			}
			else if (size.y >= size.z)
			{
				val = Vector3.up;
				num = size.y;
				num2 = Mathf.Max(size.x, size.z);
			}
			else
			{
				val = Vector3.forward;
				num = size.z;
				num2 = Mathf.Max(size.x, size.y);
			}
			Rod(name, root, position - val * num * 0.5f, position + val * num * 0.5f, num2 * 0.5f, material);
		}

		private static GameObject Rod(string name, Transform parent, Vector3 start, Vector3 end, float radius, Material material)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = end - start;
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
			((Object)obj).name = name;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = (start + end) * 0.5f;
			obj.transform.localRotation = Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val)).normalized);
			obj.transform.localScale = new Vector3(radius * 2f, ((Vector3)(ref val)).magnitude * 0.5f, radius * 2f);
			Renderer component = obj.GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				component.sharedMaterial = material;
			}
			Collider component2 = obj.GetComponent<Collider>();
			if ((Object)(object)component2 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			return obj;
		}

		private static float FindPhysicalFloor(GameObject prefab)
		{
			//IL_0040: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			bool flag = false;
			Collider[] componentsInChildren = prefab.GetComponentsInChildren<Collider>(true);
			foreach (Collider val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)null) && !val.isTrigger && val.enabled)
				{
					Transform transform = prefab.transform;
					Bounds bounds = val.bounds;
					float x = ((Bounds)(ref bounds)).center.x;
					bounds = val.bounds;
					float y = ((Bounds)(ref bounds)).min.y;
					bounds = val.bounds;
					Vector3 val2 = transform.InverseTransformPoint(new Vector3(x, y, ((Bounds)(ref bounds)).center.z));
					if (!flag || val2.y < num)
					{
						num = val2.y;
						flag = true;
					}
				}
			}
			if (!flag)
			{
				return -0.48f;
			}
			return num + 0.01f;
		}

		private static void ConfigureHandle(GameObject prefab, Transform root, PhysGrabCart cart)
		{
			//IL_0005: 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_0017: 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_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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0116: 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)
			GameObject val = new GameObject("Shopping Cart Handle Grab Point");
			val.transform.SetParent(root, false);
			val.transform.localPosition = new Vector3(0f, 1.23f, -0.91f);
			Transform transform = val.transform;
			CartGrabPointField?.SetValue(cart, transform);
			HandlePointField?.SetValue(cart, transform);
			GameObject val2 = new GameObject("Red Handle Physical Grab Collider");
			val2.transform.SetParent(root, false);
			val2.transform.localPosition = transform.localPosition;
			val2.layer = LayerMask.NameToLayer("PhysGrabObject");
			val2.tag = "Phys Grab Object";
			val2.AddComponent<BoxCollider>().size = new Vector3(1.5f, 0.18f, 0.2f);
			val2.AddComponent<PhysGrabObjectCollider>();
			PhysGrabObjectGrabArea component = prefab.GetComponent<PhysGrabObjectGrabArea>();
			IList list = (((Object)(object)component != (Object)null) ? (GrabAreasField?.GetValue(component) as IList) : null);
			if (list != null)
			{
				GameObject val3 = new GameObject("Red Handle Steering Area");
				val3.transform.SetParent(root, false);
				val3.transform.localPosition = transform.localPosition;
				BoxCollider obj = val3.AddComponent<BoxCollider>();
				((Collider)obj).isTrigger = true;
				obj.size = new Vector3(1.65f, 0.34f, 0.42f);
				Type nestedType = typeof(PhysGrabObjectGrabArea).GetNestedType("GrabArea", BindingFlags.Public | BindingFlags.NonPublic);
				if (!(nestedType == null))
				{
					object obj2 = Activator.CreateInstance(nestedType);
					AccessTools.Field(nestedType, "grabAreaTransform")?.SetValue(obj2, val3.transform);
					list.Add(obj2);
				}
			}
		}

		private static void DisableOriginalSolidColliders(GameObject prefab)
		{
			Collider[] componentsInChildren = prefab.GetComponentsInChildren<Collider>(true);
			foreach (Collider val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && !val.isTrigger)
				{
					val.enabled = false;
				}
			}
		}

		private static GameObject Part(string name, PrimitiveType primitive, Transform parent, Vector3 position, Vector3 scale, Vector3 rotation, Material material)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(primitive);
			((Object)obj).name = name;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = position;
			obj.transform.localScale = scale;
			obj.transform.localRotation = Quaternion.Euler(rotation);
			Renderer component = obj.GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				component.sharedMaterial = material;
			}
			Collider component2 = obj.GetComponent<Collider>();
			if ((Object)(object)component2 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			return obj;
		}

		private static void ColliderBox(string name, Transform parent, Vector3 center, Vector3 size)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.transform.localPosition = center;
			val.layer = LayerMask.NameToLayer("PhysGrabObject");
			val.tag = "Phys Grab Object";
			val.AddComponent<BoxCollider>().size = size;
			val.AddComponent<PhysGrabObjectCollider>();
		}

		private static GameObject PassiveColliderObject(string name, Transform parent, Vector3 center)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.transform.localPosition = center;
			val.layer = 0;
			return val;
		}

		private static GameObject SupportColliderObject(string name, Transform parent, Vector3 center)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.transform.localPosition = center;
			int num = LayerMask.NameToLayer("PhysGrabObject");
			val.layer = ((num >= 0) ? num : 0);
			return val;
		}

		private static void PassiveBox(string name, Transform parent, Vector3 center, Vector3 size)
		{
			//IL_0002: 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)
			BoxCollider obj = PassiveColliderObject(name, parent, center).AddComponent<BoxCollider>();
			obj.size = size;
			((Collider)obj).material = SmoothPhysics();
		}

		private static void PassiveSphere(string name, Transform parent, Vector3 center, float radius)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			SphereCollider obj = SupportColliderObject(name, parent, center).AddComponent<SphereCollider>();
			obj.radius = radius;
			((Collider)obj).material = SmoothPhysics();
		}

		private static void PassiveCapsule(string name, Transform parent, Vector3 center, float radius, float height)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			CapsuleCollider obj = SupportColliderObject(name, parent, center).AddComponent<CapsuleCollider>();
			obj.direction = 2;
			obj.radius = radius;
			obj.height = height;
			((Collider)obj).material = SmoothPhysics();
		}

		private static PhysicMaterial SmoothPhysics()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if ((Object)(object)_smoothPhysics != (Object)null)
			{
				return _smoothPhysics;
			}
			_smoothPhysics = new PhysicMaterial("SHOPPING C.A.R.T. Smooth Underside")
			{
				dynamicFriction = 0.05f,
				staticFriction = 0.05f,
				bounciness = 0f,
				frictionCombine = (PhysicMaterialCombine)2,
				bounceCombine = (PhysicMaterialCombine)2
			};
			Object.DontDestroyOnLoad((Object)(object)_smoothPhysics);
			return _smoothPhysics;
		}

		private static void EnsureMaterials(Material fallback)
		{
			//IL_0069: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_metal != (Object)null))
			{
				Shader val = Shader.Find("Standard") ?? Shader.Find("Universal Render Pipeline/Lit");
				if ((Object)(object)val == (Object)null && (Object)(object)fallback != (Object)null)
				{
					val = fallback.shader;
				}
				if ((Object)(object)val == (Object)null)
				{
					throw new InvalidOperationException("No compatible cart shader was found.");
				}
				_metal = Material(val, "Polished Silver Chrome", new Color(0.8f, 0.83f, 0.87f), 0.66f, 0.99f);
				_darkMetal = Material(val, "Brushed Silver Chrome", new Color(0.69f, 0.72f, 0.76f), 0.62f, 0.94f);
				_rubber = Material(val, "Caster Rubber", new Color(0.018f, 0.021f, 0.024f), 0.05f, 0.18f);
				_handle = Material(val, "Handle Red", new Color(0.72f, 0.045f, 0.025f), 0.08f, 0.28f);
				_screen = Material(val, "Price Screen", new Color(0.012f, 0.025f, 0.055f), 0.1f, 0.52f);
				if (_screen.HasProperty("_EmissionColor"))
				{
					_screen.EnableKeyword("_EMISSION");
					_screen.SetColor("_EmissionColor", new Color(0.01f, 0.035f, 0.11f));
				}
				if (_metal.HasProperty("_EmissionColor"))
				{
					_metal.EnableKeyword("_EMISSION");
					_metal.SetColor("_EmissionColor", new Color(0.025f, 0.028f, 0.034f));
				}
				if (_darkMetal.HasProperty("_EmissionColor"))
				{
					_darkMetal.EnableKeyword("_EMISSION");
					_darkMetal.SetColor("_EmissionColor", new Color(0.018f, 0.02f, 0.025f));
				}
			}
		}

		private static Material Material(Shader shader, string name, Color color, float metallic, float smoothness)
		{
			//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_0018: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(shader)
			{
				name = "SHOPPING C.A.R.T. " + name
			};
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", color);
			}
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", metallic);
			}
			if (val.HasProperty("_SpecColor"))
			{
				val.SetColor("_SpecColor", new Color(0.98f, 0.99f, 1f));
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", smoothness);
			}
			if (val.HasProperty("_Smoothness"))
			{
				val.SetFloat("_Smoothness", smoothness);
			}
			if (val.HasProperty("_GlossyReflections"))
			{
				val.SetFloat("_GlossyReflections", 1f);
			}
			Object.DontDestroyOnLoad((Object)(object)val);
			return val;
		}
	}
}