Decompiled source of Quads Cigars v0.4.2

plugins/CigarSmoking.dll

Decompiled 13 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DHack.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (Claude Code).")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[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 CigarSmoking
{
	internal static class Cigar
	{
		internal class Parts
		{
			public Transform Root;

			public Transform Body;

			public Transform Band;

			public Transform Tip;

			public Renderer TipRenderer;

			public void SetBurn(float burn)
			{
				//IL_0033: 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_006f: Unknown result type (might be due to invalid IL or missing references)
				float num = 0.16f * Mathf.Lerp(0.3f, 1f, Mathf.Clamp01(burn));
				Body.localScale = new Vector3(0.022f, num * 0.5f, 0.022f);
				Body.localPosition = new Vector3(0f, 0f, num * 0.5f);
				Tip.localPosition = new Vector3(0f, 0f, num);
			}
		}

		internal const float Length = 0.16f;

		internal const float Radius = 0.011f;

		private static Material _ember;

		internal static Parts Build(Transform parent, string name, CigarType type, bool lit)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0077: 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_00ba: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			Parts parts = new Parts();
			parts.Root = new GameObject(name).transform;
			parts.Root.SetParent(parent, false);
			parts.Body = Piece(parts.Root, (PrimitiveType)2, Look.Tint(type.Body), Quaternion.Euler(90f, 0f, 0f));
			parts.Band = Piece(parts.Root, (PrimitiveType)2, Look.Tint(type.Band), Quaternion.Euler(90f, 0f, 0f));
			parts.Band.localPosition = new Vector3(0f, 0f, 0.03f);
			parts.Band.localScale = new Vector3(0.02475f, 0.008f, 0.02475f);
			parts.Tip = Piece(parts.Root, (PrimitiveType)0, lit ? EmberMat() : Look.Of("Ash"), Quaternion.identity);
			parts.Tip.localScale = Vector3.one * 0.011f * 2.1f;
			parts.TipRenderer = ((Component)parts.Tip).GetComponent<Renderer>();
			parts.SetBurn(1f);
			return parts;
		}

		private static Transform Piece(Transform parent, PrimitiveType type, Material mat, Quaternion rotation)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive(type);
			Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>());
			val.transform.SetParent(parent, false);
			val.transform.localRotation = rotation;
			val.GetComponent<Renderer>().sharedMaterial = mat;
			return val.transform;
		}

		internal static Material EmberMat()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_ember == (Object)null)
			{
				_ember = new Material(Shader.Find("Sprites/Default"));
				_ember.color = new Color(1f, 0.45f, 0.1f);
			}
			return _ember;
		}

		internal static void AddModels(GameObject item, CigarType type)
		{
			//IL_0028: 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)
			Parts parts = Build(item.transform, "model", type, lit: false);
			parts.Root.localRotation = Quaternion.Euler(0f, 90f, 0f);
			parts.Root.localPosition = new Vector3(-0.08f, 0f, 0f);
			Parts parts2 = Build(item.transform, "attach", type, lit: false);
			((Component)parts2.Root).gameObject.SetActive(false);
		}
	}
	public class Curer : MonoBehaviour, Interactable, Hoverable
	{
		private enum State
		{
			Empty,
			Working,
			Ready
		}

		private const string KeyCount = "dh_c_count";

		private const string KeyStart = "dh_c_start";

		private const string KeyEnd = "dh_c_end";

		private const string KeyIn = "dh_c_in";

		private const string RpcLoad = "dh_Curer_Load";

		private const string RpcCollect = "dh_Curer_Collect";

		private const string RpcGive = "dh_Curer_Give";

		public string Title;

		public int Capacity;

		public bool Drying;

		private List<KeyValuePair<string, string>> _conversions;

		private ZNetView _nview;

		private Transform _fresh;

		private Transform _dry;

		private Transform _lid;

		private Transform _contents;

		private float _nextLook;

		private List<KeyValuePair<string, string>> Conversions
		{
			get
			{
				if (_conversions == null)
				{
					_conversions = new List<KeyValuePair<string, string>>();
					Strain[] all = Strains.All;
					foreach (Strain strain in all)
					{
						_conversions.Add(Drying ? new KeyValuePair<string, string>(strain.Fresh, strain.Dried) : new KeyValuePair<string, string>(strain.Dried, strain.Aged));
					}
				}
				return _conversions;
			}
		}

		private ZDO Zdo
		{
			get
			{
				if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid())
				{
					return null;
				}
				return _nview.GetZDO();
			}
		}

		private double Now
		{
			get
			{
				if (!((Object)(object)ZNet.instance != (Object)null))
				{
					return 0.0;
				}
				return ZNet.instance.GetTimeSeconds();
			}
		}

		private float Duration => (Drying ? Plugin.DryMinutes.Value : Plugin.CureMinutes.Value) * 60f;

		internal bool Loaded
		{
			get
			{
				int count;
				float left;
				string input;
				return Read(out count, out left, out input) != State.Empty;
			}
		}

		private void Awake()
		{
			_nview = ((Component)this).GetComponent<ZNetView>();
			Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == "fresh")
				{
					_fresh = val;
				}
				else if (((Object)val).name == "dry")
				{
					_dry = val;
				}
				else if (((Object)val).name == "lidOn")
				{
					_lid = val;
				}
				else if (((Object)val).name == "contents")
				{
					_contents = val;
				}
			}
			if (!((Object)(object)_nview == (Object)null) && _nview.GetZDO() != null)
			{
				_nview.Register<string, int>("dh_Curer_Load", (Action<long, string, int>)RPC_Load);
				_nview.Register("dh_Curer_Collect", (Action<long>)RPC_Collect);
				_nview.Register<string, int, bool>("dh_Curer_Give", (Action<long, string, int, bool>)RPC_Give);
				WearNTear component = ((Component)this).GetComponent<WearNTear>();
				if ((Object)(object)component != (Object)null)
				{
					component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed));
				}
			}
		}

		private State Read(out int count, out float left, out string input)
		{
			count = 0;
			left = 0f;
			input = "";
			ZDO zdo = Zdo;
			if (zdo == null)
			{
				return State.Empty;
			}
			count = zdo.GetInt("dh_c_count", 0);
			if (count <= 0)
			{
				return State.Empty;
			}
			input = zdo.GetString("dh_c_in", "");
			long num = zdo.GetLong("dh_c_end", 0L);
			double num2 = ((num > 0) ? ((double)num / 1000.0) : ((double)zdo.GetLong("dh_c_start", 0L) / 1000.0 + (double)Duration));
			left = Mathf.Max(0f, (float)(num2 - Now));
			if (!(left > 0f))
			{
				return State.Ready;
			}
			return State.Working;
		}

		private string OutputFor(string input)
		{
			foreach (KeyValuePair<string, string> conversion in Conversions)
			{
				if (conversion.Key == input)
				{
					return conversion.Value;
				}
			}
			return "";
		}

		private void Update()
		{
			if (!(Time.time < _nextLook))
			{
				_nextLook = Time.time + 0.5f;
				int count;
				float left;
				string input;
				State state = Read(out count, out left, out input);
				if ((Object)(object)_fresh != (Object)null)
				{
					((Component)_fresh).gameObject.SetActive(state == State.Working);
				}
				if ((Object)(object)_dry != (Object)null)
				{
					((Component)_dry).gameObject.SetActive(state == State.Ready);
				}
				if ((Object)(object)_lid != (Object)null)
				{
					((Component)_lid).gameObject.SetActive(state != State.Ready);
				}
				if ((Object)(object)_contents != (Object)null)
				{
					((Component)_contents).gameObject.SetActive(state == State.Ready);
				}
			}
		}

		public bool Interact(Humanoid user, bool hold, bool alt)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
			{
				return true;
			}
			int count;
			float left;
			string input;
			switch (Read(out count, out left, out input))
			{
			case State.Empty:
				return Load(user, null);
			case State.Working:
				((Character)user).Message((MessageType)2, Translations.T(Drying ? "cigarsmoking_drying_left" : "cigarsmoking_curing_left", Mathf.CeilToInt(left / 60f)), 0, (Sprite)null, false);
				return true;
			default:
				if (!(user is Player) || Zdo == null)
				{
					return false;
				}
				_nview.InvokeRPC("dh_Curer_Collect", Array.Empty<object>());
				return true;
			}
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
			{
				return false;
			}
			if (Read(out var _, out var _, out var _) != State.Empty || item == null)
			{
				return false;
			}
			foreach (KeyValuePair<string, string> conversion in Conversions)
			{
				if (Things.SharedName(conversion.Key) == item.m_shared.m_name)
				{
					return Load(user, conversion.Key);
				}
			}
			return false;
		}

		private bool Load(Humanoid user, string input)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			Player val = (Player)(object)((user is Player) ? user : null);
			if ((Object)(object)val == (Object)null || Zdo == null)
			{
				return false;
			}
			Inventory inventory = ((Humanoid)val).GetInventory();
			if (input == null)
			{
				foreach (KeyValuePair<string, string> conversion in Conversions)
				{
					if (inventory.CountItems(Things.SharedName(conversion.Key), -1, false) > 0)
					{
						input = conversion.Key;
						break;
					}
				}
			}
			if (input == null)
			{
				((Character)val).Message((MessageType)2, Translations.T(Drying ? "cigarsmoking_rack_no_leaves" : "cigarsmoking_barrel_no_leaves"), 0, (Sprite)null, false);
				return true;
			}
			string text = Things.SharedName(input);
			int num = Mathf.Min(inventory.CountItems(text, -1, false), Capacity);
			inventory.RemoveItem(text, num, -1, false);
			_nview.InvokeRPC("dh_Curer_Load", new object[2] { input, num });
			((Character)val).Message((MessageType)2, Translations.T(Drying ? "cigarsmoking_drying_leaves" : "cigarsmoking_curing_leaves", num), 0, (Sprite)null, false);
			Things.PlayEffects(((Component)this).transform.position);
			return true;
		}

		private bool IsInput(string prefab)
		{
			foreach (KeyValuePair<string, string> conversion in Conversions)
			{
				if (conversion.Key == prefab)
				{
					return true;
				}
			}
			return false;
		}

		private bool IsLeaf(string prefab)
		{
			foreach (KeyValuePair<string, string> conversion in Conversions)
			{
				if (conversion.Key == prefab || conversion.Value == prefab)
				{
					return true;
				}
			}
			return false;
		}

		private void RPC_Load(long sender, string input, int n)
		{
			try
			{
				if (n > 0 && IsInput(input))
				{
					if (!_nview.IsOwner() || Read(out var _, out var _, out var _) != State.Empty || n > Capacity)
					{
						_nview.InvokeRPC(sender, "dh_Curer_Give", new object[3] { input, n, true });
					}
					else
					{
						ZDO zDO = _nview.GetZDO();
						double now = Now;
						zDO.Set("dh_c_in", input);
						zDO.Set("dh_c_count", n);
						zDO.Set("dh_c_start", (long)(now * 1000.0));
						zDO.Set("dh_c_end", (long)((now + (double)Duration) * 1000.0));
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] " + Title + ": could not put leaves in: " + ex));
			}
		}

		private void RPC_Collect(long sender)
		{
			try
			{
				if (_nview.IsOwner() && Read(out var count, out var _, out var input) == State.Ready)
				{
					string text = OutputFor(input);
					if (text.Length != 0)
					{
						ZDO zDO = _nview.GetZDO();
						zDO.Set("dh_c_count", 0);
						zDO.Set("dh_c_end", 0L);
						_nview.InvokeRPC(sender, "dh_Curer_Give", new object[3] { text, count, false });
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] " + Title + ": could not hand the leaves out: " + ex));
			}
		}

		private void OnDestroyed()
		{
			//IL_006d: 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)
			try
			{
				if (!((Object)(object)_nview == (Object)null) && _nview.IsValid() && _nview.IsOwner())
				{
					int count;
					float left;
					string input;
					string text;
					switch (Read(out count, out left, out input))
					{
					case State.Empty:
						return;
					default:
						text = input;
						break;
					case State.Ready:
						text = OutputFor(input);
						break;
					}
					string text2 = text;
					if (text2.Length > 0)
					{
						Things.Drop(text2, Mathf.Min(count, Capacity), ((Component)this).transform.position + Vector3.up);
					}
					_nview.GetZDO().Set("dh_c_count", 0);
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] " + Title + ": could not drop what it held: " + ex));
			}
		}

		private void RPC_Give(long sender, string prefab, int count, bool returned)
		{
			//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)
			//IL_0041: 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)
			try
			{
				if (count <= 0 || !IsLeaf(prefab))
				{
					return;
				}
				count = Mathf.Min(count, Capacity);
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					Things.Drop(prefab, count, ((Component)this).transform.position + Vector3.up);
					return;
				}
				Things.Give(localPlayer, prefab, count);
				if (returned)
				{
					((Character)localPlayer).Message((MessageType)2, Translations.T(Drying ? "cigarsmoking_rack_in_use" : "cigarsmoking_barrel_in_use"), 0, (Sprite)null, false);
					return;
				}
				((Character)localPlayer).Message((MessageType)2, Translations.T("cigarsmoking_you_take", count, Things.DisplayName(prefab)), 0, (Sprite)null, false);
				Things.PlayEffects(((Component)this).transform.position);
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] " + Title + ": could not take the leaves: " + ex));
			}
		}

		public string GetHoverText()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false))
			{
				return Localization.instance.Localize(Title + "\n$piece_noaccess");
			}
			int count;
			float left;
			string input;
			string text = Read(out count, out left, out input) switch
			{
				State.Empty => Title + "\n[<color=yellow><b>$KEY_Use</b></color>] " + Translations.T("cigarsmoking_hover_put", Capacity), 
				State.Working => Title + "\n" + Translations.T(Drying ? "cigarsmoking_drying_hover" : "cigarsmoking_curing_hover", count, Things.DisplayName(input), Mathf.CeilToInt(left / 60f)), 
				_ => Title + "\n[<color=yellow><b>$KEY_Use</b></color>] " + Translations.T("cigarsmoking_hover_take", count, Things.DisplayName(OutputFor(input))), 
			};
			return Localization.instance.Localize(text);
		}

		public string GetHoverName()
		{
			return Localization.instance.Localize(Title);
		}

		public float GetHoverOffset()
		{
			return 0f;
		}
	}
	[HarmonyPatch(typeof(Piece), "CanBeRemoved")]
	internal static class Piece_CanBeRemoved
	{
		private static void Postfix(Piece __instance, ref bool __result)
		{
			if (__result)
			{
				Curer component = ((Component)__instance).GetComponent<Curer>();
				if ((Object)(object)component != (Object)null && component.Loaded)
				{
					__result = false;
				}
			}
		}
	}
	internal static class Icons
	{
		private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>();

		private static readonly MethodInfo LoadImage = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2]
		{
			typeof(Texture2D),
			typeof(byte[])
		});

		internal static Sprite Get(string name)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (Cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Sprite val = null;
			try
			{
				using Stream stream = typeof(Icons).Assembly.GetManifestResourceStream("icons/" + name + ".png");
				if (stream != null && LoadImage != null)
				{
					byte[] array = new byte[stream.Length];
					stream.Read(array, 0, array.Length);
					Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false);
					if ((bool)LoadImage.Invoke(null, new object[2] { val2, array }))
					{
						val = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] could not load the icon " + name + ": " + ex.Message));
			}
			Cache[name] = val;
			return val;
		}

		internal static void Clear()
		{
			Cache.Clear();
		}
	}
	internal static class Things
	{
		private static GameObject _holder;

		private static bool _items;

		private static bool _pieces;

		private static bool _recipes;

		internal static readonly Dictionary<string, GameObject> Made = new Dictionary<string, GameObject>();

		private static readonly List<GameObject> ItemPrefabs = new List<GameObject>();

		private static readonly List<GameObject> HammerPieces = new List<GameObject>();

		private static readonly List<GameObject> CultivatorPieces = new List<GameObject>();

		internal static readonly List<SE_Smoking> Effects = new List<SE_Smoking>();

		private static readonly List<Recipe> Recipes = new List<Recipe>();

		internal static CraftingStation TableStation;

		private static readonly HashSet<PieceTable> Tables = new HashSet<PieceTable>();

		private static bool BuildItems()
		{
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Find("Dandelion");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)"[Quad's Cigars] the Dandelion prefab was not found, so there are no items");
				return false;
			}
			Strain[] all = Strains.All;
			foreach (Strain strain in all)
			{
				MakeItem(val, strain.Seeds, strain.Key("seeds"), strain.Key("seeds_desc"), (ItemType)1, 50, 0.05f, Icons.Get("seeds_" + strain.Id), "seeds_" + strain.Id);
				MakeItem(val, strain.Fresh, strain.Key("leaf"), strain.Key("leaf_desc"), (ItemType)1, 50, 0.1f, Icons.Get("leaf_" + strain.Id + "_fresh"), "leaf_" + strain.Id + "_fresh");
				MakeItem(val, strain.Dried, strain.Key("dried"), strain.Key("dried_desc"), (ItemType)1, 50, 0.1f, Icons.Get("leaf_" + strain.Id + "_dried"), "leaf_" + strain.Id + "_dried");
				MakeItem(val, strain.Aged, strain.Key("aged"), strain.Key("aged_desc"), (ItemType)1, 50, 0.1f, Icons.Get("leaf_" + strain.Id + "_aged"), "leaf_" + strain.Id + "_aged");
			}
			CigarType[] all2 = Types.All;
			foreach (CigarType t in all2)
			{
				Sprite icon = Icons.Get("cigar_" + t.Id);
				SE_Smoking sE_Smoking = Smoking.Make(t, icon);
				Effects.Add(sE_Smoking);
				GameObject cigar = MakeItem(val, t.Prefab, t.Display, t.Flavour, (ItemType)2, 20, 0.1f, icon, null);
				Safely(t.Prefab, delegate
				{
					Cigar.AddModels(cigar, t);
				});
				FitHitbox(cigar, new Bounds(Vector3.zero, new Vector3(0.16f, 0.044f, 0.044f)));
				SharedData shared = cigar.GetComponent<ItemDrop>().m_itemData.m_shared;
				shared.m_foodEatAnimTime = 2.5f;
				shared.m_consumeStatusEffect = (StatusEffect)(object)sE_Smoking;
			}
			return true;
		}

		private static GameObject MakeItem(GameObject source, string prefab, string display, string description, ItemType type, int stack, float weight, Sprite icon, string model)
		{
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			GameObject go = Object.Instantiate<GameObject>(source, _holder.transform);
			((Object)go).name = prefab;
			go.layer = LayerMask.NameToLayer("item");
			LODGroup[] components = go.GetComponents<LODGroup>();
			foreach (LODGroup val in components)
			{
				Object.DestroyImmediate((Object)(object)val);
			}
			Collider[] components2 = go.GetComponents<Collider>();
			foreach (Collider val2 in components2)
			{
				Object.DestroyImmediate((Object)(object)val2);
			}
			MeshRenderer[] components3 = go.GetComponents<MeshRenderer>();
			foreach (MeshRenderer val3 in components3)
			{
				Object.DestroyImmediate((Object)(object)val3);
			}
			MeshFilter[] components4 = go.GetComponents<MeshFilter>();
			foreach (MeshFilter val4 in components4)
			{
				Object.DestroyImmediate((Object)(object)val4);
			}
			for (int num = go.transform.childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)go.transform.GetChild(num)).gameObject);
			}
			if (model != null)
			{
				object[][] parts = ModelIndex.Parts(model);
				Safely(prefab, delegate
				{
					ModelBuilder.Build(go.transform, parts, go.layer, "model");
				});
				FitHitbox(go, ModelBuilder.BoundsOf(parts));
			}
			ItemDrop component = go.GetComponent<ItemDrop>();
			SharedData shared = component.m_itemData.m_shared;
			shared.m_name = display;
			shared.m_description = description;
			shared.m_itemType = type;
			shared.m_icons = (Sprite[])(object)new Sprite[1] { icon };
			shared.m_maxStackSize = stack;
			shared.m_weight = weight;
			shared.m_value = 0;
			shared.m_maxQuality = 1;
			shared.m_variants = 0;
			shared.m_food = 0f;
			shared.m_foodStamina = 0f;
			shared.m_foodEitr = 0f;
			shared.m_teleportable = true;
			shared.m_questItem = false;
			shared.m_dlc = "";
			shared.m_consumeStatusEffect = null;
			shared.m_equipStatusEffect = null;
			component.m_itemData.m_dropPrefab = go;
			component.m_itemData.m_stack = 1;
			Made[prefab] = go;
			ItemPrefabs.Add(go);
			return go;
		}

		private static void FitHitbox(GameObject go, Bounds b)
		{
			//IL_0029: 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_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)
			Collider[] components = go.GetComponents<Collider>();
			foreach (Collider val in components)
			{
				Object.DestroyImmediate((Object)(object)val);
			}
			BoxCollider val2 = go.AddComponent<BoxCollider>();
			val2.center = ((Bounds)(ref b)).center;
			val2.size = Vector3.Max(((Bounds)(ref b)).size, new Vector3(0.05f, 0.03f, 0.05f));
		}

		private static GameObject Clone(ZNetScene scene, string source, string name)
		{
			GameObject prefab = scene.GetPrefab(source);
			if ((Object)(object)prefab == (Object)null)
			{
				Debug.LogWarning((object)("[Quad's Cigars] the " + source + " prefab was not found, so there is no " + name));
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(prefab, _holder.transform);
			((Object)val).name = name;
			Made[name] = val;
			return val;
		}

		private static void Strip(GameObject go)
		{
			LODGroup[] componentsInChildren = go.GetComponentsInChildren<LODGroup>(true);
			foreach (LODGroup val in componentsInChildren)
			{
				Object.DestroyImmediate((Object)(object)val);
			}
			Renderer[] componentsInChildren2 = go.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren2)
			{
				if (!(val2 is ParticleSystemRenderer) && !((Object)(object)((Component)val2).GetComponentInParent<CircleProjector>() != (Object)null))
				{
					val2.enabled = false;
				}
			}
			Collider[] componentsInChildren3 = go.GetComponentsInChildren<Collider>(true);
			foreach (Collider val3 in componentsInChildren3)
			{
				Object.DestroyImmediate((Object)(object)val3);
			}
		}

		private static void Reskin(GameObject go, object[][] parts)
		{
			//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_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_0058: Expected O, but got Unknown
			//IL_007b: 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)
			Strip(go);
			int num = LayerMask.NameToLayer("piece");
			if (num < 0)
			{
				num = go.layer;
			}
			Bounds val = ModelBuilder.BoundsOf(parts);
			GameObject val2 = new GameObject("Hitbox")
			{
				layer = num
			};
			val2.transform.SetParent(go.transform, false);
			BoxCollider val3 = val2.AddComponent<BoxCollider>();
			val3.center = ((Bounds)(ref val)).center;
			val3.size = ((Bounds)(ref val)).size;
			Safely(((Object)go).name, delegate
			{
				ModelBuilder.Build(go.transform, parts, go.layer);
			});
		}

		private static void SetPiece(GameObject go, string name, string description, string icon, params Requirement[] cost)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Piece component = go.GetComponent<Piece>();
			component.m_name = name;
			component.m_description = description;
			component.m_icon = Icons.Get(icon);
			component.m_category = (PieceCategory)1;
			component.m_resources = cost;
		}

		private static void BuildPieces(ZNetScene scene)
		{
			GameObject prefab = scene.GetPrefab("piece_workbench");
			CraftingStation craftingStation = ((prefab != null) ? prefab.GetComponent<CraftingStation>() : null);
			GameObject val = Clone(scene, "piece_workbench", "dh_cigar_table");
			if ((Object)(object)val != (Object)null)
			{
				Transform val2 = val.transform.Find("PlayerBase");
				if ((Object)(object)val2 != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)((Component)val2).gameObject);
				}
				Reskin(val, ModelIndex.Parts("table"));
				CraftingStation component = val.GetComponent<CraftingStation>();
				component.m_name = "$cigarsmoking_table";
				component.m_icon = Icons.Get("table");
				component.m_craftRequireRoof = false;
				component.m_craftRequireFire = false;
				SetPiece(val, "$cigarsmoking_table", "$cigarsmoking_table_desc", "table", Req("Wood", 10), Req("Resin", 4), Req("LeatherScraps", 4));
				val.GetComponent<Piece>().m_craftingStation = craftingStation;
				TableStation = component;
				HammerPieces.Add(val);
			}
			GameObject val3 = Clone(scene, "piece_workbench_ext1", "dh_humidor");
			if ((Object)(object)val3 != (Object)null)
			{
				Reskin(val3, ModelIndex.Parts("humidor"));
				StationExtension component2 = val3.GetComponent<StationExtension>();
				if ((Object)(object)component2 != (Object)null && (Object)(object)TableStation != (Object)null)
				{
					component2.m_craftingStation = TableStation;
				}
				SetPiece(val3, "$cigarsmoking_humidor", "$cigarsmoking_humidor_desc", "humidor", Req("FineWood", 10), Req("LeatherScraps", 3), Req("Resin", 3));
				val3.GetComponent<Piece>().m_craftingStation = TableStation;
				HammerPieces.Add(val3);
			}
			GameObject val4 = Clone(scene, "piece_chest_wood", "dh_drying_rack");
			if ((Object)(object)val4 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val4.GetComponent<Container>());
				Reskin(val4, ModelIndex.Parts("rack"));
				SetPiece(val4, "$cigarsmoking_rack", "$cigarsmoking_rack_desc", "rack", Req("Wood", 8), Req("Resin", 2));
				val4.GetComponent<Piece>().m_craftingStation = craftingStation;
				Curer curer = val4.AddComponent<Curer>();
				curer.Title = "$cigarsmoking_rack";
				curer.Capacity = 8;
				curer.Drying = true;
				HammerPieces.Add(val4);
			}
			GameObject val5 = Clone(scene, "piece_chest_wood", "dh_curing_barrel");
			if ((Object)(object)val5 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val5.GetComponent<Container>());
				Reskin(val5, ModelIndex.Parts("barrel"));
				SetPiece(val5, "$cigarsmoking_barrel", "$cigarsmoking_barrel_desc", "barrel", Req("Wood", 12), Req("Resin", 4), Req("LeatherScraps", 2));
				val5.GetComponent<Piece>().m_craftingStation = craftingStation;
				Curer curer2 = val5.AddComponent<Curer>();
				curer2.Title = "$cigarsmoking_barrel";
				curer2.Capacity = 8;
				curer2.Drying = false;
				HammerPieces.Add(val5);
			}
			Strain[] all = Strains.All;
			foreach (Strain s in all)
			{
				BuildPlants(scene, s);
			}
		}

		private static void Replace(Transform at, object[][] parts)
		{
			//IL_00ab: 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)
			if (!((Object)(object)at == (Object)null))
			{
				for (int num = at.childCount - 1; num >= 0; num--)
				{
					Object.DestroyImmediate((Object)(object)((Component)at.GetChild(num)).gameObject);
				}
				MeshRenderer[] components = ((Component)at).GetComponents<MeshRenderer>();
				foreach (MeshRenderer val in components)
				{
					Object.DestroyImmediate((Object)(object)val);
				}
				MeshFilter[] components2 = ((Component)at).GetComponents<MeshFilter>();
				foreach (MeshFilter val2 in components2)
				{
					Object.DestroyImmediate((Object)(object)val2);
				}
				at.localRotation = Quaternion.identity;
				at.localScale = Vector3.one;
				Safely(((Object)at).name, delegate
				{
					ModelBuilder.Build(at, parts, ((Component)at).gameObject.layer);
				});
			}
		}

		private static void BuildPlants(ZNetScene scene, Strain s)
		{
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Expected O, but got Unknown
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Find(s.Fresh);
			ItemDrop val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null);
			GameObject obj2 = Find(s.Seeds);
			ItemDrop val2 = ((obj2 != null) ? obj2.GetComponent<ItemDrop>() : null);
			object[][] mature = ModelIndex.Parts("plant_" + s.Id + "_mature");
			GameObject ripe = Clone(scene, "Pickable_Carrot", s.Pickable);
			if ((Object)(object)ripe != (Object)null)
			{
				LODGroup[] componentsInChildren = ripe.GetComponentsInChildren<LODGroup>(true);
				foreach (LODGroup val3 in componentsInChildren)
				{
					Object.DestroyImmediate((Object)(object)val3);
				}
				for (int num = ripe.transform.childCount - 1; num >= 0; num--)
				{
					Object.DestroyImmediate((Object)(object)((Component)ripe.transform.GetChild(num)).gameObject);
				}
				Safely(s.Pickable, delegate
				{
					ModelBuilder.Build(ripe.transform, mature, ripe.layer);
				});
				Pickable component = ripe.GetComponent<Pickable>();
				component.m_hideWhenPicked = null;
				component.m_itemPrefab = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null);
				component.m_amount = 3;
				component.m_overrideName = s.Key("plant");
				component.m_extraDrops = SeedDrop(val2, 0.6f);
				component.m_respawnTimeMinutes = 0f;
				FitPlantCollider(ripe, s.Height);
			}
			GameObject wild = Clone(scene, "Pickable_Dandelion", s.WildPickable);
			if ((Object)(object)wild != (Object)null)
			{
				Transform val4 = wild.transform.Find("visual");
				LODGroup[] componentsInChildren2 = wild.GetComponentsInChildren<LODGroup>(true);
				foreach (LODGroup val5 in componentsInChildren2)
				{
					Object.DestroyImmediate((Object)(object)val5);
				}
				GameObject model = null;
				if ((Object)(object)val4 != (Object)null)
				{
					Collider[] components = ((Component)val4).GetComponents<Collider>();
					foreach (Collider val6 in components)
					{
						Object.DestroyImmediate((Object)(object)val6);
					}
					Replace(val4, mature);
					model = ((Component)val4).gameObject;
				}
				else
				{
					for (int num4 = wild.transform.childCount - 1; num4 >= 0; num4--)
					{
						Object.DestroyImmediate((Object)(object)((Component)wild.transform.GetChild(num4)).gameObject);
					}
					Safely(s.WildPickable, delegate
					{
						model = ModelBuilder.Build(wild.transform, mature, wild.layer);
					});
				}
				Pickable component2 = wild.GetComponent<Pickable>();
				component2.m_hideWhenPicked = model;
				component2.m_itemPrefab = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null);
				component2.m_amount = 3;
				component2.m_overrideName = s.Key("plant_wild");
				component2.m_extraDrops = SeedDrop(val2, 1f);
				component2.m_respawnTimeMinutes = 300f;
				FitPlantCollider(wild, s.Height);
			}
			GameObject val7 = Clone(scene, "sapling_carrot", s.Sapling);
			if ((Object)(object)val7 != (Object)null)
			{
				LODGroup[] componentsInChildren3 = val7.GetComponentsInChildren<LODGroup>(true);
				foreach (LODGroup val8 in componentsInChildren3)
				{
					Object.DestroyImmediate((Object)(object)val8);
				}
				Replace(val7.transform.Find("healthy"), ModelIndex.Parts("plant_" + s.Id + "_seedling"));
				Replace(val7.transform.Find("unhealthy"), ModelIndex.Parts("plant_" + s.Id + "_seedling_sick"));
				Replace(val7.transform.Find("healthy_grown"), ModelIndex.Parts("plant_" + s.Id + "_growing"));
				Replace(val7.transform.Find("unhealthy_grown"), ModelIndex.Parts("plant_" + s.Id + "_growing_sick"));
				Plant component3 = val7.GetComponent<Plant>();
				component3.m_name = s.Key("plant");
				component3.m_grownPrefabs = (GameObject[])(object)((!((Object)(object)ripe != (Object)null)) ? new GameObject[0] : new GameObject[1] { ripe });
				component3.m_growTime = Plugin.GrowMinutes.Value * 60f;
				component3.m_growTimeMax = component3.m_growTime * 1.4f;
				component3.m_biome = s.Plant;
				component3.m_needCultivatedGround = true;
				SetPiece(val7, s.Key("plant"), s.Key("plant_desc"), "plant_" + s.Id, new Requirement
				{
					m_resItem = val2,
					m_amount = 1,
					m_recover = false
				});
				val7.GetComponent<Piece>().m_category = (PieceCategory)0;
				CultivatorPieces.Add(val7);
				Debug.Log((object)("[Quad's Cigars] " + s.Sapling + " grows into " + string.Join(", ", Array.ConvertAll(component3.m_grownPrefabs, (GameObject g) => (!((Object)(object)g != (Object)null)) ? "NOTHING" : ((Object)g).name)) + " (the harvest plant " + (((Object)(object)ripe != (Object)null) ? "was built" : "is MISSING") + ")"));
			}
		}

		private static DropTable SeedDrop(ItemDrop seeds, float chance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_001b: Expected O, but got Unknown
			//IL_002c: 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)
			DropTable val = new DropTable
			{
				m_dropMin = 1,
				m_dropMax = 1,
				m_dropChance = chance
			};
			if ((Object)(object)seeds != (Object)null)
			{
				val.m_drops.Add(new DropData
				{
					m_item = ((Component)seeds).gameObject,
					m_stackMin = 1,
					m_stackMax = 2,
					m_weight = 1f
				});
			}
			return val;
		}

		private static void FitPlantCollider(GameObject go, float height)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Collider[] componentsInChildren = go.GetComponentsInChildren<Collider>(true);
			foreach (Collider val in componentsInChildren)
			{
				Object.DestroyImmediate((Object)(object)val);
			}
			CapsuleCollider val2 = go.AddComponent<CapsuleCollider>();
			val2.radius = 0.28f;
			val2.height = height * 0.9f;
			val2.center = new Vector3(0f, height * 0.45f, 0f);
		}

		internal static SE_Smoking EffectFor(ItemData item)
		{
			string text = (((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name : null);
			for (int i = 0; i < Types.All.Length; i++)
			{
				if ((Types.All[i].Prefab == text || Types.All[i].Display == item.m_shared.m_name) && i < Effects.Count)
				{
					return Effects[i];
				}
			}
			return null;
		}

		internal static GameObject Find(string name)
		{
			if (Made.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(name) : null);
			if ((Object)(object)val == (Object)null && (Object)(object)ObjectDB.instance != (Object)null)
			{
				val = ObjectDB.instance.GetItemPrefab(name);
			}
			return val;
		}

		internal static string SharedName(string prefab)
		{
			GameObject obj = Find(prefab);
			ItemDrop val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null);
			if (!((Object)(object)val != (Object)null))
			{
				return prefab;
			}
			return val.m_itemData.m_shared.m_name;
		}

		internal static string DisplayName(string prefab)
		{
			return Localization.instance.Localize(SharedName(prefab));
		}

		internal static void Give(Player player, string prefab, int amount)
		{
			//IL_0072: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Find(prefab);
			ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null);
			if (!((Object)(object)val2 == (Object)null))
			{
				ItemData val3 = val2.m_itemData.Clone();
				val3.m_dropPrefab = val;
				val3.m_stack = Mathf.Max(1, amount);
				val3.m_worldLevel = (byte)Game.m_worldLevel;
				if (!((Humanoid)player).GetInventory().AddItem(val3))
				{
					ItemDrop.DropItem(val3, Mathf.Max(1, val3.m_stack), ((Component)player).transform.position + ((Component)player).transform.forward * 0.8f + Vector3.up, Quaternion.identity);
					((Character)player).Message((MessageType)2, Translations.T("cigarsmoking_bag_full"), 0, (Sprite)null, false);
				}
			}
		}

		internal static void Drop(string prefab, int amount, Vector3 at)
		{
			//IL_0049: 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)
			GameObject val = Find(prefab);
			ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null);
			if (!((Object)(object)val2 == (Object)null) && amount > 0)
			{
				ItemData val3 = val2.m_itemData.Clone();
				val3.m_dropPrefab = val;
				val3.m_worldLevel = (byte)Game.m_worldLevel;
				ItemDrop.DropItem(val3, amount, at, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f));
			}
		}

		private static void Safely(string what, Action look)
		{
			try
			{
				look();
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Quad's Cigars] could not build the look of " + what + ": " + ex.Message));
			}
		}

		internal static void PlayEffects(Vector3 at)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			try
			{
				ZNetScene instance = ZNetScene.instance;
				object obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					GameObject prefab = instance.GetPrefab("piece_workbench");
					obj = ((prefab != null) ? prefab.GetComponent<CraftingStation>() : null);
				}
				CraftingStation val = (CraftingStation)obj;
				if (val != null)
				{
					val.m_craftItemEffects.Create(at, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID));
				}
			}
			catch
			{
			}
		}

		private static Dictionary<int, GameObject> Named(ZNetScene scene)
		{
			return (Dictionary<int, GameObject>)AccessTools.Field(typeof(ZNetScene), "m_namedPrefabs").GetValue(scene);
		}

		internal static void Register()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			ObjectDB instance = ObjectDB.instance;
			ZNetScene scene = ZNetScene.instance;
			if ((Object)(object)instance == (Object)null && (Object)(object)scene == (Object)null)
			{
				return;
			}
			if ((Object)(object)_holder == (Object)null)
			{
				_holder = new GameObject("QuadsCigarsPrefabs");
				_holder.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)_holder);
			}
			if (!_items)
			{
				if (!Look.Ready)
				{
					Safely("the materials", delegate
					{
						Look.Harvest(scene);
					});
				}
				if (!BuildItems())
				{
					return;
				}
				_items = true;
			}
			if ((Object)(object)scene != (Object)null && !_pieces)
			{
				Safely("the materials", delegate
				{
					Look.Harvest(scene);
				});
				BuildPieces(scene);
				_pieces = true;
			}
			if ((Object)(object)scene != (Object)null)
			{
				Dictionary<int, GameObject> dictionary = Named(scene);
				foreach (GameObject value in Made.Values)
				{
					if (!scene.m_prefabs.Contains(value))
					{
						scene.m_prefabs.Add(value);
					}
					dictionary[StringExtensionMethods.GetStableHashCode(((Object)value).name)] = value;
				}
				AddToTable(scene.GetPrefab("Hammer"), HammerPieces);
				AddToTable(scene.GetPrefab("Cultivator"), CultivatorPieces);
			}
			if ((Object)(object)instance != (Object)null)
			{
				if (_pieces && !_recipes)
				{
					BuildRecipes(instance);
					_recipes = true;
				}
				bool flag = false;
				foreach (GameObject item in ItemPrefabs)
				{
					if (!instance.m_items.Contains(item))
					{
						instance.m_items.RemoveAll((GameObject i) => (Object)(object)i == (Object)null || ((Object)i).name == ((Object)item).name);
						instance.m_items.Add(item);
						flag = true;
					}
				}
				foreach (SE_Smoking effect in Effects)
				{
					if (!instance.m_StatusEffects.Contains((StatusEffect)(object)effect))
					{
						instance.m_StatusEffects.RemoveAll((StatusEffect e) => (Object)(object)e == (Object)null || ((Object)e).name == ((Object)effect).name);
						instance.m_StatusEffects.Add((StatusEffect)(object)effect);
					}
				}
				foreach (Recipe recipe in Recipes)
				{
					if (!instance.m_recipes.Contains(recipe))
					{
						instance.m_recipes.RemoveAll((Recipe r) => (Object)(object)r == (Object)null || ((Object)r).name == ((Object)recipe).name);
						instance.m_recipes.Add(recipe);
					}
				}
				if (flag)
				{
					AccessTools.Method(typeof(ObjectDB), "UpdateRegisters", (Type[])null, (Type[])null).Invoke(instance, null);
				}
			}
			World.Add();
		}

		private static void AddToTable(GameObject tool, List<GameObject> pieces)
		{
			PieceTable val = ((!((Object)(object)tool != (Object)null)) ? null : tool.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_buildPieces);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			val.m_pieces.RemoveAll((GameObject p) => (Object)(object)p == (Object)null);
			foreach (GameObject piece in pieces)
			{
				if (!val.m_pieces.Contains(piece))
				{
					val.m_pieces.Add(piece);
				}
			}
			Tables.Add(val);
		}

		internal static void Unregister()
		{
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance != (Object)null)
			{
				Dictionary<int, GameObject> dictionary = Named(instance);
				foreach (GameObject value2 in Made.Values)
				{
					instance.m_prefabs.Remove(value2);
					int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)value2).name);
					if (dictionary.TryGetValue(stableHashCode, out var value) && (Object)(object)value == (Object)(object)value2)
					{
						dictionary.Remove(stableHashCode);
					}
				}
			}
			foreach (PieceTable table in Tables)
			{
				table.m_pieces.RemoveAll((GameObject p) => (Object)(object)p == (Object)null || Made.ContainsValue(p));
			}
			Tables.Clear();
			ObjectDB instance2 = ObjectDB.instance;
			if ((Object)(object)instance2 != (Object)null)
			{
				instance2.m_items.RemoveAll((GameObject i) => (Object)(object)i == (Object)null || ItemPrefabs.Contains(i));
				instance2.m_StatusEffects.RemoveAll((StatusEffect e) => (Object)(object)e == (Object)null || ((IEnumerable<StatusEffect>)Effects).Contains(e));
				instance2.m_recipes.RemoveAll((Recipe r) => (Object)(object)r == (Object)null || Recipes.Contains(r));
				AccessTools.Method(typeof(ObjectDB), "UpdateRegisters", (Type[])null, (Type[])null).Invoke(instance2, null);
			}
			World.Remove();
			foreach (Recipe recipe in Recipes)
			{
				Object.Destroy((Object)(object)recipe);
			}
			foreach (SE_Smoking effect in Effects)
			{
				Object.Destroy((Object)(object)effect);
			}
			Made.Clear();
			ItemPrefabs.Clear();
			HammerPieces.Clear();
			CultivatorPieces.Clear();
			Effects.Clear();
			Recipes.Clear();
			TableStation = null;
			_items = (_pieces = (_recipes = false));
			if ((Object)(object)_holder != (Object)null)
			{
				Object.Destroy((Object)(object)_holder);
			}
			_holder = null;
			Look.Clear();
			Icons.Clear();
			Meshes.Clear();
		}

		private static void BuildRecipes(ObjectDB db)
		{
			//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_0066: 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_007e: Expected O, but got Unknown
			//IL_00aa: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			if ((Object)(object)TableStation == (Object)null)
			{
				return;
			}
			CigarType[] all = Types.All;
			foreach (CigarType cigarType in all)
			{
				List<Requirement> list = new List<Requirement>();
				GameObject obj = Find(Strains.ById(cigarType.Strain).Item(cigarType.Stage));
				ItemDrop val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(new Requirement
					{
						m_resItem = val,
						m_amount = cigarType.Leaves,
						m_recover = false
					});
				}
				for (int j = 0; j < cigarType.Extra.Length; j++)
				{
					GameObject obj2 = Find(cigarType.Extra[j]);
					ItemDrop val2 = ((obj2 != null) ? obj2.GetComponent<ItemDrop>() : null);
					if ((Object)(object)val2 != (Object)null)
					{
						list.Add(new Requirement
						{
							m_resItem = val2,
							m_amount = cigarType.ExtraAmount[j],
							m_recover = false
						});
					}
				}
				Recipe val3 = ScriptableObject.CreateInstance<Recipe>();
				((Object)val3).name = "Recipe_" + cigarType.Prefab;
				val3.m_item = Made[cigarType.Prefab].GetComponent<ItemDrop>();
				val3.m_amount = cigarType.Makes;
				val3.m_craftingStation = TableStation;
				val3.m_minStationLevel = cigarType.Level;
				val3.m_resources = list.ToArray();
				Recipes.Add(val3);
			}
		}

		private static Requirement Req(string item, int amount)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Requirement val = new Requirement();
			GameObject obj = Find(item);
			val.m_resItem = ((obj != null) ? obj.GetComponent<ItemDrop>() : null);
			val.m_amount = amount;
			val.m_recover = true;
			return val;
		}
	}
	internal static class Look
	{
		private static readonly Dictionary<string, Material> Materials = new Dictionary<string, Material>();

		private static readonly Dictionary<Color, Material> Tints = new Dictionary<Color, Material>();

		private static readonly HashSet<string> Warned = new HashSet<string>();

		internal static bool Ready => Materials.Count > 0;

		private static Material Find(ZNetScene scene, string prefab, string material)
		{
			GameObject val = (((Object)(object)scene != (Object)null) ? scene.GetPrefab(prefab) : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				Material[] sharedMaterials = val2.sharedMaterials;
				foreach (Material val3 in sharedMaterials)
				{
					if ((Object)(object)val3 != (Object)null && ((Object)val3).name == material)
					{
						return val3;
					}
				}
			}
			return null;
		}

		internal static void Harvest(ZNetScene scene)
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			Materials.Clear();
			Tints.Clear();
			Materials["Stone"] = Find(scene, "stone_wall_1x1", "stone_mat");
			Materials["Planks"] = Find(scene, "wood_floor", "woodwall");
			Materials["Dark"] = Find(scene, "darkwood_pole", "DarkWood_mat");
			Materials["Iron"] = Find(scene, "iron_grate", "metalwall");
			Material val = Find(scene, "Wood", "wood_item") ?? Find(scene, "piece_cauldron", "cauldron_chain");
			Material val2 = (Material)(((Object)(object)val != (Object)null) ? ((object)val) : ((object)new Material(Shader.Find("Standard") ?? Shader.Find("Sprites/Default"))));
			foreach (KeyValuePair<string, Color> item in Palette.All)
			{
				Materials[item.Key] = Plainly(val2, item.Value);
			}
			Dictionary<string, Color> dictionary = new Dictionary<string, Color>
			{
				{
					"Stone",
					new Color(0.5f, 0.5f, 0.52f)
				},
				{
					"Planks",
					new Color(0.5f, 0.34f, 0.2f)
				},
				{
					"Dark",
					new Color(0.25f, 0.17f, 0.11f)
				},
				{
					"Iron",
					new Color(0.38f, 0.38f, 0.42f)
				}
			};
			foreach (KeyValuePair<string, Color> item2 in dictionary)
			{
				if ((Object)(object)Materials[item2.Key] == (Object)null)
				{
					Materials[item2.Key] = new Material(val2)
					{
						color = item2.Value
					};
				}
			}
		}

		internal static Material Tint(Color color)
		{
			//IL_0005: 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_0055: 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)
			if (Tints.TryGetValue(color, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Material value2;
			Material basis = (Material)(Materials.TryGetValue("Seed", out value2) ? ((object)value2) : ((object)new Material(Shader.Find("Standard") ?? Shader.Find("Sprites/Default"))));
			return Tints[color] = Plainly(basis, color);
		}

		private static Material Plainly(Material basis, Color color)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			Material val = new Material(basis)
			{
				color = color
			};
			if (val.HasProperty("_MainTex"))
			{
				val.mainTexture = null;
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0.12f);
			}
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", 0f);
			}
			return val;
		}

		internal static Material Of(string name)
		{
			if (Materials.TryGetValue(name, out var value))
			{
				return value;
			}
			if (Warned.Add(name))
			{
				Debug.LogWarning((object)("[Quad's Cigars] a model uses a material called '" + name + "' that is not in the palette"));
			}
			return Materials.Values.FirstOrDefault();
		}

		internal static void Clear()
		{
			Materials.Clear();
			Tints.Clear();
		}
	}
	internal static class Meshes
	{
		private const int NT = 12;

		private const int NU = 6;

		private static readonly Dictionary<string, Mesh> Cache = new Dictionary<string, Mesh>();

		internal static Mesh Of(string shape)
		{
			//IL_0067: 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)
			if (Cache.TryGetValue(shape, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			int num;
			PrimitiveType val;
			GameObject val2;
			switch (shape)
			{
			case "Leaf":
				value = Leaf();
				break;
			case "Rib":
				value = Rib();
				break;
			default:
				num = 0;
				goto IL_0067;
			case "Cylinder":
				num = 2;
				goto IL_0067;
			case "Cube":
				{
					num = 3;
					goto IL_0067;
				}
				IL_0067:
				val = (PrimitiveType)num;
				val2 = GameObject.CreatePrimitive(val);
				value = val2.GetComponent<MeshFilter>().sharedMesh;
				Object.DestroyImmediate((Object)(object)val2);
				break;
			}
			Cache[shape] = value;
			return value;
		}

		internal static void Rebuild()
		{
			Cache.Remove("Leaf");
			Cache.Remove("Rib");
		}

		internal static void Clear()
		{
			foreach (KeyValuePair<string, Mesh> item in Cache)
			{
				if (item.Key == "Leaf" || item.Key == "Rib")
				{
					Object.Destroy((Object)(object)item.Value);
				}
			}
			Cache.Clear();
		}

		private static float HalfWidth(float t)
		{
			return 0.5f * Mathf.Pow(Mathf.Max(0f, Mathf.Sin((float)Math.PI * Mathf.Pow(t, 0.8f))), 0.75f) * (1f - 0.3f * t);
		}

		private static float Y(float t, float u, float lift = 0f)
		{
			return 0.1f * (1f - Mathf.Abs(u)) - 0.16f * t * t + 0.03f * Mathf.Sin(13f * t + 2.5f * u) * Mathf.Abs(u) * Mathf.Abs(u) + lift;
		}

		private static Vector3 OnLeaf(float t, float u, float lift)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(u * HalfWidth(t), Y(t, u, lift), t);
		}

		private static void AddGrid(List<Vector3> verts, List<int> tris, Vector3[][] grid)
		{
			//IL_0022: 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)
			int num = grid.Length;
			int num2 = grid[0].Length;
			int count = verts.Count;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num2; j++)
				{
					verts.Add(grid[i][j]);
				}
			}
			int count2 = verts.Count;
			for (int k = 0; k < num; k++)
			{
				for (int l = 0; l < num2; l++)
				{
					verts.Add(grid[k][l]);
				}
			}
			for (int m = 0; m < num - 1; m++)
			{
				for (int n = 0; n < num2 - 1; n++)
				{
					int num3 = m * num2 + n;
					int num4 = num3 + 1;
					int num5 = num3 + num2 + 1;
					int num6 = num3 + num2;
					tris.AddRange(new int[6]
					{
						count + num3,
						count + num5,
						count + num4,
						count + num3,
						count + num6,
						count + num5
					});
					tris.AddRange(new int[6]
					{
						count2 + num3,
						count2 + num4,
						count2 + num5,
						count2 + num3,
						count2 + num5,
						count2 + num6
					});
				}
			}
		}

		private static Mesh Finish(List<Vector3> verts, List<int> tris, string name)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			Mesh val = new Mesh
			{
				name = name,
				indexFormat = (IndexFormat)1
			};
			val.SetVertices(verts);
			val.SetTriangles(tris, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		private static Mesh Leaf()
		{
			//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)
			Vector3[][] array = new Vector3[13][];
			for (int i = 0; i <= 12; i++)
			{
				float num = (float)i / 12f;
				float num2 = HalfWidth(num);
				array[i] = (Vector3[])(object)new Vector3[7];
				for (int j = 0; j <= 6; j++)
				{
					float num3 = -1f + 2f * (float)j / 6f;
					array[i][j] = new Vector3(num3 * num2, Y(num, num3), num);
				}
			}
			List<Vector3> verts = new List<Vector3>();
			List<int> tris = new List<int>();
			AddGrid(verts, tris, array);
			return Finish(verts, tris, "dh_leaf");
		}

		private static void Ribbon(List<Vector3> verts, List<int> tris, Vector3[] points, float width)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0062: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Vector3[][] array = new Vector3[points.Length][];
			for (int i = 0; i < points.Length; i++)
			{
				Vector3 val = points[Mathf.Min(i + 1, points.Length - 1)] - points[Mathf.Max(i - 1, 0)];
				Vector3 val2 = Vector3.Cross(Vector3.up, val);
				val2 = val2 / (((Vector3)(ref val2)).magnitude + 1E-09f) * width / 2f;
				array[i] = (Vector3[])(object)new Vector3[2]
				{
					points[i] - val2,
					points[i] + val2
				};
			}
			AddGrid(verts, tris, array);
		}

		private static Mesh Rib()
		{
			//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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> verts = new List<Vector3>();
			List<int> tris = new List<int>();
			Vector3[] array = (Vector3[])(object)new Vector3[11];
			for (int i = 0; i <= 10; i++)
			{
				array[i] = OnLeaf((float)i / 10f * 0.96f, 0f, 0.012f);
			}
			Ribbon(verts, tris, array, 0.035f);
			for (int j = 1; j <= 6; j++)
			{
				int[] array2 = new int[2] { -1, 1 };
				foreach (int num in array2)
				{
					float num2 = 0.08f + (float)j * 0.12f;
					Vector3[] array3 = (Vector3[])(object)new Vector3[5];
					for (int l = 0; l < 5; l++)
					{
						array3[l] = OnLeaf(Mathf.Min(0.97f, num2 + 0.14f * (float)l / 4f), (float)num * 0.9f * (float)l / 4f, 0.012f);
					}
					Ribbon(verts, tris, array3, 0.016f);
				}
			}
			return Finish(verts, tris, "dh_rib");
		}
	}
	internal static class ModelBuilder
	{
		private static Matrix4x4 Local(object[] p)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			return Matrix4x4.TRS(new Vector3((float)p[3], (float)p[4], (float)p[5]), Quaternion.Euler((float)p[9], (float)p[10], (float)p[11]), Vector3.one);
		}

		private static Matrix4x4 WithScale(object[] p)
		{
			//IL_0018: 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_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)
			return Matrix4x4.TRS(new Vector3((float)p[3], (float)p[4], (float)p[5]), Quaternion.Euler((float)p[9], (float)p[10], (float)p[11]), new Vector3((float)p[6], (float)p[7], (float)p[8]));
		}

		internal static GameObject Build(Transform parent, object[][] parts, int layer, string name = "Model")
		{
			//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_000e: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: 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_0367: Expected O, but got Unknown
			//IL_0315: 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_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name)
			{
				layer = layer
			};
			val.transform.SetParent(parent, false);
			Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
			Dictionary<string, List<CombineInstance>> dictionary2 = new Dictionary<string, List<CombineInstance>>();
			List<string> list = new List<string>();
			CombineInstance item;
			foreach (object[] array in parts)
			{
				string text = (string)array[0];
				string text2 = (string)array[1];
				string text3 = (string)array[2];
				string text4 = (string)array[12];
				if (text2 == "Group")
				{
					GameObject val2 = new GameObject(text)
					{
						layer = layer
					};
					val2.transform.SetParent(val.transform, false);
					val2.transform.localPosition = new Vector3((float)array[3], (float)array[4], (float)array[5]);
					val2.transform.localRotation = Quaternion.Euler((float)array[9], (float)array[10], (float)array[11]);
					dictionary[text] = val2.transform;
					continue;
				}
				string text5 = text3 + "|" + text4;
				if (!dictionary2.TryGetValue(text5, out var value))
				{
					value = (dictionary2[text5] = new List<CombineInstance>());
					list.Add(text5);
				}
				List<CombineInstance> list3 = value;
				item = default(CombineInstance);
				((CombineInstance)(ref item)).mesh = Meshes.Of(text2);
				((CombineInstance)(ref item)).transform = WithScale(array);
				list3.Add(item);
			}
			foreach (string item2 in list)
			{
				int num = item2.IndexOf('|');
				string text6 = item2.Substring(0, num);
				string text7 = item2.Substring(num + 1);
				Mesh val3 = new Mesh
				{
					name = "dh_" + ((text6.Length > 0) ? (text6 + "_") : "") + text7,
					indexFormat = (IndexFormat)1
				};
				val3.CombineMeshes(dictionary2[item2].ToArray(), true, true);
				val3.RecalculateBounds();
				if (!Finite(val3.bounds))
				{
					Debug.LogWarning((object)("[Quad's Cigars] the mesh " + ((Object)val3).name + " of " + name + " came out with invalid points: making its shapes again"));
					Meshes.Rebuild();
					List<CombineInstance> list4 = new List<CombineInstance>();
					foreach (object[] array2 in parts)
					{
						if ((string)array2[1] != "Group" && (string)array2[2] + "|" + (string)array2[12] == item2)
						{
							item = default(CombineInstance);
							((CombineInstance)(ref item)).mesh = Meshes.Of((string)array2[1]);
							((CombineInstance)(ref item)).transform = WithScale(array2);
							list4.Add(item);
						}
					}
					val3.Clear();
					val3.CombineMeshes(list4.ToArray(), true, true);
					val3.RecalculateBounds();
					if (!Finite(val3.bounds))
					{
						Debug.LogWarning((object)("[Quad's Cigars] the mesh " + ((Object)val3).name + " of " + name + " is still invalid after making its shapes again"));
					}
				}
				GameObject val4 = new GameObject(text7)
				{
					layer = layer
				};
				val4.transform.SetParent((text6.Length > 0 && dictionary.TryGetValue(text6, out var value2)) ? value2 : val.transform, false);
				val4.AddComponent<MeshFilter>().sharedMesh = val3;
				((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterial = Look.Of(text7);
			}
			return val;
		}

		private static bool Finite(Bounds b)
		{
			//IL_0002: 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_002e: 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_0054: 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_007a: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!float.IsNaN(((Bounds)(ref b)).center.x) && !float.IsNaN(((Bounds)(ref b)).center.y) && !float.IsNaN(((Bounds)(ref b)).center.z) && !float.IsInfinity(((Bounds)(ref b)).extents.x) && !float.IsInfinity(((Bounds)(ref b)).extents.y) && !float.IsInfinity(((Bounds)(ref b)).extents.z) && !float.IsNaN(((Bounds)(ref b)).extents.x) && !float.IsNaN(((Bounds)(ref b)).extents.y))
			{
				return !float.IsNaN(((Bounds)(ref b)).extents.z);
			}
			return false;
		}

		internal static Bounds BoundsOf(object[][] parts)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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_0055: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_012c: 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_0143: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, Matrix4x4> dictionary = new Dictionary<string, Matrix4x4>();
			Bounds result = default(Bounds);
			bool flag = false;
			foreach (object[] array in parts)
			{
				string text = (string)array[1];
				string text2 = (string)array[2];
				Matrix4x4 value;
				Matrix4x4 val = ((text2.Length > 0 && dictionary.TryGetValue(text2, out value)) ? value : Matrix4x4.identity);
				if (text == "Group")
				{
					dictionary[(string)array[0]] = val * Local(array);
					continue;
				}
				Matrix4x4 val2 = val * WithScale(array);
				Vector3 zero = Vector3.zero;
				Vector3 val3 = Vector3.one * 0.5f;
				switch (text)
				{
				case "Cylinder":
					((Vector3)(ref val3))..ctor(0.5f, 1f, 0.5f);
					break;
				case "Leaf":
				case "Rib":
					((Vector3)(ref zero))..ctor(0f, -0.03f, 0.5f);
					((Vector3)(ref val3))..ctor(0.5f, 0.13f, 0.5f);
					break;
				}
				for (int j = 0; j < 8; j++)
				{
					Vector3 val4 = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(zero + new Vector3(((j & 1) == 0) ? (0f - val3.x) : val3.x, ((j & 2) == 0) ? (0f - val3.y) : val3.y, ((j & 4) == 0) ? (0f - val3.z) : val3.z));
					if (!flag)
					{
						((Bounds)(ref result))..ctor(val4, Vector3.zero);
						flag = true;
					}
					else
					{
						((Bounds)(ref result)).Encapsulate(val4);
					}
				}
			}
			return result;
		}
	}
	internal static class ModelIndex
	{
		internal static object[][] Parts(string name)
		{
			return name switch
			{
				"rack" => M_rack.Parts, 
				"barrel" => M_barrel.Parts, 
				"table" => M_table.Parts, 
				"humidor" => M_humidor.Parts, 
				"plant_meadow_seedling" => M_plant_meadow_seedling.Parts, 
				"plant_meadow_growing" => M_plant_meadow_growing.Parts, 
				"plant_meadow_mature" => M_plant_meadow_mature.Parts, 
				"plant_meadow_seedling_sick" => M_plant_meadow_seedling_sick.Parts, 
				"plant_meadow_growing_sick" => M_plant_meadow_growing_sick.Parts, 
				"leaf_meadow_fresh" => M_leaf_meadow_fresh.Parts, 
				"leaf_meadow_dried" => M_leaf_meadow_dried.Parts, 
				"leaf_meadow_aged" => M_leaf_meadow_aged.Parts, 
				"seeds_meadow" => M_seeds_meadow.Parts, 
				"plant_forest_seedling" => M_plant_forest_seedling.Parts, 
				"plant_forest_growing" => M_plant_forest_growing.Parts, 
				"plant_forest_mature" => M_plant_forest_mature.Parts, 
				"plant_forest_seedling_sick" => M_plant_forest_seedling_sick.Parts, 
				"plant_forest_growing_sick" => M_plant_forest_growing_sick.Parts, 
				"leaf_forest_fresh" => M_leaf_forest_fresh.Parts, 
				"leaf_forest_dried" => M_leaf_forest_dried.Parts, 
				"leaf_forest_aged" => M_leaf_forest_aged.Parts, 
				"seeds_forest" => M_seeds_forest.Parts, 
				"plant_plains_seedling" => M_plant_plains_seedling.Parts, 
				"plant_plains_growing" => M_plant_plains_growing.Parts, 
				"plant_plains_mature" => M_plant_plains_mature.Parts, 
				"plant_plains_seedling_sick" => M_plant_plains_seedling_sick.Parts, 
				"plant_plains_growing_sick" => M_plant_plains_growing_sick.Parts, 
				"leaf_plains_fresh" => M_leaf_plains_fresh.Parts, 
				"leaf_plains_dried" => M_leaf_plains_dried.Parts, 
				"leaf_plains_aged" => M_leaf_plains_aged.Parts, 
				"seeds_plains" => M_seeds_plains.Parts, 
				_ => throw new ArgumentException("no model called " + name), 
			};
		}
	}
	internal static class M_barrel
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[46][]
		{
			new object[13]
			{
				"body", "Cylinder", "", 0f, 0.44f, 0f, 0.74f, 0.44f, 0.74f, 0f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"belly", "Cylinder", "", 0f, 0.44f, 0f, 0.777f, 0.264f, 0.777f, 0f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"hoop", "Cylinder", "", 0f, 0.12f, 0f, 0.7548f, 0.022f, 0.7548f, 0f,
				0f, 0f, "Iron"
			},
			new object[13]
			{
				"hoop", "Cylinder", "", 0f, 0.34f, 0f, 0.7992f, 0.022f, 0.7992f, 0f,
				0f, 0f, "Iron"
			},
			new object[13]
			{
				"hoop", "Cylinder", "", 0f, 0.54f, 0f, 0.7992f, 0.022f, 0.7992f, 0f,
				0f, 0f, "Iron"
			},
			new object[13]
			{
				"hoop", "Cylinder", "", 0f, 0.76f, 0f, 0.7548f, 0.022f, 0.7548f, 0f,
				0f, 0f, "Iron"
			},
			new object[13]
			{
				"stave", "Cube", "", 0f, 0.44f, 0.3737f, 0.012f, 0.792f, 0.02f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0.1868f, 0.44f, 0.3236f, 0.012f, 0.792f, 0.02f, 0f,
				30f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0.3236f, 0.44f, 0.1869f, 0.012f, 0.792f, 0.02f, 0f,
				60f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0.3737f, 0.44f, 0f, 0.012f, 0.792f, 0.02f, 0f,
				90f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0.3236f, 0.44f, -0.1868f, 0.012f, 0.792f, 0.02f, 0f,
				120f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0.1868f, 0.44f, -0.3236f, 0.012f, 0.792f, 0.02f, 0f,
				150f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", 0f, 0.44f, -0.3737f, 0.012f, 0.792f, 0.02f, 0f,
				180f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", -0.1869f, 0.44f, -0.3236f, 0.012f, 0.792f, 0.02f, 0f,
				210f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", -0.3236f, 0.44f, -0.1869f, 0.012f, 0.792f, 0.02f, 0f,
				240f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", -0.3737f, 0.44f, 0f, 0.012f, 0.792f, 0.02f, 0f,
				270f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", -0.3236f, 0.44f, 0.1869f, 0.012f, 0.792f, 0.02f, 0f,
				300f, 0f, "CedarDark"
			},
			new object[13]
			{
				"stave", "Cube", "", -0.1869f, 0.44f, 0.3236f, 0.012f, 0.792f, 0.02f, 0f,
				330f, 0f, "CedarDark"
			},
			new object[13]
			{
				"rim", "Cylinder", "", 0f, 0.89f, 0f, 0.74f, 0.015f, 0.74f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"tap", "Cylinder", "", 0f, 0.2f, -0.42f, 0.05f, 0.06f, 0.05f, 90f,
				0f, 0f, "Brass"
			},
			new object[13]
			{
				"tapHandle", "Cylinder", "", 0f, 0.2f, -0.48f, 0.07f, 0.012f, 0.012f, 0f,
				0f, 90f, "Brass"
			},
			new object[13]
			{
				"handle", "Cylinder", "", -0.385f, 0.74f, 0f, 0.03f, 0.06f, 0.03f, 0f,
				0f, -90f, "Twine"
			},
			new object[13]
			{
				"handle", "Cylinder", "", 0.385f, 0.74f, 0f, 0.03f, 0.06f, 0.03f, 0f,
				0f, 90f, "Twine"
			},
			new object[13]
			{
				"contents", "Group", "", 0f, 0f, 0f, 1f, 1f, 1f, 0f,
				0f, 0f, ""
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", 0f, 0.9001f, 0.0223f, 0.15f, 0.594f, 0.36f, -50f,
				0f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", 0f, 0.9001f, 0.0223f, 0.15f, 0.594f, 0.36f, -50f,
				0f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", 0.0143f, 0.9001f, 0.0171f, 0.15f, 0.594f, 0.36f, -50f,
				40f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", 0.0143f, 0.9001f, 0.0171f, 0.15f, 0.594f, 0.36f, -50f,
				40f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", 0.022f, 0.9001f, 0.0039f, 0.15f, 0.594f, 0.36f, -50f,
				80f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", 0.022f, 0.9001f, 0.0039f, 0.15f, 0.594f, 0.36f, -50f,
				80f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", 0.0193f, 0.9001f, -0.0111f, 0.15f, 0.594f, 0.36f, -50f,
				120f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", 0.0193f, 0.9001f, -0.0111f, 0.15f, 0.594f, 0.36f, -50f,
				120f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", 0.0076f, 0.9001f, -0.0209f, 0.15f, 0.594f, 0.36f, -50f,
				160f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", 0.0076f, 0.9001f, -0.0209f, 0.15f, 0.594f, 0.36f, -50f,
				160f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", -0.0076f, 0.9001f, -0.0209f, 0.15f, 0.594f, 0.36f, -50f,
				200f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", -0.0076f, 0.9001f, -0.0209f, 0.15f, 0.594f, 0.36f, -50f,
				200f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", -0.0193f, 0.9001f, -0.0111f, 0.15f, 0.594f, 0.36f, -50f,
				240f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", -0.0193f, 0.9001f, -0.0111f, 0.15f, 0.594f, 0.36f, -50f,
				240f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", -0.022f, 0.9001f, 0.0039f, 0.15f, 0.594f, 0.36f, -50f,
				280f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", -0.022f, 0.9001f, 0.0039f, 0.15f, 0.594f, 0.36f, -50f,
				280f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"heapLeaf", "Leaf", "contents", -0.0143f, 0.9001f, 0.0171f, 0.15f, 0.594f, 0.36f, -50f,
				320f, 0f, "LeafAged"
			},
			new object[13]
			{
				"heapLeafRib", "Rib", "contents", -0.0143f, 0.9001f, 0.0171f, 0.15f, 0.594f, 0.36f, -50f,
				320f, 0f, "LeafAgedRib"
			},
			new object[13]
			{
				"lidOn", "Group", "", 0f, 0f, 0f, 1f, 1f, 1f, 0f,
				0f, 0f, ""
			},
			new object[13]
			{
				"lid", "Cylinder", "lidOn", 0.02f, 0.93f, 0f, 0.703f, 0.025f, 0.703f, 4f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"lidBatten", "Cube", "lidOn", 0.02f, 0.965f, 0f, 0.5f, 0.025f, 0.07f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"lidKnob", "Sphere", "lidOn", 0.02f, 0.995f, 0f, 0.07f, 0.05f, 0.07f, 0f,
				0f, 0f, "Brass"
			}
		};
	}
	internal static class M_humidor
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[17][]
		{
			new object[13]
			{
				"foot", "Cube", "", -0.24f, 0.05f, -0.17f, 0.07f, 0.1f, 0.07f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"foot", "Cube", "", -0.24f, 0.05f, 0.17f, 0.07f, 0.1f, 0.07f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"foot", "Cube", "", 0.24f, 0.05f, -0.17f, 0.07f, 0.1f, 0.07f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"foot", "Cube", "", 0.24f, 0.05f, 0.17f, 0.07f, 0.1f, 0.07f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"body", "Cube", "", 0f, 0.38f, 0f, 0.56f, 0.56f, 0.42f, 0f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"plinth", "Cube", "", 0f, 0.12f, 0f, 0.59f, 0.04f, 0.45f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"lid", "Cube", "", 0f, 0.71f, 0f, 0.6f, 0.05f, 0.46f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"lidTop", "Cube", "", 0f, 0.745f, 0f, 0.5f, 0.02f, 0.36f, 0f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"door", "Cube", "", 0f, 0.38f, -0.216f, 0.46f, 0.48f, 0.02f, 0f,
				0f, 0f, "CedarDark"
			},
			new object[13]
			{
				"panel", "Cube", "", 0f, 0.38f, -0.23f, 0.36f, 0.36f, 0.012f, 0f,
				0f, 0f, "Cedar"
			},
			new object[13]
			{
				"latch", "Sphere", "", 0.18f, 0.38f, -0.245f, 0.045f, 0.045f, 0.02f, 0f,
				0f, 0f, "Brass"
			},
			new object[13]
			{
				"hygrometer", "Cylinder", "", -0.14f, 0.52f, -0.245f, 0.1f, 0.012f, 0.1f, 90f,
				0f, 0f, "Brass"
			},
			new object[13]
			{
				"hygroFace", "Cylinder", "", -0.14f, 0.52f, -0.255f, 0.08f, 0.006f, 0.08f, 90f,
				0f, 0f, "Cream"
			},
			new object[13]
			{
				"hinge", "Cube", "", 0.24f, 0.22f, -0.23f, 0.025f, 0.07f, 0.015f, 0f,
				0f, 0f, "Brass"
			},
			new object[13]
			{
				"hinge", "Cube", "", 0.24f, 0.52f, -0.23f, 0.025f, 0.07f, 0.015f, 0f,
				0f, 0f, "Brass"
			},
			new object[13]
			{
				"cigarOnLid", "Cylinder", "", -0.1f, 0.772f, 0.02f, 0.026f, 0.08f, 0.026f, 0f,
				12f, 90f, "Body_maduro"
			},
			new object[13]
			{
				"cigarBandOnLid", "Cylinder", "", -0.07f, 0.772f, 0.017f, 0.029f, 0.011f, 0.029f, 0f,
				12f, 90f, "Band_maduro"
			}
		};
	}
	internal static class M_leaf_forest_aged
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "Aged_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "AgedRib_forest"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_forest_dried
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "Dry_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "DryRib_forest"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_forest_fresh
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				-47.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				-47.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				-28.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				-28.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				-9.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				-9.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				9.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				9.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				28.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				28.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				47.5f, 0f, "Leaf_forest"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				47.5f, 0f, "Rib_forest"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_meadow_aged
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "Aged_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "AgedRib_meadow"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_meadow_dried
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "Dry_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "DryRib_meadow"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_meadow_fresh
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				-47.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				-47.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				-28.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				-28.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				-9.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				-9.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				9.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1472f, 0.48f, 0.32f, -16f,
				9.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				28.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1472f, 0.48f, 0.32f, -12f,
				28.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				47.5f, 0f, "Leaf_meadow"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1472f, 0.48f, 0.32f, -8f,
				47.5f, 0f, "Rib_meadow"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_plains_aged
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				-47.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				-28.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				-9.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1088f, 0.648f, 0.32f, -16f,
				9.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1088f, 0.648f, 0.32f, -12f,
				28.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "Aged_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1088f, 0.648f, 0.32f, -8f,
				47.5f, 0f, "AgedRib_plains"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_plains_dried
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				-47.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				-28.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				-9.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.03f, -0.14f, 0.1152f, 0.6f, 0.32f, -16f,
				9.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.036f, -0.14f, 0.1152f, 0.6f, 0.32f, -12f,
				28.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"leaf", "Leaf", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "Dry_plains"
			},
			new object[13]
			{
				"leafRib", "Rib", "", 0f, 0.042f, -0.14f, 0.1152f, 0.6f, 0.32f, -8f,
				47.5f, 0f, "DryRib_plains"
			},
			new object[13]
			{
				"twine", "Cylinder", "", 0f, 0.042f, -0.115f, 0.05f, 0.022f, 0.05f, 90f,
				0f, 0f, "Twine"
			}
		};
	}
	internal static class M_leaf_plains_fresh
	{
		internal const float Scale = 1f;

		internal static readonly object[][] Parts = new object[13][]
		{
			new object[13]
			{
				"