Decompiled source of S1API Forked v2.4.8

Mods/S1API.Il2Cpp.MelonLoader.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using HarmonyLib;
using Il2Cpp;
using Il2CppFishNet;
using Il2CppFishNet.Connection;
using Il2CppFishNet.Managing;
using Il2CppFishNet.Managing.Client;
using Il2CppFishNet.Managing.Object;
using Il2CppFishNet.Managing.Scened;
using Il2CppFishNet.Managing.Server;
using Il2CppFishNet.Managing.Transporting;
using Il2CppFishNet.Object;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.AvatarFramework;
using Il2CppScheduleOne.AvatarFramework.Animation;
using Il2CppScheduleOne.Calling;
using Il2CppScheduleOne.Combat;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Dialogue;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.GameTime;
using Il2CppScheduleOne.Growing;
using Il2CppScheduleOne.Interaction;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Levelling;
using Il2CppScheduleOne.Map;
using Il2CppScheduleOne.Messaging;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.NPCs.Actions;
using Il2CppScheduleOne.NPCs.Behaviour;
using Il2CppScheduleOne.NPCs.Relation;
using Il2CppScheduleOne.NPCs.Responses;
using Il2CppScheduleOne.NPCs.Schedules;
using Il2CppScheduleOne.Noise;
using Il2CppScheduleOne.ObjectScripts;
using Il2CppScheduleOne.Persistence;
using Il2CppScheduleOne.Persistence.Datas;
using Il2CppScheduleOne.Persistence.Loaders;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.PlayerScripts.Health;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.Product.Packaging;
using Il2CppScheduleOne.Properties;
using Il2CppScheduleOne.Property;
using Il2CppScheduleOne.Quests;
using Il2CppScheduleOne.ScriptableObjects;
using Il2CppScheduleOne.Storage;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.Phone;
using Il2CppScheduleOne.UI.Phone.ContactsApp;
using Il2CppScheduleOne.UI.Phone.Messages;
using Il2CppScheduleOne.UI.Phone.ProductManagerApp;
using Il2CppScheduleOne.UI.WorldspacePopup;
using Il2CppScheduleOne.Variables;
using Il2CppScheduleOne.Vehicles;
using Il2CppScheduleOne.Vehicles.Modification;
using Il2CppScheduleOne.Vision;
using Il2CppScheduleOne.VoiceOver;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using S1API;
using S1API.Avatar;
using S1API.Conditions;
using S1API.Console;
using S1API.Economy;
using S1API.Entities;
using S1API.Entities.Appearances.AccessoryFields;
using S1API.Entities.Appearances.Base;
using S1API.Entities.Appearances.BodyLayerFields;
using S1API.Entities.Appearances.CustomizationFields;
using S1API.Entities.Appearances.FaceLayerFields;
using S1API.Entities.Customer;
using S1API.Entities.Dealer;
using S1API.Entities.Dialogue;
using S1API.Entities.Interfaces;
using S1API.Entities.Relation;
using S1API.Entities.Schedule;
using S1API.GameTime;
using S1API.Internal;
using S1API.Internal.Abstraction;
using S1API.Internal.Entities;
using S1API.Internal.Lifecycle;
using S1API.Internal.Map;
using S1API.Internal.Patches;
using S1API.Internal.Utils;
using S1API.Items;
using S1API.Logging;
using S1API.Map;
using S1API.Map.Buildings;
using S1API.Map.DeliveryLocations;
using S1API.Messaging;
using S1API.Money;
using S1API.PhoneApp;
using S1API.PhoneCalls;
using S1API.PhoneCalls.Constants;
using S1API.Products;
using S1API.Properties;
using S1API.Properties.Interfaces;
using S1API.Properties.Internal;
using S1API.Properties.Tokens;
using S1API.Quests;
using S1API.Quests.Constants;
using S1API.Saveables;
using S1API.Storages;
using S1API.Utils;
using S1API.Vehicles;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::S1API.S1API), "S1API (Forked by Bars)", "2.4.8", "KaBooMa", null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ifBars")]
[assembly: AssemblyConfiguration("Il2CppMelon")]
[assembly: AssemblyDescription("A Schedule One Mono / Il2Cpp Cross Compatibility Layer (Forked from the original S1API by Kabooma)")]
[assembly: AssemblyFileVersion("2.4.8.0")]
[assembly: AssemblyInformationalVersion("2.4.8+9034e40bb7aeb09acaaeeb27ad4b2066ed009a5b")]
[assembly: AssemblyProduct("S1API")]
[assembly: AssemblyTitle("S1API")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ifBars/S1API")]
[assembly: AssemblyVersion("2.4.8.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ClickHandler
{
	private readonly UnityAction _callback;

	public ClickHandler(UnityAction callback)
	{
		_callback = callback;
	}

	public void OnClick()
	{
		_callback.Invoke();
	}
}
namespace S1API
{
	public class S1API : MelonMod
	{
		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			SceneStateCleaner.ResetForSceneChange(sceneName, afterUnload: true);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			NPCNetworkBootstrap.EnsurePrefabsWarmup();
			SceneStateCleaner.ResetForSceneChange(sceneName, afterUnload: false);
		}
	}
}
namespace S1API.Vehicles
{
	public class LandVehicle
	{
		internal LandVehicle S1LandVehicle = null;

		internal bool _isDeferredByName = false;

		private static readonly Log _logger = new Log("S1API.LandVehicle");

		private static readonly FieldInfo? VehiclePriceField = typeof(LandVehicle).GetField("vehiclePrice", BindingFlags.NonPublic);

		private NetworkConnection? _conn;

		private string _guid = string.Empty;

		public float VehiclePrice
		{
			get
			{
				return S1LandVehicle.VehiclePrice;
			}
			set
			{
				VehiclePriceField?.SetValue(S1LandVehicle, value);
			}
		}

		public float TopSpeed
		{
			get
			{
				return S1LandVehicle.TopSpeed;
			}
			set
			{
				S1LandVehicle.TopSpeed = value;
			}
		}

		public bool IsPlayerOwned
		{
			get
			{
				return S1LandVehicle.IsPlayerOwned;
			}
			set
			{
				SetIsPlayerOwned(value);
			}
		}

		public VehicleColor Color
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected I4, but got Unknown
				return (VehicleColor)S1LandVehicle.OwnedColor;
			}
			set
			{
				SetColor(value);
			}
		}

		public string GUID => _guid;

		public LandVehicle(string vehicleCode)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			LandVehicle vehiclePrefab = NetworkSingleton<VehicleManager>.Instance.GetVehiclePrefab(vehicleCode);
			if ((Object)(object)vehiclePrefab == (Object)null)
			{
				_logger.Error("SpawnVehicle: '" + vehicleCode + "' is not a valid vehicle code!");
				return;
			}
			LandVehicle component = Object.Instantiate<GameObject>(((Component)vehiclePrefab).gameObject).GetComponent<LandVehicle>();
			component.SetGUID(GUIDManager.GenerateUniqueGUID());
			NetworkSingleton<VehicleManager>.Instance.AllVehicles.Add(component);
			S1LandVehicle = component;
			SetConnection();
			UpdateGuidFromGame();
		}

		public void Spawn(Vector3 position, Quaternion rotation)
		{
			//IL_0046: 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_0072: 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)
			if (!InstanceFinder.IsServer)
			{
				_logger.Warning("Spawn can only be called on the server!");
				return;
			}
			if ((Object)(object)S1LandVehicle == (Object)null)
			{
				throw new Exception("Unable to spawn vehicle, S1LandVehicle is null!");
			}
			((Component)S1LandVehicle).transform.position = position;
			((Component)S1LandVehicle).transform.rotation = rotation;
			((NetworkBehaviour)NetworkSingleton<VehicleManager>.Instance).Spawn(((Component)S1LandVehicle).gameObject, (NetworkConnection)null, default(Scene));
		}

		internal LandVehicle(LandVehicle landVehicle)
		{
			S1LandVehicle = landVehicle;
			SetConnection();
			UpdateGuidFromGame();
			_isDeferredByName = false;
		}

		internal LandVehicle(string vehicleName, bool isDeferred)
		{
			_isDeferredByName = isDeferred;
		}

		private void SetConnection()
		{
			NetworkManager networkManager = InstanceFinder.NetworkManager;
			if (networkManager.IsClientOnly)
			{
				NetworkConnection connection = InstanceFinder.ClientManager.Connection;
				if (connection != (NetworkConnection)null && connection.IsValid)
				{
					_conn = connection;
				}
			}
			else if (networkManager.IsServerOnly || (networkManager.IsServer && !networkManager.IsClient))
			{
				NetworkConnection owner = ((NetworkBehaviour)S1LandVehicle).Owner;
				if (owner != (NetworkConnection)null && owner.IsValid)
				{
					_conn = owner;
				}
			}
		}

		private void SetIsPlayerOwned(bool isPlayerOwned)
		{
			S1LandVehicle.SetIsPlayerOwned(_conn, isPlayerOwned);
			if (isPlayerOwned)
			{
				NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles.Add(S1LandVehicle);
			}
			else
			{
				NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles.Remove(S1LandVehicle);
			}
		}

		private void SetColor(VehicleColor color)
		{
			MethodInfo method = typeof(LandVehicle).GetMethod("SetOwnedColor", BindingFlags.Instance | BindingFlags.NonPublic);
			if (method == null)
			{
				_logger.Error("SetOwnedColor method not found!");
				return;
			}
			method.Invoke(S1LandVehicle, new object[2]
			{
				_conn,
				(object)(EVehicleColor)color
			});
		}

		private void UpdateGuidFromGame()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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)
			try
			{
				PropertyInfo property = typeof(LandVehicle).GetProperty("GUID", BindingFlags.Instance | BindingFlags.Public);
				if (!(property == null))
				{
					Guid val = (Guid)(property.GetValue(S1LandVehicle) ?? ((object)default(Guid)));
					_guid = ((object)(Guid)(ref val)).ToString();
				}
			}
			catch
			{
			}
		}
	}
	public enum ParkingAlignment
	{
		FrontToKerb,
		RearToKerb
	}
	public enum VehicleColor
	{
		Black,
		DarkGrey,
		LightGrey,
		White,
		Yellow,
		Orange,
		Red,
		DullRed,
		Pink,
		Purple,
		Navy,
		DarkBlue,
		LightBlue,
		Cyan,
		LightGreen,
		DarkGreen,
		Custom
	}
	public static class VehicleRegistry
	{
		private static readonly Dictionary<object, LandVehicle> _cache = new Dictionary<object, LandVehicle>();

		public static LandVehicle[] GetAll()
		{
			try
			{
				List<LandVehicle> allVehicles = NetworkSingleton<VehicleManager>.Instance.AllVehicles;
				if (allVehicles == null)
				{
					return Array.Empty<LandVehicle>();
				}
				List<LandVehicle> list = new List<LandVehicle>();
				Enumerator<LandVehicle> enumerator = allVehicles.GetEnumerator();
				while (enumerator.MoveNext())
				{
					LandVehicle current = enumerator.Current;
					if ((Object)(object)current != (Object)null)
					{
						LandVehicle landVehicle = Wrap(current);
						if (landVehicle != null)
						{
							list.Add(landVehicle);
						}
					}
				}
				return list.ToArray();
			}
			catch
			{
				return Array.Empty<LandVehicle>();
			}
		}

		public static LandVehicle GetByGUID(string guid)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(guid))
			{
				return null;
			}
			try
			{
				Guid val = default(Guid);
				((Guid)(ref val))..ctor(guid);
				LandVehicle @object = GUIDManager.GetObject<LandVehicle>(val);
				if ((Object)(object)@object == (Object)null)
				{
					return null;
				}
				return Wrap(@object);
			}
			catch
			{
				return null;
			}
		}

		public static LandVehicle GetByName(string gameObjectName)
		{
			if (string.IsNullOrEmpty(gameObjectName))
			{
				return null;
			}
			try
			{
				GameObject val = GameObject.Find(gameObjectName);
				if ((Object)(object)val != (Object)null)
				{
					LandVehicle component = val.GetComponent<LandVehicle>();
					if ((Object)(object)component != (Object)null)
					{
						return Wrap(component);
					}
				}
				List<LandVehicle> allVehicles = NetworkSingleton<VehicleManager>.Instance.AllVehicles;
				if (allVehicles != null)
				{
					for (int i = 0; i < allVehicles.Count; i++)
					{
						LandVehicle val2 = allVehicles[i];
						if ((Object)(object)val2 != (Object)null && ((Object)((Component)val2).gameObject).name == gameObjectName)
						{
							return Wrap(val2);
						}
					}
				}
				if (DeferredMapResolver.IsMenuScene())
				{
					LandVehicle deferredVehicle = new LandVehicle(gameObjectName, isDeferred: true);
					DeferredMapResolver.RegisterDeferredLookup(new DeferredLookup(gameObjectName, delegate(object resolved)
					{
						if (resolved is LandVehicle landVehicle && landVehicle != null && (Object)(object)landVehicle.S1LandVehicle != (Object)null)
						{
							deferredVehicle.S1LandVehicle = landVehicle.S1LandVehicle;
							deferredVehicle._isDeferredByName = false;
						}
					}));
					return deferredVehicle;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static LandVehicle CreateVehicle(string vehicleCode)
		{
			if (!string.IsNullOrEmpty(vehicleCode))
			{
				try
				{
					return new LandVehicle(vehicleCode);
				}
				catch
				{
					return null;
				}
			}
			return null;
		}

		private static LandVehicle Wrap(LandVehicle veh)
		{
			if ((Object)(object)veh == (Object)null)
			{
				return null;
			}
			if (_cache.TryGetValue(veh, out LandVehicle value))
			{
				return value;
			}
			LandVehicle landVehicle = new LandVehicle(veh);
			_cache[veh] = landVehicle;
			return landVehicle;
		}
	}
}
namespace S1API.Utils
{
	public static class ReflectionUtils
	{
		public static MethodInfo? GetMethod(Type? type, string methodName, BindingFlags bindingFlags)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.GetMethod(type, methodName, bindingFlags);
		}

		public static bool IsValueTuple(this object obj)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.IsValueTuple(obj);
		}

		public static object[]? GetValueTupleItems(this object obj)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.GetValueTupleItems(obj);
		}

		public static bool TrySetFieldOrProperty(object target, string memberName, object value)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.TrySetFieldOrProperty(target, memberName, value);
		}

		public static object? TryGetFieldOrProperty(object target, string memberName)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.TryGetFieldOrProperty(target, memberName);
		}
	}
}
namespace S1API.UI
{
	public static class UIFactory
	{
		private static Sprite roundedSprite;

		public static GameObject Panel(string name, Transform parent, Color bgColor, Vector2? anchorMin = null, Vector2? anchorMax = null, bool fullAnchor = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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 = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			if (fullAnchor)
			{
				val2.anchorMin = Vector2.zero;
				val2.anchorMax = Vector2.one;
				val2.offsetMin = Vector2.zero;
				val2.offsetMax = Vector2.zero;
			}
			else
			{
				val2.anchorMin = (Vector2)(((??)anchorMin) ?? new Vector2(0.5f, 0.5f));
				val2.anchorMax = (Vector2)(((??)anchorMax) ?? new Vector2(0.5f, 0.5f));
			}
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			return val;
		}

		public static Text Text(string name, string content, Transform parent, int fontSize = 14, TextAnchor anchor = 0, FontStyle style = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0035: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Text val3 = val.AddComponent<Text>();
			val3.text = content;
			val3.fontSize = fontSize;
			val3.alignment = anchor;
			val3.fontStyle = style;
			val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			((Graphic)val3).color = Color.white;
			val3.horizontalOverflow = (HorizontalWrapMode)0;
			val3.verticalOverflow = (VerticalWrapMode)1;
			return val3;
		}

		public static RectTransform ScrollableVerticalList(string name, Transform parent, out ScrollRect scrollRect)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0084: 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_009c: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			scrollRect = val.AddComponent<ScrollRect>();
			scrollRect.horizontal = false;
			GameObject val3 = new GameObject("Viewport");
			val3.transform.SetParent(val.transform, false);
			RectTransform val4 = val3.AddComponent<RectTransform>();
			val4.anchorMin = Vector2.zero;
			val4.anchorMax = Vector2.one;
			val4.offsetMin = Vector2.zero;
			val4.offsetMax = Vector2.zero;
			((Graphic)val3.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.05f);
			val3.AddComponent<Mask>().showMaskGraphic = false;
			scrollRect.viewport = val4;
			GameObject val5 = new GameObject("Content");
			val5.transform.SetParent(val3.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = new Vector2(0f, 1f);
			val6.anchorMax = new Vector2(1f, 1f);
			val6.pivot = new Vector2(0.5f, 1f);
			VerticalLayoutGroup val7 = val5.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val7).spacing = 10f;
			((LayoutGroup)val7).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val7).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val7).childForceExpandHeight = false;
			val5.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			scrollRect.content = val6;
			return val6;
		}

		public static void FitContentHeight(RectTransform content)
		{
			ContentSizeFitter val = ((Component)content).gameObject.GetComponent<ContentSizeFitter>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)content).gameObject.AddComponent<ContentSizeFitter>();
			}
			val.verticalFit = (FitMode)2;
		}

		public static (GameObject, Button, Text) RoundedButtonWithLabel(string name, string label, Transform parent, Color bgColor, float width, float height, int fontSize, Color textColor)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name + "_RoundedMask");
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(width, height);
			LayoutElement val3 = val.AddComponent<LayoutElement>();
			val3.preferredWidth = width;
			val3.preferredHeight = height;
			Image val4 = val.AddComponent<Image>();
			val4.sprite = GetRoundedSprite();
			val4.type = (Type)1;
			((Graphic)val4).color = Color.white;
			Mask val5 = val.AddComponent<Mask>();
			val5.showMaskGraphic = true;
			GameObject val6 = new GameObject(name);
			val6.transform.SetParent(val.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			Image val8 = val6.AddComponent<Image>();
			((Graphic)val8).color = bgColor;
			val8.sprite = GetRoundedSprite();
			val8.type = (Type)1;
			Button val9 = val6.AddComponent<Button>();
			((Selectable)val9).targetGraphic = (Graphic)(object)val8;
			GameObject val10 = new GameObject("Label");
			val10.transform.SetParent(val6.transform, false);
			RectTransform val11 = val10.AddComponent<RectTransform>();
			val11.anchorMin = Vector2.zero;
			val11.anchorMax = Vector2.one;
			val11.offsetMin = Vector2.zero;
			val11.offsetMax = Vector2.zero;
			Text val12 = val10.AddComponent<Text>();
			val12.text = label;
			val12.alignment = (TextAnchor)4;
			val12.fontSize = fontSize;
			val12.fontStyle = (FontStyle)1;
			((Graphic)val12).color = textColor;
			val12.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return (val, val9, val12);
		}

		private static Sprite GetRoundedSprite()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)roundedSprite != (Object)null)
			{
				return roundedSprite;
			}
			int num = 32;
			Texture2D val = new Texture2D(num, num, (TextureFormat)5, false);
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			float num2 = 6f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					bool flag = ((float)j < num2 && (float)i < num2 && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) > num2) || ((float)j > (float)num - num2 - 1f && (float)i < num2 && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, num2)) > num2) || ((float)j < num2 && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, (float)num - num2 - 1f)) > num2) || ((float)j > (float)num - num2 - 1f && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, (float)num - num2 - 1f)) > num2);
					val.SetPixel(j, i, Color32.op_Implicit(flag ? val2 : val3));
				}
			}
			val.Apply();
			Vector4 val4 = default(Vector4);
			((Vector4)(ref val4))..ctor(8f, 8f, 8f, 8f);
			roundedSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val4);
			return roundedSprite;
		}

		public static GameObject ButtonRow(string name, Transform parent, float spacing = 12f, TextAnchor alignment = 4)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val3).spacing = spacing;
			((LayoutGroup)val3).childAlignment = alignment;
			((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false;
			return val;
		}

		public static (GameObject, Button, Text) ButtonWithLabel(string name, string label, Transform parent, Color bgColor, float Width, float Height)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(Height, Width);
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			val3.sprite = Resources.GetBuiltinResource<Sprite>("UI/Skin/UISprite.psd");
			val3.type = (Type)1;
			Button val4 = val.AddComponent<Button>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			GameObject val5 = new GameObject("Label");
			val5.transform.SetParent(val.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.offsetMin = Vector2.zero;
			val6.offsetMax = Vector2.zero;
			Text val7 = val5.AddComponent<Text>();
			val7.text = label;
			val7.alignment = (TextAnchor)4;
			val7.fontSize = 16;
			val7.fontStyle = (FontStyle)1;
			((Graphic)val7).color = Color.white;
			val7.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return (val, val4, val7);
		}

		public static void SetIcon(Sprite sprite, Transform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0022: 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_003a: 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)
			GameObject val = new GameObject("Icon");
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			Image val3 = val.AddComponent<Image>();
			val3.sprite = sprite;
			val3.preserveAspect = true;
		}

		public static void CreateTextBlock(Transform parent, string title, string subtitle, bool isCompleted)
		{
			Text(((Object)parent).name + "Title", title, parent, 16, (TextAnchor)3, (FontStyle)1);
			Text(((Object)parent).name + "Subtitle", subtitle, parent, 14, (TextAnchor)0, (FontStyle)0);
			if (isCompleted)
			{
				Text("CompletedLabel", "<color=#888888><i>Already Delivered</i></color>", parent, 12, (TextAnchor)0, (FontStyle)0);
			}
		}

		public static void CreateRowButton(GameObject go, UnityAction clickHandler, bool enabled)
		{
			Button val = go.AddComponent<Button>();
			Image component = go.GetComponent<Image>();
			((Selectable)val).targetGraphic = (Graphic)(object)component;
			((Selectable)val).interactable = enabled;
			((UnityEvent)val.onClick).AddListener(clickHandler);
		}

		public static void ClearChildren(Transform parent)
		{
			for (int num = parent.childCount - 1; num >= 0; num--)
			{
				Transform child = parent.GetChild(num);
				Object.Destroy((Object)(object)((Component)child).gameObject);
			}
		}

		public static void VerticalLayoutOnGO(GameObject go, int spacing = 10, RectOffset? padding = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			VerticalLayoutGroup val = go.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val).spacing = spacing;
			((LayoutGroup)val).padding = (RectOffset)(((object)padding) ?? ((object)new RectOffset(10, 10, 10, 10)));
		}

		public static GameObject CreateQuestRow(string name, Transform parent, out GameObject iconPanel, out GameObject textPanel)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Row_" + name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(0f, 90f);
			val.AddComponent<LayoutElement>().minHeight = 50f;
			((Shadow)val.AddComponent<Outline>()).effectColor = new Color(0f, 0f, 0f, 0.2f);
			GameObject val3 = Panel("Separator", val.transform, new Color(1f, 1f, 1f, 0.05f));
			val3.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 1f);
			Image val4 = val.AddComponent<Image>();
			((Graphic)val4).color = new Color(0.12f, 0.12f, 0.12f);
			Button val5 = val.AddComponent<Button>();
			((Selectable)val5).targetGraphic = (Graphic)(object)val4;
			HorizontalLayoutGroup val6 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val6).spacing = 20f;
			((LayoutGroup)val6).padding = new RectOffset(75, 10, 10, 10);
			((LayoutGroup)val6).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false;
			LayoutElement val7 = val.AddComponent<LayoutElement>();
			val7.minHeight = 90f;
			val7.flexibleWidth = 1f;
			iconPanel = Panel("IconPanel", val.transform, new Color(0.12f, 0.12f, 0.12f));
			RectTransform component = iconPanel.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(80f, 80f);
			LayoutElement val8 = iconPanel.AddComponent<LayoutElement>();
			val8.preferredWidth = 80f;
			val8.preferredHeight = 80f;
			textPanel = Panel("TextPanel", val.transform, Color.clear);
			VerticalLayoutOnGO(textPanel, 2);
			LayoutElement val9 = textPanel.AddComponent<LayoutElement>();
			val9.minWidth = 200f;
			val9.flexibleWidth = 1f;
			return val;
		}

		public static GameObject TopBar(string name, Transform parent, string title, float topbarSize, int paddingLeft, int paddingRight, int paddingTop, int paddingBottom)
		{
			//IL_0012: 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_0031: 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_005c: Expected O, but got Unknown
			GameObject val = Panel(name, parent, new Color(0.15f, 0.15f, 0.15f), (Vector2?)new Vector2(0f, topbarSize), (Vector2?)new Vector2(1f, 1f), fullAnchor: false);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)val2).padding = new RectOffset(paddingLeft, paddingRight, paddingTop, paddingBottom);
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 20f;
			((LayoutGroup)val2).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true;
			Text val3 = Text("TopBarTitle", title, val.transform, 26, (TextAnchor)3, (FontStyle)1);
			LayoutElement val4 = ((Component)val3).gameObject.AddComponent<LayoutElement>();
			val4.minWidth = 300f;
			val4.flexibleWidth = 1f;
			return val;
		}

		public static void HorizontalLayoutOnGO(GameObject go, int spacing = 10, int padLeft = 0, int padRight = 0, int padTop = 0, int padBottom = 0, TextAnchor alignment = 4)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			HorizontalLayoutGroup val = go.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val).spacing = spacing;
			((LayoutGroup)val).childAlignment = alignment;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
			((LayoutGroup)val).padding = new RectOffset(padLeft, padRight, padTop, padBottom);
		}

		public static void SetLayoutGroupPadding(LayoutGroup layoutGroup, int left, int right, int top, int bottom)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			layoutGroup.padding = new RectOffset(left, right, top, bottom);
		}

		public static void BindAcceptButton(Button btn, Text label, string text, UnityAction callback)
		{
			label.text = text;
			((UnityEventBase)btn.onClick).RemoveAllListeners();
			((UnityEvent)btn.onClick).AddListener(callback);
		}
	}
}
namespace S1API.Storages
{
	public class StorageInstance
	{
		internal readonly StorageEntity S1Storage;

		public ItemSlotInstance[] Slots => ((IEnumerable<ItemSlot>)S1Storage.ItemSlots.ToArray()).Select((ItemSlot itemSlot) => new ItemSlotInstance(itemSlot)).ToArray();

		public event Action OnOpened
		{
			add
			{
				EventHelper.AddListener(value, S1Storage.onOpened);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1Storage.onOpened);
			}
		}

		public event Action OnClosed
		{
			add
			{
				EventHelper.AddListener(value, S1Storage.onClosed);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1Storage.onClosed);
			}
		}

		internal StorageInstance(StorageEntity storage)
		{
			S1Storage = storage;
		}

		public bool CanItemFit(ItemInstance itemInstance, int quantity = 1)
		{
			return S1Storage.CanItemFit(itemInstance.S1ItemInstance, quantity);
		}

		public void AddItem(ItemInstance itemInstance)
		{
			S1Storage.InsertItem(itemInstance.S1ItemInstance, true);
		}
	}
}
namespace S1API.Saveables
{
	[Obsolete("Manual registration is no longer required. Classes that directly inherit from Saveable are automatically discovered. Remove calls to ModSaveableRegistry.Register() and simply inherit from Saveable.")]
	public static class ModSaveableRegistry
	{
		internal class Entry
		{
			public Saveable Saveable;

			public string? FolderName;
		}

		internal static readonly List<Entry> Registered = new List<Entry>();

		[Obsolete("Manual registration is no longer required. Classes that directly inherit from Saveable are automatically discovered.")]
		public static void Register(Saveable saveable, string? folderName = null)
		{
			if (saveable != null)
			{
				MelonLogger.Warning($"ModSaveableRegistry.Register() is deprecated! The saveable '{saveable.GetType().Name}' will be automatically discovered. Mod users can safely ignore this warning - their saves will continue to work normally. Mod developers should remove ModSaveableRegistry.Register() calls and simply inherit from Saveable.");
				Registered.Add(new Entry
				{
					Saveable = saveable,
					FolderName = folderName
				});
			}
		}
	}
	internal static class SaveableAutoRegistry
	{
		[CompilerGenerated]
		private sealed class <GetOrCreateInstances>d__7 : IEnumerable<Saveable>, IEnumerable, IEnumerator<Saveable>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private Saveable <>2__current;

			private int <>l__initialThreadId;

			private List<Type>.Enumerator <>s__1;

			private Type <saveableType>5__2;

			private Saveable <instance>5__3;

			Saveable IEnumerator<Saveable>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetOrCreateInstances>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = default(List<Type>.Enumerator);
				<saveableType>5__2 = null;
				<instance>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					int num = <>1__state;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -3;
						goto IL_00eb;
					}
					<>1__state = -1;
					<>s__1 = _discoveredSaveableTypes.GetEnumerator();
					<>1__state = -3;
					goto IL_00fa;
					IL_00eb:
					<instance>5__3 = null;
					<saveableType>5__2 = null;
					goto IL_00fa;
					IL_00fa:
					if (<>s__1.MoveNext())
					{
						<saveableType>5__2 = <>s__1.Current;
						if (!_instances.TryGetValue(<saveableType>5__2, out <instance>5__3))
						{
							try
							{
								<instance>5__3 = (Saveable)Activator.CreateInstance(<saveableType>5__2, nonPublic: true);
								if (<instance>5__3 != null)
								{
									_instances[<saveableType>5__2] = <instance>5__3;
								}
							}
							catch
							{
							}
						}
						if (<instance>5__3 != null)
						{
							<>2__current = <instance>5__3;
							<>1__state = 1;
							return true;
						}
						goto IL_00eb;
					}
					<>m__Finally1();
					<>s__1 = default(List<Type>.Enumerator);
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__1).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<Saveable> IEnumerable<Saveable>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetOrCreateInstances>d__7(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<Saveable>)this).GetEnumerator();
			}
		}

		private static readonly List<Type> _discoveredSaveableTypes = new List<Type>();

		private static readonly Dictionary<Type, Saveable> _instances = new Dictionary<Type, Saveable>();

		private static bool _discoveryPerformed = false;

		private static readonly object _lock = new object();

		public static IEnumerable<Saveable> GetRegisteredSaveables()
		{
			lock (_lock)
			{
				if (!_discoveryPerformed)
				{
					DiscoverSaveableTypes();
					_discoveryPerformed = true;
				}
				return GetOrCreateInstances();
			}
		}

		private static void DiscoverSaveableTypes()
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					try
					{
						if (assembly == executingAssembly)
						{
							continue;
						}
						string? fullName = assembly.FullName;
						if (fullName != null && fullName.StartsWith("System"))
						{
							continue;
						}
						string? fullName2 = assembly.FullName;
						if (fullName2 != null && fullName2.StartsWith("Unity"))
						{
							continue;
						}
						string? fullName3 = assembly.FullName;
						if (fullName3 != null && fullName3.StartsWith("mscorlib"))
						{
							continue;
						}
						string? fullName4 = assembly.FullName;
						if (fullName4 != null && fullName4.StartsWith("netstandard"))
						{
							continue;
						}
						string? fullName5 = assembly.FullName;
						if (fullName5 != null && fullName5.StartsWith("Microsoft"))
						{
							continue;
						}
						string? fullName6 = assembly.FullName;
						if (fullName6 != null && fullName6.StartsWith("Il2Cpp"))
						{
							continue;
						}
						string? fullName7 = assembly.FullName;
						if (fullName7 != null && fullName7.StartsWith("MelonLoader"))
						{
							continue;
						}
						string? fullName8 = assembly.FullName;
						if ((fullName8 != null && fullName8.StartsWith("0Harmony")) || assembly.IsDynamic)
						{
							continue;
						}
						Type[] array;
						try
						{
							array = assembly.GetTypes();
						}
						catch (ReflectionTypeLoadException ex)
						{
							array = ex.Types.Where((Type t) => t != null).ToArray();
						}
						catch
						{
							goto end_IL_0020;
						}
						Type[] array2 = array;
						foreach (Type type in array2)
						{
							try
							{
								if (!(type == null) && !type.IsAbstract && !type.IsInterface && !type.IsGenericTypeDefinition && IsDirectSaveableInheritor(type))
								{
									_discoveredSaveableTypes.Add(type);
								}
							}
							catch
							{
							}
						}
						end_IL_0020:;
					}
					catch
					{
					}
				}
			}
			catch (Exception ex2)
			{
				try
				{
					MelonLogger.Warning("[S1API] Error during saveable type discovery: " + ex2.Message);
				}
				catch
				{
				}
			}
		}

		private static bool IsDirectSaveableInheritor(Type type)
		{
			if (!typeof(Saveable).IsAssignableFrom(type))
			{
				return false;
			}
			if (type.IsAbstract || type.IsInterface)
			{
				return false;
			}
			Type baseType = type.BaseType;
			return baseType == typeof(Saveable);
		}

		[IteratorStateMachine(typeof(<GetOrCreateInstances>d__7))]
		private static IEnumerable<Saveable> GetOrCreateInstances()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetOrCreateInstances>d__7(-2);
		}

		internal static void ClearCache()
		{
			lock (_lock)
			{
				_discoveredSaveableTypes.Clear();
				_instances.Clear();
				_discoveryPerformed = false;
			}
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	public class SaveableField : Attribute
	{
		internal string SaveName { get; }

		public SaveableField(string saveName)
		{
			SaveName = saveName;
		}
	}
}
namespace S1API.Quests
{
	public abstract class Quest : Saveable
	{
		protected readonly List<QuestEntry> QuestEntries = new List<QuestEntry>();

		[SaveableField("QuestData")]
		private readonly QuestData _questData;

		internal readonly Quest S1Quest;

		private readonly GameObject _gameObject;

		protected abstract string Title { get; }

		protected abstract string Description { get; }

		protected virtual bool AutoBegin => true;

		protected QuestState QuestState => (QuestState)S1Quest.State;

		internal string? SaveFolder => S1Quest.SaveFolderName;

		protected virtual Sprite? QuestIcon => null;

		public Quest()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			_questData = new QuestData(GetType().Name);
			_gameObject = new GameObject("Quest");
			S1Quest = _gameObject.AddComponent<Quest>();
			S1Quest.StaticGUID = string.Empty;
			S1Quest.title = Title;
			S1Quest.onActiveState = new UnityEvent();
			S1Quest.onComplete = new UnityEvent();
			S1Quest.onInitialComplete = new UnityEvent();
			S1Quest.onQuestBegin = new UnityEvent();
			S1Quest.onQuestEnd = new UnityEvent<EQuestState>();
			S1Quest.onTrackChange = new UnityEvent<bool>();
			S1Quest.TrackOnBegin = true;
			S1Quest.AutoCompleteOnAllEntriesComplete = true;
			S1Quest.autoInitialize = false;
			GameObject val = new GameObject("IconPrefab", (Type[])(object)new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Image>()
			});
			val.transform.SetParent(_gameObject.transform);
			Image component = val.GetComponent<Image>();
			component.sprite = QuestIcon ?? ((App<ContactsApp>)(object)PlayerSingleton<ContactsApp>.Instance).AppIcon;
			S1Quest.IconPrefab = val.GetComponent<RectTransform>();
			GameObject val2 = new GameObject("PoIUIPrefab", (Type[])(object)new Type[4]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<EventTrigger>(),
				CrossType.Of<Button>()
			});
			val2.transform.SetParent(_gameObject.transform);
			GameObject val3 = new GameObject("MainLabel", (Type[])(object)new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Text>()
			});
			val3.transform.SetParent(val2.transform);
			GameObject val4 = new GameObject("IconContainer", (Type[])(object)new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Image>()
			});
			val4.transform.SetParent(val2.transform);
			Image component2 = val4.GetComponent<Image>();
			component2.sprite = QuestIcon ?? ((App<ContactsApp>)(object)PlayerSingleton<ContactsApp>.Instance).AppIcon;
			RectTransform component3 = ((Component)component2).GetComponent<RectTransform>();
			component3.sizeDelta = new Vector2(20f, 20f);
			GameObject val5 = new GameObject("POIPrefab");
			val5.SetActive(false);
			val5.transform.SetParent(_gameObject.transform);
			POI val6 = val5.AddComponent<POI>();
			val6.DefaultMainText = "Did it work?";
			val6.UIPrefab = val2;
			S1Quest.PoIPrefab = val5;
			S1Quest.onQuestEnd.AddListener(UnityAction<EQuestState>.op_Implicit((Action<EQuestState>)OnQuestEnded));
		}

		internal override void CreateInternal()
		{
			base.CreateInternal();
			Quest s1Quest = S1Quest;
			string title = Title;
			string description = Description;
			Il2CppReferenceArray<QuestEntryData> obj = Il2CppReferenceArray<QuestEntryData>.op_Implicit(Array.Empty<QuestEntryData>());
			Quest s1Quest2 = S1Quest;
			s1Quest.InitializeQuest(title, description, obj, (s1Quest2 != null) ? s1Quest2.StaticGUID : null);
			if (AutoBegin)
			{
				Quest s1Quest3 = S1Quest;
				if (s1Quest3 != null)
				{
					s1Quest3.Begin(true);
				}
			}
		}

		internal override void SaveInternal(string folderPath, ref List<string> extraSaveables)
		{
			string text = Path.Combine(folderPath, S1Quest.SaveFolderName);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			base.SaveInternal(text, ref extraSaveables);
		}

		internal void OnQuestEnded(EQuestState questState)
		{
			Quest.Quests.Remove(S1Quest);
			QuestManager.Quests.Remove(this);
		}

		protected QuestEntry AddEntry(string title, Vector3? poiPosition = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("QuestEntry");
			Transform transform = val.transform;
			GameObject gameObject = _gameObject;
			transform.SetParent((gameObject != null) ? gameObject.transform : null);
			QuestEntry val2 = val.AddComponent<QuestEntry>();
			val2.PoILocation = val.transform;
			S1Quest.Entries.Add(val2);
			QuestEntry questEntry = new QuestEntry(val2)
			{
				Title = title,
				POIPosition = (Vector3)(((??)poiPosition) ?? Vector3.zero)
			};
			QuestEntries.Add(questEntry);
			return questEntry;
		}

		public void Begin()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Begin(true);
			}
		}

		public void Cancel()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Cancel(true);
			}
		}

		public void Expire()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Expire(true);
			}
		}

		public void Fail()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Fail(true);
			}
		}

		public void Complete()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Complete(true);
			}
		}

		public void End()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.End();
			}
		}
	}
	public class QuestData
	{
		public readonly string ClassName;

		public QuestData(string className)
		{
			ClassName = className;
		}
	}
	public class QuestEntry
	{
		internal readonly QuestEntry S1QuestEntry;

		public QuestState State => (QuestState)S1QuestEntry.State;

		public string Title
		{
			get
			{
				return S1QuestEntry.Title;
			}
			set
			{
				S1QuestEntry.SetEntryTitle(value);
			}
		}

		public Vector3 POIPosition
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return S1QuestEntry.PoILocation.position;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				S1QuestEntry.PoILocation.position = value;
			}
		}

		public event Action OnComplete
		{
			add
			{
				EventHelper.AddListener(value, S1QuestEntry.onComplete);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1QuestEntry.onComplete);
			}
		}

		internal QuestEntry(QuestEntry questEntry)
		{
			S1QuestEntry = questEntry;
		}

		public void Begin()
		{
			S1QuestEntry.Begin();
		}

		public void Complete()
		{
			S1QuestEntry.Complete();
		}

		public void SetState(QuestState questState)
		{
			S1QuestEntry.SetState((EQuestState)questState, true);
		}
	}
	public static class QuestManager
	{
		internal static readonly List<Quest> Quests = new List<Quest>();

		public static Quest CreateQuest<T>(string? guid = null) where T : Quest
		{
			return CreateQuest(typeof(T), guid);
		}

		public static Quest CreateQuest(Type questType, string? guid = null)
		{
			Quest quest = (Quest)Activator.CreateInstance(questType);
			if (quest == null)
			{
				throw new Exception("Unable to create quest instance of " + questType.FullName + "!");
			}
			Quests.Add(quest);
			return quest;
		}

		public static Quest? GetQuestByGuid(string guid)
		{
			string guid2 = guid;
			return Quests.FirstOrDefault((Quest x) => x.S1Quest.StaticGUID == guid2);
		}

		public static Quest? GetQuestByName(string questName)
		{
			string questName2 = questName;
			return Quests.FirstOrDefault((Quest x) => x.S1Quest.Title == questName2);
		}
	}
}
namespace S1API.Quests.Constants
{
	public enum QuestAction
	{
		Begin,
		Success,
		Fail,
		Expire,
		Cancel
	}
	public enum QuestState
	{
		Inactive,
		Active,
		Completed,
		Failed,
		Expired,
		Cancelled
	}
}
namespace S1API.Property
{
	public abstract class BaseProperty
	{
		public abstract string PropertyName { get; }

		public abstract string PropertyCode { get; }

		public abstract float Price { get; set; }

		public abstract bool IsOwned { get; }

		public abstract int EmployeeCapacity { get; set; }

		public abstract void SetOwned();

		public abstract bool IsPointInside(Vector3 point);
	}
	public static class BusinessManager
	{
		public static List<BusinessWrapper> GetAllBusinesses()
		{
			List<BusinessWrapper> list = new List<BusinessWrapper>();
			Enumerator<Business> enumerator = Business.Businesses.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Business current = enumerator.Current;
				list.Add(new BusinessWrapper(current));
			}
			return list;
		}

		public static List<BusinessWrapper> GetOwnedBusinesses()
		{
			List<BusinessWrapper> list = new List<BusinessWrapper>();
			Enumerator<Business> enumerator = Business.OwnedBusinesses.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Business current = enumerator.Current;
				list.Add(new BusinessWrapper(current));
			}
			return list;
		}

		public static BusinessWrapper? FindBusinessByName(string name)
		{
			Enumerator<Business> enumerator = Business.Businesses.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Business current = enumerator.Current;
				if (((Property)current).PropertyName == name)
				{
					return new BusinessWrapper(current);
				}
			}
			return null;
		}
	}
	public class BusinessWrapper : PropertyWrapper
	{
		[CompilerGenerated]
		private sealed class <get_LaunderingCapacityPaths>d__19 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public BusinessWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_LaunderingCapacityPaths>d__19(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = "@Businesses/" + <baseName>5__1 + "/Grid/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <>4__this.PropertyName + "/Grid/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <baseName>5__1 + "/Grid (1)/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <>4__this.PropertyName + "/Grid (1)/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_LaunderingCapacityPaths>d__19 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_LaunderingCapacityPaths>d__19(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <get_SignPaths>d__15 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public BusinessWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_SignPaths>d__15(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign_Blue/Price";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign_Blue (1)/Price";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign_Blue/Price";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign_Blue (1)/Price";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_SignPaths>d__15 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_SignPaths>d__15(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		internal readonly Business InnerBusiness;

		public float LaunderCapacity
		{
			get
			{
				return InnerBusiness.LaunderCapacity;
			}
			set
			{
				InnerBusiness.LaunderCapacity = value;
				foreach (string launderingCapacityPath in LaunderingCapacityPaths)
				{
					if (TrySetTMPText(launderingCapacityPath, MoneyManager.FormatAmount(value, false, false), "laundering capacity"))
					{
						break;
					}
				}
			}
		}

		public List<LaunderingOperation> LaunderingOperations
		{
			get
			{
				List<LaunderingOperation> list = new List<LaunderingOperation>();
				Enumerator<LaunderingOperation> enumerator = InnerBusiness.LaunderingOperations.GetEnumerator();
				while (enumerator.MoveNext())
				{
					LaunderingOperation current = enumerator.Current;
					list.Add(new LaunderingOperation(current));
				}
				return list;
			}
		}

		public float CurrentLaunderTotal => InnerBusiness.currentLaunderTotal;

		public float AppliedLaunderLimit => InnerBusiness.appliedLaunderLimit;

		internal override string SignPrefix => "@Businesses/";

		internal override IEnumerable<string> SignPaths
		{
			[IteratorStateMachine(typeof(<get_SignPaths>d__15))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_SignPaths>d__15 <get_SignPaths>d__ = new <get_SignPaths>d__15(-2);
				<get_SignPaths>d__.<>4__this = this;
				return <get_SignPaths>d__;
			}
		}

		internal override string WhiteboardPath => "Map/Container/RE Office/Interior/Whiteboard (1)/PropertyListing " + PropertyName + "/Price";

		internal IEnumerable<string> LaunderingCapacityPaths
		{
			[IteratorStateMachine(typeof(<get_LaunderingCapacityPaths>d__19))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_LaunderingCapacityPaths>d__19 <get_LaunderingCapacityPaths>d__ = new <get_LaunderingCapacityPaths>d__19(-2);
				<get_LaunderingCapacityPaths>d__.<>4__this = this;
				return <get_LaunderingCapacityPaths>d__;
			}
		}

		public BusinessWrapper(Business business)
			: base((Property)(object)business)
		{
			InnerBusiness = business;
		}

		public void AddLaunderingOperation(float amount, int minutesSinceStarted)
		{
			InnerBusiness.StartLaunderingOperation(amount, minutesSinceStarted);
		}
	}
	public class LaunderingOperation
	{
		internal readonly LaunderingOperation InnerLaunderingOperation;

		public BusinessWrapper Business
		{
			get
			{
				return new BusinessWrapper(InnerLaunderingOperation.business);
			}
			set
			{
				InnerLaunderingOperation.business = value.InnerBusiness;
			}
		}

		public float Amount
		{
			get
			{
				return InnerLaunderingOperation.amount;
			}
			set
			{
				InnerLaunderingOperation.amount = value;
			}
		}

		public int MinutesSinceStarted
		{
			get
			{
				return InnerLaunderingOperation.minutesSinceStarted;
			}
			set
			{
				InnerLaunderingOperation.minutesSinceStarted = value;
			}
		}

		public int CompletionTimeInMinutes
		{
			get
			{
				return InnerLaunderingOperation.completionTime_Minutes;
			}
			set
			{
				InnerLaunderingOperation.completionTime_Minutes = value;
			}
		}

		public LaunderingOperation(LaunderingOperation launderingOperation)
		{
			InnerLaunderingOperation = launderingOperation;
		}

		public LaunderingOperation(BusinessWrapper business, float amount, int minutesSinceStarted, int completionTimeInMinutes = 1140)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			InnerLaunderingOperation = new LaunderingOperation(business.InnerBusiness, amount, minutesSinceStarted);
			InnerLaunderingOperation.completionTime_Minutes = completionTimeInMinutes;
		}
	}
	public static class PropertyManager
	{
		public static List<PropertyWrapper> GetAllProperties()
		{
			List<PropertyWrapper> list = new List<PropertyWrapper>();
			Enumerator<Property> enumerator = Property.Properties.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Property current = enumerator.Current;
				list.Add(new PropertyWrapper(current));
			}
			return list;
		}

		public static List<PropertyWrapper> GetOwnedProperties()
		{
			List<PropertyWrapper> list = new List<PropertyWrapper>();
			Enumerator<Property> enumerator = Property.OwnedProperties.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Property current = enumerator.Current;
				list.Add(new PropertyWrapper(current));
			}
			return list;
		}

		public static PropertyWrapper FindPropertyByName(string name)
		{
			Enumerator<Property> enumerator = Property.Properties.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Property current = enumerator.Current;
				if (current.PropertyName == name)
				{
					return new PropertyWrapper(current);
				}
			}
			return null;
		}
	}
	public class PropertyWrapper : BaseProperty
	{
		[CompilerGenerated]
		private sealed class <get_SignPaths>d__21 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public PropertyWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_SignPaths>d__21(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign/Price";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign/Price";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign (1)/Price";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign (1)/Price";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_SignPaths>d__21 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_SignPaths>d__21(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		internal readonly Property InnerProperty;

		public override string PropertyName => InnerProperty.PropertyName;

		public override string PropertyCode => InnerProperty.PropertyCode;

		public override float Price
		{
			get
			{
				return InnerProperty.Price;
			}
			set
			{
				InnerProperty.Price = value;
				UpdatePriceDisplay(value);
			}
		}

		public override bool IsOwned => InnerProperty.IsOwned;

		public override int EmployeeCapacity
		{
			get
			{
				return InnerProperty.EmployeeCapacity;
			}
			set
			{
				InnerProperty.EmployeeCapacity = value;
			}
		}

		internal virtual string SignPrefix => "@Properties/";

		internal virtual string WhiteboardPath => "Map/Container/RE Office/Interior/Whiteboard/PropertyListing " + PropertyName + "/Price";

		internal virtual IEnumerable<string> SignPaths
		{
			[IteratorStateMachine(typeof(<get_SignPaths>d__21))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_SignPaths>d__21 <get_SignPaths>d__ = new <get_SignPaths>d__21(-2);
				<get_SignPaths>d__.<>4__this = this;
				return <get_SignPaths>d__;
			}
		}

		public PropertyWrapper(Property property)
		{
			InnerProperty = property;
		}

		public override void SetOwned()
		{
			InnerProperty.SetOwned();
		}

		public override bool IsPointInside(Vector3 point)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return InnerProperty.DoBoundsContainPoint(point);
		}

		internal void UpdatePriceDisplay(float price)
		{
			string priceText = MoneyManager.FormatAmount(price, false, false);
			TrySetTMPText(WhiteboardPath, priceText, "whiteboard");
			foreach (string signPath in SignPaths)
			{
				if (TrySetTMPText(signPath, priceText, "sign"))
				{
					break;
				}
			}
		}

		internal bool TrySetTMPText(string path, string priceText, string context)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				TMP_Text component = val.GetComponent<TMP_Text>();
				if ((Object)(object)component != (Object)null)
				{
					component.text = priceText;
					return true;
				}
				Debug.LogWarning(Object.op_Implicit("TMP_Text not found on " + context + " price object."));
			}
			else
			{
				Debug.LogWarning(Object.op_Implicit(context + " price object not found at path: " + path));
			}
			return false;
		}
	}
}
namespace S1API.Properties
{
	public class ProductPropertyWrapper : PropertyBase
	{
		private readonly Property _innerProperty;

		public override string ID => _innerProperty.ID;

		public override string Name => _innerProperty.Name;

		public override string name => ((Object)_innerProperty).name;

		public override string Description => _innerProperty.Description;

		public override int Tier => _innerProperty.Tier;

		public override float Addictiveness => _innerProperty.Addictiveness;

		internal Property InnerProperty => _innerProperty;

		internal ProductPropertyWrapper(Property property)
		{
			_innerProperty = property;
		}
	}
	public static class Property
	{
		public static readonly PropertyBase Munchies = new Munchies();

		public static readonly PropertyBase AntiGravity = new AntiGravity();

		public static readonly PropertyBase Energizing = new Energizing();

		public static readonly PropertyBase Focused = new Focused();

		public static readonly PropertyBase Smelly = new Smelly();

		public static readonly PropertyBase Euphoric = new Euphoric();

		public static readonly PropertyBase Cyclopean = new Cyclopean();

		public static readonly PropertyBase Slippery = new Slippery();

		public static readonly PropertyBase Shrinking = new Shrinking();

		public static readonly PropertyBase Seizure = new Seizure();

		public static readonly PropertyBase Electrifying = new Electrifying();

		public static readonly PropertyBase Zombifying = new Zombifying();

		public static readonly PropertyBase Disorienting = new Disorienting();

		public static readonly PropertyBase Sedating = new Sedating();

		public static readonly PropertyBase CalorieDense = new CalorieDense();

		public static readonly PropertyBase TropicThunder = new TropicThunder();

		public static readonly PropertyBase Toxic = new Toxic();

		public static readonly PropertyBase ThoughtProvoking = new ThoughtProvoking();

		public static readonly PropertyBase Lethal = new Lethal();

		public static readonly PropertyBase Calming = new Calming();

		public static readonly PropertyBase Schizophrenic = new Schizophrenic();

		public static readonly PropertyBase Spicy = new Spicy();

		public static readonly PropertyBase Laxative = new Laxative();

		public static readonly PropertyBase BrightEyed = new BrightEyed();

		public static readonly PropertyBase Sneaky = new Sneaky();

		public static readonly PropertyBase Jennerising = new Jennerising();

		public static readonly PropertyBase Balding = new Balding();

		public static readonly PropertyBase Glowie = new Glowie();

		public static readonly PropertyBase Refreshing = new Refreshing();

		public static readonly PropertyBase Athletic = new Athletic();

		public static readonly PropertyBase LongFaced = new LongFaced();

		public static readonly PropertyBase Paranoia = new Paranoia();

		public static readonly PropertyBase Gingeritis = new Gingeritis();

		public static readonly PropertyBase Foggy = new Foggy();

		public static readonly PropertyBase Explosive = new Explosive();
	}
}
namespace S1API.Properties.Tokens
{
	public sealed class AntiGravity : PropertyToken
	{
		public AntiGravity()
			: base("antigravity", "AntiGravity")
		{
		}
	}
	public sealed class Athletic : PropertyToken
	{
		public Athletic()
			: base("athletic", "Athletic")
		{
		}
	}
	public sealed class Balding : PropertyToken
	{
		public Balding()
			: base("balding", "Balding")
		{
		}
	}
	public sealed class BrightEyed : PropertyToken
	{
		public BrightEyed()
			: base("brighteyed", "BrightEyed")
		{
		}
	}
	public sealed class Calming : PropertyToken
	{
		public Calming()
			: base("calming", "Calming")
		{
		}
	}
	public sealed class CalorieDense : PropertyToken
	{
		public CalorieDense()
			: base("caloriedense", "CalorieDense")
		{
		}
	}
	public sealed class Cyclopean : PropertyToken
	{
		public Cyclopean()
			: base("cyclopean", "Cyclopean")
		{
		}
	}
	public sealed class Disorienting : PropertyToken
	{
		public Disorienting()
			: base("disorienting", "Disorienting")
		{
		}
	}
	public sealed class Electrifying : PropertyToken
	{
		public Electrifying()
			: base("electrifying", "Electrifying")
		{
		}
	}
	public sealed class Energizing : PropertyToken
	{
		public Energizing()
			: base("energizing", "Energizing")
		{
		}
	}
	public sealed class Euphoric : PropertyToken
	{
		public Euphoric()
			: base("euphoric", "Euphoric")
		{
		}
	}
	public sealed class Explosive : PropertyToken
	{
		public Explosive()
			: base("explosive", "Explosive")
		{
		}
	}
	public sealed class Focused : PropertyToken
	{
		public Focused()
			: base("focused", "Focused")
		{
		}
	}
	public sealed class Foggy : PropertyToken
	{
		public Foggy()
			: base("foggy", "Foggy")
		{
		}
	}
	public sealed class Gingeritis : PropertyToken
	{
		public Gingeritis()
			: base("gingeritis", "Gingeritis")
		{
		}
	}
	public sealed class Glowie : PropertyToken
	{
		public Glowie()
			: base("glowie", "Glowie")
		{
		}
	}
	public sealed class Jennerising : PropertyToken
	{
		public Jennerising()
			: base("jennerising", "Jennerising")
		{
		}
	}
	public sealed class Laxative : PropertyToken
	{
		public Laxative()
			: base("laxative", "Laxative")
		{
		}
	}
	public sealed class Lethal : PropertyToken
	{
		public Lethal()
			: base("lethal", "Lethal")
		{
		}
	}
	public sealed class LongFaced : PropertyToken
	{
		public LongFaced()
			: base("longfaced", "LongFaced")
		{
		}
	}
	public sealed class Munchies : PropertyToken
	{
		public Munchies()
			: base("munchies", "Munchies")
		{
		}
	}
	public sealed class Paranoia : PropertyToken
	{
		public Paranoia()
			: base("paranoia", "Paranoia")
		{
		}
	}
	public abstract class PropertyToken : PropertyBase
	{
		private readonly string _id;

		private readonly string _unityName;

		private readonly string _displayName;

		private readonly string _description;

		private readonly int _tier;

		private readonly float _addictiveness;

		public override string ID => _id;

		public override string Name => _displayName;

		public override string name => _unityName;

		public override string Description => _description;

		public override int Tier => _tier;

		public override float Addictiveness => _addictiveness;

		protected PropertyToken(string id, string unityName = null, string displayName = null, string description = null, int tier = 1, float addictiveness = 0f)
		{
			_id = id ?? string.Empty;
			_unityName = unityName ?? id ?? string.Empty;
			_displayName = displayName ?? id ?? string.Empty;
			_description = description ?? string.Empty;
			_tier = tier;
			_addictiveness = addictiveness;
		}
	}
	public sealed class Refreshing : PropertyToken
	{
		public Refreshing()
			: base("refreshing", "Refreshing")
		{
		}
	}
	public sealed class Schizophrenic : PropertyToken
	{
		public Schizophrenic()
			: base("schizophrenic", "Schizophrenic")
		{
		}
	}
	public sealed class Sedating : PropertyToken
	{
		public Sedating()
			: base("sedating", "Sedating")
		{
		}
	}
	public sealed class Seizure : PropertyToken
	{
		public Seizure()
			: base("seizure", "Seizure")
		{
		}
	}
	public sealed class Shrinking : PropertyToken
	{
		public Shrinking()
			: base("shrinking", "Shrinking")
		{
		}
	}
	public sealed class Slippery : PropertyToken
	{
		public Slippery()
			: base("slippery", "Slippery")
		{
		}
	}
	public sealed class Smelly : PropertyToken
	{
		public Smelly()
			: base("smelly", "Smelly")
		{
		}
	}
	public sealed class Sneaky : PropertyToken
	{
		public Sneaky()
			: base("sneaky", "Sneaky")
		{
		}
	}
	public sealed class Spicy : PropertyToken
	{
		public Spicy()
			: base("spicy", "Spicy")
		{
		}
	}
	public sealed class ThoughtProvoking : PropertyToken
	{
		public ThoughtProvoking()
			: base("thoughtprovoking", "ThoughtProvoking")
		{
		}
	}
	public sealed class Toxic : PropertyToken
	{
		public Toxic()
			: base("toxic", "Toxic")
		{
		}
	}
	public sealed class TropicThunder : PropertyToken
	{
		public TropicThunder()
			: base("tropicthunder", "TropicThunder")
		{
		}
	}
	public sealed class Zombifying : PropertyToken
	{
		public Zombifying()
			: base("zombifying", "Zombifying")
		{
		}
	}
}
namespace S1API.Properties.Internal
{
	internal static class PropertyResolver
	{
		private static readonly string[] SearchPaths = new string[5] { "Properties/Tier1", "Properties/Tier2", "Properties/Tier3", "Properties/Tier4", "Properties/Tier5" };

		internal static List<Property> ResolveToGameProperties(IEnumerable<PropertyBase> items)
		{
			List<Property> list = new List<Property>();
			if (items == null)
			{
				return list;
			}
			foreach (PropertyBase item in items)
			{
				if (item == null)
				{
					continue;
				}
				if (item is ProductPropertyWrapper productPropertyWrapper)
				{
					Property innerProperty = productPropertyWrapper.InnerProperty;
					if ((Object)(object)innerProperty != (Object)null && !list.Contains(innerProperty))
					{
						list.Add(innerProperty);
					}
				}
				else
				{
					Property val = FindByIdOrName(item.ID, item.name);
					if ((Object)(object)val != (Object)null && !list.Contains(val))
					{
						list.Add(val);
					}
				}
			}
			return list;
		}

		private static Property FindByIdOrName(string id, string unityName)
		{
			string idNorm = (id ?? string.Empty).Trim();
			string nameNorm = (unityName ?? string.Empty).Trim();
			string[] searchPaths = SearchPaths;
			foreach (string text in searchPaths)
			{
				Il2CppArrayBase<Property> val = Resources.LoadAll<Property>(text);
				if (val == null || val.Length == 0)
				{
					continue;
				}
				if (!string.IsNullOrEmpty(idNorm))
				{
					Property val2 = ((IEnumerable<Property>)val).FirstOrDefault((Func<Property, bool>)((Property p) => (Object)(object)p != (Object)null && string.Equals(p.ID, idNorm, StringComparison.OrdinalIgnoreCase)));
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
				if (!string.IsNullOrEmpty(nameNorm))
				{
					Property val3 = ((IEnumerable<Property>)val).FirstOrDefault((Func<Property, bool>)((Property p) => (Object)(object)p != (Object)null && string.Equals(((Object)p).name, nameNorm, StringComparison.OrdinalIgnoreCase)));
					if ((Object)(object)val3 != (Object)null)
					{
						return val3;
					}
				}
			}
			return null;
		}
	}
}
namespace S1API.Properties.Interfaces
{
	public abstract class PropertyBase
	{
		public abstract string ID { get; }

		public abstract string Name { get; }

		public abstract string name { get; }

		public abstract string Description { get; }

		public abstract int Tier { get; }

		public abstract float Addictiveness { get; }
	}
}
namespace S1API.Products
{
	public class CocaineDefinition : ProductDefinition
	{
		internal CocaineDefinition S1CocaineDefinition => CrossType.As<CocaineDefinition>((object)base.S1ItemDefinition);

		internal CocaineDefinition(CocaineDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>((object)((ItemDefinition)S1CocaineDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			CocaineDefinition s1CocaineDefinition = S1CocaineDefinition;
			List<Property> val = ((s1CocaineDefinition != null) ? ((PropertyItemDefinition)s1CocaineDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(val[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			CocaineDefinition s1CocaineDefinition = S1CocaineDefinition;
			List<Property> val = ((s1CocaineDefinition != null) ? ((PropertyItemDefinition)s1CocaineDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(val[i]);
				}
			}
			return list;
		}
	}
	public enum DrugType
	{
		Marijuana,
		Methamphetamine,
		Cocaine,
		MDMA,
		Shrooms,
		Heroin
	}
	public class MethDefinition : ProductDefinition
	{
		internal MethDefinition S1MethDefinition => CrossType.As<MethDefinition>((object)base.S1ItemDefinition);

		internal MethDefinition(MethDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>((object)((ItemDefinition)S1MethDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			MethDefinition s1MethDefinition = S1MethDefinition;
			List<Property> val = ((s1MethDefinition != null) ? ((PropertyItemDefinition)s1MethDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(val[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			MethDefinition s1MethDefinition = S1MethDefinition;
			List<Property> val = ((s1MethDefinition != null) ? ((PropertyItemDefinition)s1MethDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(val[i]);
				}
			}
			return list;
		}
	}
	public class PackagingDefinition : ItemDefinition
	{
		internal PackagingDefinition S1PackagingDefinition => CrossType.As<PackagingDefinition>((object)base.S1ItemDefinition);

		public int Quantity => S1PackagingDefinition.Quantity;

		internal PackagingDefinition(ItemDefinition s1ItemDefinition)
			: base(s1ItemDefinition)
		{
		}
	}
	public class ProductDefinition : ItemDefinition
	{
		internal ProductDefinition S1ProductDefinition => CrossType.As<ProductDefinition>((object)base.S1ItemDefinition);

		public float Price => S1ProductDefinition.Price;

		public float BasePrice => S1ProductDefinition.BasePrice;

		public float MarketValue => S1ProductDefinition.MarketValue;

		public new Sprite Icon => ((ItemDefinition)S1ProductDefinition).Icon;

		public IReadOnlyList<PropertyBase> Properties
		{
			get
			{
				List<Property> properties = ((PropertyItemDefinition)S1ProductDefinition).Properties;
				List<PropertyBase> list = new List<PropertyBase>(properties.Count);
				for (int i = 0; i < properties.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(properties[i]));
				}
				return list.AsReadOnly();
			}
		}

		public IReadOnlyList<DrugTypeContainer> DrugTypes
		{
			get
			{
				List<DrugTypeContainer> drugTypes = S1ProductDefinition.DrugTypes;
				List<DrugTypeContainer> list = new List<DrugTypeContainer>(drugTypes?.Count ?? 0);
				if (drugTypes != null)
				{
					for (int i = 0; i < drugTypes.Count; i++)
					{
						list.Add(drugTypes[i]);
					}
				}
				return list.AsReadOnly();
			}
		}

		public EDrugType DrugType => S1ProductDefinition.DrugType;

		internal ProductDefinition(ItemDefinition productDefinition)
			: base(productDefinition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>((object)((ItemDefinition)S1ProductDefinition).GetDefaultInstance(quantity)));
		}
	}
	public static class ProductDefinitionWrapper
	{
		public static ProductDefinition Wrap(ProductDefinition def)
		{
			ItemDefinition s1ItemDefinition = def.S1ItemDefinition;
			if (CrossType.Is<WeedDefinition>((object)s1ItemDefinition, out WeedDefinition result))
			{
				return new WeedDefinition(result);
			}
			if (CrossType.Is<MethDefinition>((object)s1ItemDefinition, out MethDefinition result2))
			{
				return new MethDefinition(result2);
			}
			if (CrossType.Is<CocaineDefinition>((object)s1ItemDefinition, out CocaineDefinition result3))
			{
				return new CocaineDefinition(result3);
			}
			return def;
		}
	}
	public class ProductInstance : ItemInstance
	{
		internal ProductItemInstance S1ProductInstance => CrossType.As<ProductItemInstance>((object)S1ItemInstance);

		public bool IsPackaged => Object.op_Implicit((Object)(object)S1ProductInstance.AppliedPackaging);

		public PackagingDefinition AppliedPackaging => new PackagingDefinition((ItemDefinition)(object)S1ProductInstance.AppliedPackaging);

		public Quality Quality => ((QualityItemInstance)S1ProductInstance).Quality.ToAPI();

		public new ProductDefinition Definition => new ProductDefinition(((ItemInstance)S1ProductInstance).Definition);

		public IReadOnlyList<PropertyBase> Properties => Definition.Properties;

		internal ProductInstance(ProductItemInstance productInstance)
			: base((ItemInstance)(object)productInstance)
		{
		}
	}
	public static class ProductManager
	{
		public static ProductDefinition[] DiscoveredProducts => ((IEnumerable<ProductDefinition>)ProductManager.DiscoveredProducts.ToArray()).Select((ProductDefinition productDefinition) => ProductDefinitionWrapper.Wrap(new ProductDefinition((ItemDefinition)(object)productDefinition))).ToArray();
	}
	public enum Quality
	{
		Trash,
		Poor,
		Standard,
		Premium,
		Heavenly
	}
	internal static class QualityExtensions
	{
		internal static Quality ToAPI(this EQuality quality)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected I4, but got Unknown
			if (1 == 0)
			{
			}
			Quality result = (int)quality switch
			{
				0 => Quality.Trash, 
				1 => Quality.Poor, 
				2 => Quality.Standard, 
				3 => Quality.Premium, 
				4 => Quality.Heavenly, 
				_ => Quality.Trash, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		internal static EQuality ToInternal(this Quality quality)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: 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_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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EQuality result = (EQuality)(quality switch
			{
				Quality.Trash => 0, 
				Quality.Poor => 1, 
				Quality.Standard => 2, 
				Quality.Premium => 3, 
				Quality.Heavenly => 4, 
				_ => 0, 
			});
			if (1 == 0)
			{
			}
			return result;
		}
	}
	public class WeedDefinition : ProductDefinition
	{
		internal WeedDefinition S1WeedDefinition => CrossType.As<WeedDefinition>((object)base.S1ItemDefinition);

		internal WeedDefinition(WeedDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>((object)((ItemDefinition)S1WeedDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			WeedDefinition s1WeedDefinition = S1WeedDefinition;
			List<Property> val = ((s1WeedDefinition != null) ? ((PropertyItemDefinition)s1WeedDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(val[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			WeedDefinition s1WeedDefinition = S1WeedDefinition;
			List<Property> val = ((s1WeedDefinition != null) ? ((PropertyItemDefinition)s1WeedDefinition).Properties : null);
			if (val != null)
			{
				for (int i = 0; i < val.Count; i++)
				{
					list.Add(val[i]);
				}
			}
			return list;
		}
	}
}
namespace S1API.PhoneCalls
{
	public class CallerDefinition
	{
		internal readonly CallerID S1CallerIDEntry;

		public string Name
		{
			get
			{
				return S1CallerIDEntry.Name;
			}
			set
			{
				S1CallerIDEntry.Name = value;
			}
		}

		public Sprite? ProfilePicture
		{
			get
			{
				return S1CallerIDEntry.ProfilePicture;
			}
			set
			{
				S1CallerIDEntry.ProfilePicture = value;
			}
		}

		internal CallerDefinition(CallerID s1CallerID)
		{
			S1CallerIDEntry = s1CallerID;
		}
	}
	public static class CallManager
	{
		private static readonly Queue<PhoneCallData> PendingCalls = new Queue<PhoneCallData>();

		internal static bool IsDispatchingToGameQueue;

		public static int PendingCount => PendingCalls.Count;

		public static void QueueCall(PhoneCallDefinition phoneCallDefinition)
		{
			if (phoneCallDefinition == null)
			{
				throw new ArgumentNullException("phoneCallDefinition");
			}
			PendingCalls.Enqueue(phoneCallDefinition.S1PhoneCallData);
			TryProcessQueue();
		}

		internal static void QueueCall(PhoneCallData phoneCallData)
		{
			if ((Object)(object)phoneCallData == (Object)null)
			{
				throw new ArgumentNullException("phoneCallData");
			}
			PendingCalls.Enqueue(phoneCallData);
			TryProcessQueue();
		}

		public static void ClearPendingQueue()
		{
			PendingCalls.Clear();
		}

		private static PhoneCallData GetQueuedCallData(CallManager manager)
		{
			object obj = global::S1API.Internal.Utils.ReflectionUtils.TryGetFieldOrProperty(manager, "QueuedCallData");
			return (PhoneCallData)((obj is PhoneCallData) ? obj : null);
		}

		internal static void TryProcessQueue()
		{
			CallManager instance = Singleton<CallManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			CallInterface instance2 = Singleton<CallInterface>.Instance;
			if ((Object)(object)instance2 == (Object)null || (Object)(object)instance2.ActiveCallData != (Object)null || (Object)(object)GetQueuedCallData(instance) != (Object)null || PendingCalls.Count == 0)
			{
				return;
			}
			PhoneCallData val = null;
			while (PendingCalls.Count > 0)
			{
				PhoneCallData val2 = PendingCalls.Dequeue();
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)val2.CallerID == (Object)null)
					{
						CallerID val3 = ScriptableObject.CreateInstance<CallerID>();
						val3.Name = "Unknown Caller";
						val3.ProfilePicture = null;
						val2.CallerID = val3;
					}
					if (val2.Stages == null)
					{
						val2.Stages = Il2CppReferenceArray<Stage>.op_Implicit(Array.Empty<Stage>());
					}
				}
				catch
				{
				}
				if (val2.Stages == null || ((Il2CppArrayBase<Stage>)(object)val2.Stages).Length == 0)
				{
					continue;
				}
				val = val2;
				break;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			IsDispatchingToGameQueue = true;
			try
			{
				instance.QueueCall(val);
			}
			finally
			{
				IsDispatchingToGameQueue = false;
			}
		}
	}
	public class CallStageEntry
	{
		internal readonly Stage S1Stage;

		protected readonly List<SystemTriggerEntry> StartTriggerEntries = new List<SystemTriggerEntry>();

		protected readonly List<SystemTriggerEntry> DoneTriggerEntries = new List<SystemTriggerEntry>();

		public string Text
		{
			get
			{
				return S1Stage.Text;
			}
			set
			{
				S1Stage.Text = value;
			}
		}

		internal CallStageEntry(Stage stage)
		{
			S1Stage = stage;
		}

		public SystemTriggerEntry AddSystemTrigger(SystemTriggerType triggerType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SystemTrigger val = new SystemTrigger();
			SystemTriggerEntry systemTriggerEntry = new SystemTriggerEntry(val);
			switch (triggerType)
			{
			case SystemTriggerType.StartTrigger:
				S1Stage.OnStartTriggers = S1Stage.OnStartTriggers.AddItemToArray<SystemTrigger>((SystemTrigger[]?)(object)new SystemTrigger[1] { val });
				StartTriggerEntries.Add(systemTriggerEntry);
				break;
			case SystemTriggerType.DoneTrigger:
				S1Stage.OnDoneTriggers = S1Stage.OnDoneTriggers.AddItemToArray<SystemTrigger>((SystemTrigger[]?)(object)new SystemTrigger[1] { val });
				DoneTriggerEntries.Add(systemTriggerEntry);
				break;
			}
			return systemTriggerEntry;
		}
	}
	public abstract class PhoneCallDefinition
	{
		public CallerDefinition? Caller;

		public readonly PhoneCallData S1PhoneCallData;

		protected readonly List<CallStageEntry> StageEntries = new List<CallStageEntry>();

		protected PhoneCallDefinition(string name, Sprite? profilePicture = null)
		{
			S1PhoneCallData = ScriptableObject.CreateInstance<PhoneCallData>();
			PhoneCallData s1PhoneCallData = S1PhoneCallData;
			if (s1PhoneCallData.Stages == null)
			{
				Il2CppReferenceArray<Stage> val2 = (s1PhoneCallData.Stages = Il2CppReferenceArray<Stage>.op_Implicit(Array.Empty<Stage>()));
			}
			AddCallerID(name, profilePicture);
		}

		protected PhoneCallDefinition(NPC? npcCallerID)
		{
			S1PhoneCallData = ScriptableObject.CreateInstance<PhoneCallData>();
			PhoneCallData s1PhoneCallData = S1PhoneCallData;
			if (s1PhoneCallData.Stages == null)
			{
				Il2CppReferenceArray<Stage> val2 = (s1PhoneCallData.Stages = Il2CppReferenceArray<Stage>.op_Implicit(Array.Empty<Stage>()));
			}
			AddCallerID(npcCallerID);
		}

		protected CallerDefinition AddCallerID(string name, Sprite? profilePicture = null)
		{
			CallerID val = ScriptableObject.CreateInstance<CallerID>();
			val.Name = name;
			val.ProfilePicture = profilePicture;
			S1PhoneCallData.CallerID = val;
			Caller = new CallerDefinition(val)
			{
				Name = name,
				ProfilePicture = profilePicture
			};
			return Caller;
		}

		protected CallerDefinition AddCallerID(NPC? npc)
		{
			CallerID val = ScriptableObject.CreateInstance<CallerID>();
			val.Name = npc?.FullName ?? "Unknown Caller";
			val.ProfilePicture = npc?.Icon;
			S1PhoneCallData.CallerID = val;
			Caller = new CallerDefinition(val)
			{
				Name = (npc?.FullName ?? "Unknown Caller"),
				ProfilePicture = npc?.Icon
			};
			return Caller;
		}

		protected CallStageEntry AddStage(string text)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due t

Mods/S1API.Mono.MelonLoader.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using FishNet;
using FishNet.Connection;
using FishNet.Managing;
using FishNet.Managing.Client;
using FishNet.Managing.Object;
using FishNet.Managing.Scened;
using FishNet.Managing.Server;
using FishNet.Managing.Transporting;
using FishNet.Object;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using S1API;
using S1API.Avatar;
using S1API.Conditions;
using S1API.Console;
using S1API.Economy;
using S1API.Entities;
using S1API.Entities.Appearances.AccessoryFields;
using S1API.Entities.Appearances.Base;
using S1API.Entities.Appearances.BodyLayerFields;
using S1API.Entities.Appearances.CustomizationFields;
using S1API.Entities.Appearances.FaceLayerFields;
using S1API.Entities.Customer;
using S1API.Entities.Dealer;
using S1API.Entities.Dialogue;
using S1API.Entities.Interfaces;
using S1API.Entities.Relation;
using S1API.Entities.Schedule;
using S1API.GameTime;
using S1API.Internal;
using S1API.Internal.Abstraction;
using S1API.Internal.Entities;
using S1API.Internal.Lifecycle;
using S1API.Internal.Map;
using S1API.Internal.Patches;
using S1API.Internal.Utils;
using S1API.Items;
using S1API.Logging;
using S1API.Map;
using S1API.Map.Buildings;
using S1API.Map.DeliveryLocations;
using S1API.Messaging;
using S1API.Money;
using S1API.PhoneApp;
using S1API.PhoneCalls;
using S1API.PhoneCalls.Constants;
using S1API.Products;
using S1API.Properties;
using S1API.Properties.Interfaces;
using S1API.Properties.Internal;
using S1API.Properties.Tokens;
using S1API.Quests;
using S1API.Quests.Constants;
using S1API.Saveables;
using S1API.Storages;
using S1API.Utils;
using S1API.Vehicles;
using ScheduleOne;
using ScheduleOne.AvatarFramework;
using ScheduleOne.AvatarFramework.Animation;
using ScheduleOne.Calling;
using ScheduleOne.Combat;
using ScheduleOne.DevUtilities;
using ScheduleOne.Dialogue;
using ScheduleOne.Economy;
using ScheduleOne.GameTime;
using ScheduleOne.Growing;
using ScheduleOne.Interaction;
using ScheduleOne.ItemFramework;
using ScheduleOne.Levelling;
using ScheduleOne.Map;
using ScheduleOne.Messaging;
using ScheduleOne.Money;
using ScheduleOne.NPCs;
using ScheduleOne.NPCs.Actions;
using ScheduleOne.NPCs.Behaviour;
using ScheduleOne.NPCs.Relation;
using ScheduleOne.NPCs.Responses;
using ScheduleOne.NPCs.Schedules;
using ScheduleOne.Noise;
using ScheduleOne.ObjectScripts;
using ScheduleOne.Persistence;
using ScheduleOne.Persistence.Datas;
using ScheduleOne.Persistence.Loaders;
using ScheduleOne.PlayerScripts;
using ScheduleOne.PlayerScripts.Health;
using ScheduleOne.Product;
using ScheduleOne.Product.Packaging;
using ScheduleOne.Properties;
using ScheduleOne.Property;
using ScheduleOne.Quests;
using ScheduleOne.ScriptableObjects;
using ScheduleOne.Storage;
using ScheduleOne.UI;
using ScheduleOne.UI.Phone;
using ScheduleOne.UI.Phone.ContactsApp;
using ScheduleOne.UI.Phone.Messages;
using ScheduleOne.UI.Phone.ProductManagerApp;
using ScheduleOne.UI.WorldspacePopup;
using ScheduleOne.Variables;
using ScheduleOne.Vehicles;
using ScheduleOne.Vehicles.Modification;
using ScheduleOne.Vision;
using ScheduleOne.VoiceOver;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::S1API.S1API), "S1API (Forked by Bars)", "2.4.8", "KaBooMa", null)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ifBars")]
[assembly: AssemblyConfiguration("MonoMelon")]
[assembly: AssemblyDescription("A Schedule One Mono / Il2Cpp Cross Compatibility Layer (Forked from the original S1API by Kabooma)")]
[assembly: AssemblyFileVersion("2.4.8.0")]
[assembly: AssemblyInformationalVersion("2.4.8+9034e40bb7aeb09acaaeeb27ad4b2066ed009a5b")]
[assembly: AssemblyProduct("S1API")]
[assembly: AssemblyTitle("S1API")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ifBars/S1API")]
[assembly: AssemblyVersion("2.4.8.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ClickHandler
{
	private readonly UnityAction _callback;

	public ClickHandler(UnityAction callback)
	{
		_callback = callback;
	}

	public void OnClick()
	{
		_callback.Invoke();
	}
}
namespace S1API
{
	public class S1API : MelonMod
	{
		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			SceneStateCleaner.ResetForSceneChange(sceneName, afterUnload: true);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			NPCNetworkBootstrap.EnsurePrefabsWarmup();
			SceneStateCleaner.ResetForSceneChange(sceneName, afterUnload: false);
		}
	}
}
namespace S1API.Vehicles
{
	public class LandVehicle
	{
		internal LandVehicle S1LandVehicle = null;

		internal bool _isDeferredByName = false;

		private static readonly Log _logger = new Log("S1API.LandVehicle");

		private static readonly FieldInfo? VehiclePriceField = typeof(LandVehicle).GetField("vehiclePrice", BindingFlags.NonPublic);

		private NetworkConnection? _conn;

		private string _guid = string.Empty;

		public float VehiclePrice
		{
			get
			{
				return S1LandVehicle.VehiclePrice;
			}
			set
			{
				VehiclePriceField?.SetValue(S1LandVehicle, value);
			}
		}

		public float TopSpeed
		{
			get
			{
				return S1LandVehicle.TopSpeed;
			}
			set
			{
				S1LandVehicle.TopSpeed = value;
			}
		}

		public bool IsPlayerOwned
		{
			get
			{
				return S1LandVehicle.IsPlayerOwned;
			}
			set
			{
				SetIsPlayerOwned(value);
			}
		}

		public VehicleColor Color
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected I4, but got Unknown
				return (VehicleColor)S1LandVehicle.OwnedColor;
			}
			set
			{
				SetColor(value);
			}
		}

		public string GUID => _guid;

		public LandVehicle(string vehicleCode)
		{
			LandVehicle vehiclePrefab = NetworkSingleton<VehicleManager>.Instance.GetVehiclePrefab(vehicleCode);
			if ((Object)(object)vehiclePrefab == (Object)null)
			{
				_logger.Error("SpawnVehicle: '" + vehicleCode + "' is not a valid vehicle code!");
				return;
			}
			LandVehicle component = Object.Instantiate<GameObject>(((Component)vehiclePrefab).gameObject).GetComponent<LandVehicle>();
			component.SetGUID(GUIDManager.GenerateUniqueGUID());
			NetworkSingleton<VehicleManager>.Instance.AllVehicles.Add(component);
			S1LandVehicle = component;
			SetConnection();
			UpdateGuidFromGame();
		}

		public void Spawn(Vector3 position, Quaternion rotation)
		{
			//IL_0046: 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_0072: 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)
			if (!InstanceFinder.IsServer)
			{
				_logger.Warning("Spawn can only be called on the server!");
				return;
			}
			if ((Object)(object)S1LandVehicle == (Object)null)
			{
				throw new Exception("Unable to spawn vehicle, S1LandVehicle is null!");
			}
			((Component)S1LandVehicle).transform.position = position;
			((Component)S1LandVehicle).transform.rotation = rotation;
			((NetworkBehaviour)NetworkSingleton<VehicleManager>.Instance).Spawn(((Component)S1LandVehicle).gameObject, (NetworkConnection)null, default(Scene));
		}

		internal LandVehicle(LandVehicle landVehicle)
		{
			S1LandVehicle = landVehicle;
			SetConnection();
			UpdateGuidFromGame();
			_isDeferredByName = false;
		}

		internal LandVehicle(string vehicleName, bool isDeferred)
		{
			_isDeferredByName = isDeferred;
		}

		private void SetConnection()
		{
			NetworkManager networkManager = InstanceFinder.NetworkManager;
			if (networkManager.IsClientOnly)
			{
				NetworkConnection connection = InstanceFinder.ClientManager.Connection;
				if (connection != (NetworkConnection)null && connection.IsValid)
				{
					_conn = connection;
				}
			}
			else if (networkManager.IsServerOnly || (networkManager.IsServer && !networkManager.IsClient))
			{
				NetworkConnection owner = ((NetworkBehaviour)S1LandVehicle).Owner;
				if (owner != (NetworkConnection)null && owner.IsValid)
				{
					_conn = owner;
				}
			}
		}

		private void SetIsPlayerOwned(bool isPlayerOwned)
		{
			S1LandVehicle.SetIsPlayerOwned(_conn, isPlayerOwned);
			if (isPlayerOwned)
			{
				NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles.Add(S1LandVehicle);
			}
			else
			{
				NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles.Remove(S1LandVehicle);
			}
		}

		private void SetColor(VehicleColor color)
		{
			MethodInfo method = typeof(LandVehicle).GetMethod("SetOwnedColor", BindingFlags.Instance | BindingFlags.NonPublic);
			if (method == null)
			{
				_logger.Error("SetOwnedColor method not found!");
				return;
			}
			method.Invoke(S1LandVehicle, new object[2]
			{
				_conn,
				(object)(EVehicleColor)color
			});
		}

		private void UpdateGuidFromGame()
		{
			try
			{
				PropertyInfo property = typeof(LandVehicle).GetProperty("GUID", BindingFlags.Instance | BindingFlags.Public);
				if (!(property == null))
				{
					_guid = ((Guid)(property.GetValue(S1LandVehicle) ?? ((object)Guid.Empty))).ToString();
				}
			}
			catch
			{
			}
		}
	}
	public enum ParkingAlignment
	{
		FrontToKerb,
		RearToKerb
	}
	public enum VehicleColor
	{
		Black,
		DarkGrey,
		LightGrey,
		White,
		Yellow,
		Orange,
		Red,
		DullRed,
		Pink,
		Purple,
		Navy,
		DarkBlue,
		LightBlue,
		Cyan,
		LightGreen,
		DarkGreen,
		Custom
	}
	public static class VehicleRegistry
	{
		private static readonly Dictionary<object, LandVehicle> _cache = new Dictionary<object, LandVehicle>();

		public static LandVehicle[] GetAll()
		{
			try
			{
				List<LandVehicle> allVehicles = NetworkSingleton<VehicleManager>.Instance.AllVehicles;
				if (allVehicles == null)
				{
					return Array.Empty<LandVehicle>();
				}
				List<LandVehicle> list = new List<LandVehicle>();
				foreach (LandVehicle item in allVehicles)
				{
					if ((Object)(object)item != (Object)null)
					{
						LandVehicle landVehicle = Wrap(item);
						if (landVehicle != null)
						{
							list.Add(landVehicle);
						}
					}
				}
				return list.ToArray();
			}
			catch
			{
				return Array.Empty<LandVehicle>();
			}
		}

		public static LandVehicle GetByGUID(string guid)
		{
			if (string.IsNullOrEmpty(guid))
			{
				return null;
			}
			try
			{
				Guid guid2 = new Guid(guid);
				LandVehicle @object = GUIDManager.GetObject<LandVehicle>(guid2);
				if ((Object)(object)@object == (Object)null)
				{
					return null;
				}
				return Wrap(@object);
			}
			catch
			{
				return null;
			}
		}

		public static LandVehicle GetByName(string gameObjectName)
		{
			if (string.IsNullOrEmpty(gameObjectName))
			{
				return null;
			}
			try
			{
				GameObject val = GameObject.Find(gameObjectName);
				if ((Object)(object)val != (Object)null)
				{
					LandVehicle component = val.GetComponent<LandVehicle>();
					if ((Object)(object)component != (Object)null)
					{
						return Wrap(component);
					}
				}
				List<LandVehicle> allVehicles = NetworkSingleton<VehicleManager>.Instance.AllVehicles;
				if (allVehicles != null)
				{
					for (int i = 0; i < allVehicles.Count; i++)
					{
						LandVehicle val2 = allVehicles[i];
						if ((Object)(object)val2 != (Object)null && ((Object)((Component)val2).gameObject).name == gameObjectName)
						{
							return Wrap(val2);
						}
					}
				}
				if (DeferredMapResolver.IsMenuScene())
				{
					LandVehicle deferredVehicle = new LandVehicle(gameObjectName, isDeferred: true);
					DeferredMapResolver.RegisterDeferredLookup(new DeferredLookup(gameObjectName, delegate(object resolved)
					{
						if (resolved is LandVehicle landVehicle && landVehicle != null && (Object)(object)landVehicle.S1LandVehicle != (Object)null)
						{
							deferredVehicle.S1LandVehicle = landVehicle.S1LandVehicle;
							deferredVehicle._isDeferredByName = false;
						}
					}));
					return deferredVehicle;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static LandVehicle CreateVehicle(string vehicleCode)
		{
			if (!string.IsNullOrEmpty(vehicleCode))
			{
				try
				{
					return new LandVehicle(vehicleCode);
				}
				catch
				{
					return null;
				}
			}
			return null;
		}

		private static LandVehicle Wrap(LandVehicle veh)
		{
			if ((Object)(object)veh == (Object)null)
			{
				return null;
			}
			if (_cache.TryGetValue(veh, out LandVehicle value))
			{
				return value;
			}
			LandVehicle landVehicle = new LandVehicle(veh);
			_cache[veh] = landVehicle;
			return landVehicle;
		}
	}
}
namespace S1API.Utils
{
	public static class ReflectionUtils
	{
		public static MethodInfo? GetMethod(Type? type, string methodName, BindingFlags bindingFlags)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.GetMethod(type, methodName, bindingFlags);
		}

		public static bool IsValueTuple(this object obj)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.IsValueTuple(obj);
		}

		public static object[]? GetValueTupleItems(this object obj)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.GetValueTupleItems(obj);
		}

		public static bool TrySetFieldOrProperty(object target, string memberName, object value)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.TrySetFieldOrProperty(target, memberName, value);
		}

		public static object? TryGetFieldOrProperty(object target, string memberName)
		{
			return global::S1API.Internal.Utils.ReflectionUtils.TryGetFieldOrProperty(target, memberName);
		}
	}
}
namespace S1API.UI
{
	public static class UIFactory
	{
		private static Sprite roundedSprite;

		public static GameObject Panel(string name, Transform parent, Color bgColor, Vector2? anchorMin = null, Vector2? anchorMax = null, bool fullAnchor = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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 = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			if (fullAnchor)
			{
				val2.anchorMin = Vector2.zero;
				val2.anchorMax = Vector2.one;
				val2.offsetMin = Vector2.zero;
				val2.offsetMax = Vector2.zero;
			}
			else
			{
				val2.anchorMin = (Vector2)(((??)anchorMin) ?? new Vector2(0.5f, 0.5f));
				val2.anchorMax = (Vector2)(((??)anchorMax) ?? new Vector2(0.5f, 0.5f));
			}
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			return val;
		}

		public static Text Text(string name, string content, Transform parent, int fontSize = 14, TextAnchor anchor = 0, FontStyle style = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0035: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Text val3 = val.AddComponent<Text>();
			val3.text = content;
			val3.fontSize = fontSize;
			val3.alignment = anchor;
			val3.fontStyle = style;
			val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			((Graphic)val3).color = Color.white;
			val3.horizontalOverflow = (HorizontalWrapMode)0;
			val3.verticalOverflow = (VerticalWrapMode)1;
			return val3;
		}

		public static RectTransform ScrollableVerticalList(string name, Transform parent, out ScrollRect scrollRect)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0084: 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_009c: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			scrollRect = val.AddComponent<ScrollRect>();
			scrollRect.horizontal = false;
			GameObject val3 = new GameObject("Viewport");
			val3.transform.SetParent(val.transform, false);
			RectTransform val4 = val3.AddComponent<RectTransform>();
			val4.anchorMin = Vector2.zero;
			val4.anchorMax = Vector2.one;
			val4.offsetMin = Vector2.zero;
			val4.offsetMax = Vector2.zero;
			((Graphic)val3.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.05f);
			val3.AddComponent<Mask>().showMaskGraphic = false;
			scrollRect.viewport = val4;
			GameObject val5 = new GameObject("Content");
			val5.transform.SetParent(val3.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = new Vector2(0f, 1f);
			val6.anchorMax = new Vector2(1f, 1f);
			val6.pivot = new Vector2(0.5f, 1f);
			VerticalLayoutGroup val7 = val5.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val7).spacing = 10f;
			((LayoutGroup)val7).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val7).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val7).childForceExpandHeight = false;
			val5.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			scrollRect.content = val6;
			return val6;
		}

		public static void FitContentHeight(RectTransform content)
		{
			ContentSizeFitter val = ((Component)content).gameObject.GetComponent<ContentSizeFitter>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)content).gameObject.AddComponent<ContentSizeFitter>();
			}
			val.verticalFit = (FitMode)2;
		}

		public static (GameObject, Button, Text) RoundedButtonWithLabel(string name, string label, Transform parent, Color bgColor, float width, float height, int fontSize, Color textColor)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name + "_RoundedMask");
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(width, height);
			LayoutElement val3 = val.AddComponent<LayoutElement>();
			val3.preferredWidth = width;
			val3.preferredHeight = height;
			Image val4 = val.AddComponent<Image>();
			val4.sprite = GetRoundedSprite();
			val4.type = (Type)1;
			((Graphic)val4).color = Color.white;
			Mask val5 = val.AddComponent<Mask>();
			val5.showMaskGraphic = true;
			GameObject val6 = new GameObject(name);
			val6.transform.SetParent(val.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			Image val8 = val6.AddComponent<Image>();
			((Graphic)val8).color = bgColor;
			val8.sprite = GetRoundedSprite();
			val8.type = (Type)1;
			Button val9 = val6.AddComponent<Button>();
			((Selectable)val9).targetGraphic = (Graphic)(object)val8;
			GameObject val10 = new GameObject("Label");
			val10.transform.SetParent(val6.transform, false);
			RectTransform val11 = val10.AddComponent<RectTransform>();
			val11.anchorMin = Vector2.zero;
			val11.anchorMax = Vector2.one;
			val11.offsetMin = Vector2.zero;
			val11.offsetMax = Vector2.zero;
			Text val12 = val10.AddComponent<Text>();
			val12.text = label;
			val12.alignment = (TextAnchor)4;
			val12.fontSize = fontSize;
			val12.fontStyle = (FontStyle)1;
			((Graphic)val12).color = textColor;
			val12.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return (val, val9, val12);
		}

		private static Sprite GetRoundedSprite()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)roundedSprite != (Object)null)
			{
				return roundedSprite;
			}
			int num = 32;
			Texture2D val = new Texture2D(num, num, (TextureFormat)5, false);
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			float num2 = 6f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					bool flag = ((float)j < num2 && (float)i < num2 && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) > num2) || ((float)j > (float)num - num2 - 1f && (float)i < num2 && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, num2)) > num2) || ((float)j < num2 && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, (float)num - num2 - 1f)) > num2) || ((float)j > (float)num - num2 - 1f && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, (float)num - num2 - 1f)) > num2);
					val.SetPixel(j, i, Color32.op_Implicit(flag ? val2 : val3));
				}
			}
			val.Apply();
			Vector4 val4 = default(Vector4);
			((Vector4)(ref val4))..ctor(8f, 8f, 8f, 8f);
			roundedSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val4);
			return roundedSprite;
		}

		public static GameObject ButtonRow(string name, Transform parent, float spacing = 12f, TextAnchor alignment = 4)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val3).spacing = spacing;
			((LayoutGroup)val3).childAlignment = alignment;
			((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false;
			return val;
		}

		public static (GameObject, Button, Text) ButtonWithLabel(string name, string label, Transform parent, Color bgColor, float Width, float Height)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(Height, Width);
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			val3.sprite = Resources.GetBuiltinResource<Sprite>("UI/Skin/UISprite.psd");
			val3.type = (Type)1;
			Button val4 = val.AddComponent<Button>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			GameObject val5 = new GameObject("Label");
			val5.transform.SetParent(val.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.offsetMin = Vector2.zero;
			val6.offsetMax = Vector2.zero;
			Text val7 = val5.AddComponent<Text>();
			val7.text = label;
			val7.alignment = (TextAnchor)4;
			val7.fontSize = 16;
			val7.fontStyle = (FontStyle)1;
			((Graphic)val7).color = Color.white;
			val7.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return (val, val4, val7);
		}

		public static void SetIcon(Sprite sprite, Transform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0022: 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_003a: 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)
			GameObject val = new GameObject("Icon");
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			Image val3 = val.AddComponent<Image>();
			val3.sprite = sprite;
			val3.preserveAspect = true;
		}

		public static void CreateTextBlock(Transform parent, string title, string subtitle, bool isCompleted)
		{
			Text(((Object)parent).name + "Title", title, parent, 16, (TextAnchor)3, (FontStyle)1);
			Text(((Object)parent).name + "Subtitle", subtitle, parent, 14, (TextAnchor)0, (FontStyle)0);
			if (isCompleted)
			{
				Text("CompletedLabel", "<color=#888888><i>Already Delivered</i></color>", parent, 12, (TextAnchor)0, (FontStyle)0);
			}
		}

		public static void CreateRowButton(GameObject go, UnityAction clickHandler, bool enabled)
		{
			Button val = go.AddComponent<Button>();
			Image component = go.GetComponent<Image>();
			((Selectable)val).targetGraphic = (Graphic)(object)component;
			((Selectable)val).interactable = enabled;
			((UnityEvent)val.onClick).AddListener(clickHandler);
		}

		public static void ClearChildren(Transform parent)
		{
			for (int num = parent.childCount - 1; num >= 0; num--)
			{
				Transform child = parent.GetChild(num);
				Object.Destroy((Object)(object)((Component)child).gameObject);
			}
		}

		public static void VerticalLayoutOnGO(GameObject go, int spacing = 10, RectOffset? padding = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			VerticalLayoutGroup val = go.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val).spacing = spacing;
			((LayoutGroup)val).padding = (RectOffset)(((object)padding) ?? ((object)new RectOffset(10, 10, 10, 10)));
		}

		public static GameObject CreateQuestRow(string name, Transform parent, out GameObject iconPanel, out GameObject textPanel)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Row_" + name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(0f, 90f);
			val.AddComponent<LayoutElement>().minHeight = 50f;
			((Shadow)val.AddComponent<Outline>()).effectColor = new Color(0f, 0f, 0f, 0.2f);
			GameObject val3 = Panel("Separator", val.transform, new Color(1f, 1f, 1f, 0.05f));
			val3.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 1f);
			Image val4 = val.AddComponent<Image>();
			((Graphic)val4).color = new Color(0.12f, 0.12f, 0.12f);
			Button val5 = val.AddComponent<Button>();
			((Selectable)val5).targetGraphic = (Graphic)(object)val4;
			HorizontalLayoutGroup val6 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val6).spacing = 20f;
			((LayoutGroup)val6).padding = new RectOffset(75, 10, 10, 10);
			((LayoutGroup)val6).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false;
			LayoutElement val7 = val.AddComponent<LayoutElement>();
			val7.minHeight = 90f;
			val7.flexibleWidth = 1f;
			iconPanel = Panel("IconPanel", val.transform, new Color(0.12f, 0.12f, 0.12f));
			RectTransform component = iconPanel.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(80f, 80f);
			LayoutElement val8 = iconPanel.AddComponent<LayoutElement>();
			val8.preferredWidth = 80f;
			val8.preferredHeight = 80f;
			textPanel = Panel("TextPanel", val.transform, Color.clear);
			VerticalLayoutOnGO(textPanel, 2);
			LayoutElement val9 = textPanel.AddComponent<LayoutElement>();
			val9.minWidth = 200f;
			val9.flexibleWidth = 1f;
			return val;
		}

		public static GameObject TopBar(string name, Transform parent, string title, float topbarSize, int paddingLeft, int paddingRight, int paddingTop, int paddingBottom)
		{
			//IL_0012: 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_0031: 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_005c: Expected O, but got Unknown
			GameObject val = Panel(name, parent, new Color(0.15f, 0.15f, 0.15f), (Vector2?)new Vector2(0f, topbarSize), (Vector2?)new Vector2(1f, 1f), fullAnchor: false);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)val2).padding = new RectOffset(paddingLeft, paddingRight, paddingTop, paddingBottom);
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 20f;
			((LayoutGroup)val2).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true;
			Text val3 = Text("TopBarTitle", title, val.transform, 26, (TextAnchor)3, (FontStyle)1);
			LayoutElement val4 = ((Component)val3).gameObject.AddComponent<LayoutElement>();
			val4.minWidth = 300f;
			val4.flexibleWidth = 1f;
			return val;
		}

		public static void HorizontalLayoutOnGO(GameObject go, int spacing = 10, int padLeft = 0, int padRight = 0, int padTop = 0, int padBottom = 0, TextAnchor alignment = 4)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			HorizontalLayoutGroup val = go.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val).spacing = spacing;
			((LayoutGroup)val).childAlignment = alignment;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
			((LayoutGroup)val).padding = new RectOffset(padLeft, padRight, padTop, padBottom);
		}

		public static void SetLayoutGroupPadding(LayoutGroup layoutGroup, int left, int right, int top, int bottom)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			layoutGroup.padding = new RectOffset(left, right, top, bottom);
		}

		public static void BindAcceptButton(Button btn, Text label, string text, UnityAction callback)
		{
			label.text = text;
			((UnityEventBase)btn.onClick).RemoveAllListeners();
			((UnityEvent)btn.onClick).AddListener(callback);
		}
	}
}
namespace S1API.Storages
{
	public class StorageInstance
	{
		internal readonly StorageEntity S1Storage;

		public ItemSlotInstance[] Slots => (from itemSlot in S1Storage.ItemSlots.ToArray()
			select new ItemSlotInstance(itemSlot)).ToArray();

		public event Action OnOpened
		{
			add
			{
				EventHelper.AddListener(value, S1Storage.onOpened);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1Storage.onOpened);
			}
		}

		public event Action OnClosed
		{
			add
			{
				EventHelper.AddListener(value, S1Storage.onClosed);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1Storage.onClosed);
			}
		}

		internal StorageInstance(StorageEntity storage)
		{
			S1Storage = storage;
		}

		public bool CanItemFit(ItemInstance itemInstance, int quantity = 1)
		{
			return S1Storage.CanItemFit(itemInstance.S1ItemInstance, quantity);
		}

		public void AddItem(ItemInstance itemInstance)
		{
			S1Storage.InsertItem(itemInstance.S1ItemInstance, true);
		}
	}
}
namespace S1API.Saveables
{
	[Obsolete("Manual registration is no longer required. Classes that directly inherit from Saveable are automatically discovered. Remove calls to ModSaveableRegistry.Register() and simply inherit from Saveable.")]
	public static class ModSaveableRegistry
	{
		internal class Entry
		{
			public Saveable Saveable;

			public string? FolderName;
		}

		internal static readonly List<Entry> Registered = new List<Entry>();

		[Obsolete("Manual registration is no longer required. Classes that directly inherit from Saveable are automatically discovered.")]
		public static void Register(Saveable saveable, string? folderName = null)
		{
			if (saveable != null)
			{
				MelonLogger.Warning("ModSaveableRegistry.Register() is deprecated! The saveable '" + saveable.GetType().Name + "' will be automatically discovered. Mod users can safely ignore this warning - their saves will continue to work normally. Mod developers should remove ModSaveableRegistry.Register() calls and simply inherit from Saveable.");
				Registered.Add(new Entry
				{
					Saveable = saveable,
					FolderName = folderName
				});
			}
		}
	}
	internal static class SaveableAutoRegistry
	{
		[CompilerGenerated]
		private sealed class <GetOrCreateInstances>d__7 : IEnumerable<Saveable>, IEnumerable, IEnumerator<Saveable>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private Saveable <>2__current;

			private int <>l__initialThreadId;

			private List<Type>.Enumerator <>s__1;

			private Type <saveableType>5__2;

			private Saveable <instance>5__3;

			Saveable IEnumerator<Saveable>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetOrCreateInstances>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = default(List<Type>.Enumerator);
				<saveableType>5__2 = null;
				<instance>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					int num = <>1__state;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -3;
						goto IL_00eb;
					}
					<>1__state = -1;
					<>s__1 = _discoveredSaveableTypes.GetEnumerator();
					<>1__state = -3;
					goto IL_00fa;
					IL_00eb:
					<instance>5__3 = null;
					<saveableType>5__2 = null;
					goto IL_00fa;
					IL_00fa:
					if (<>s__1.MoveNext())
					{
						<saveableType>5__2 = <>s__1.Current;
						if (!_instances.TryGetValue(<saveableType>5__2, out <instance>5__3))
						{
							try
							{
								<instance>5__3 = (Saveable)Activator.CreateInstance(<saveableType>5__2, nonPublic: true);
								if (<instance>5__3 != null)
								{
									_instances[<saveableType>5__2] = <instance>5__3;
								}
							}
							catch
							{
							}
						}
						if (<instance>5__3 != null)
						{
							<>2__current = <instance>5__3;
							<>1__state = 1;
							return true;
						}
						goto IL_00eb;
					}
					<>m__Finally1();
					<>s__1 = default(List<Type>.Enumerator);
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__1).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<Saveable> IEnumerable<Saveable>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetOrCreateInstances>d__7(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<Saveable>)this).GetEnumerator();
			}
		}

		private static readonly List<Type> _discoveredSaveableTypes = new List<Type>();

		private static readonly Dictionary<Type, Saveable> _instances = new Dictionary<Type, Saveable>();

		private static bool _discoveryPerformed = false;

		private static readonly object _lock = new object();

		public static IEnumerable<Saveable> GetRegisteredSaveables()
		{
			lock (_lock)
			{
				if (!_discoveryPerformed)
				{
					DiscoverSaveableTypes();
					_discoveryPerformed = true;
				}
				return GetOrCreateInstances();
			}
		}

		private static void DiscoverSaveableTypes()
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					try
					{
						if (assembly == executingAssembly)
						{
							continue;
						}
						string? fullName = assembly.FullName;
						if (fullName != null && fullName.StartsWith("System"))
						{
							continue;
						}
						string? fullName2 = assembly.FullName;
						if (fullName2 != null && fullName2.StartsWith("Unity"))
						{
							continue;
						}
						string? fullName3 = assembly.FullName;
						if (fullName3 != null && fullName3.StartsWith("mscorlib"))
						{
							continue;
						}
						string? fullName4 = assembly.FullName;
						if (fullName4 != null && fullName4.StartsWith("netstandard"))
						{
							continue;
						}
						string? fullName5 = assembly.FullName;
						if (fullName5 != null && fullName5.StartsWith("Microsoft"))
						{
							continue;
						}
						string? fullName6 = assembly.FullName;
						if (fullName6 != null && fullName6.StartsWith("Il2Cpp"))
						{
							continue;
						}
						string? fullName7 = assembly.FullName;
						if (fullName7 != null && fullName7.StartsWith("MelonLoader"))
						{
							continue;
						}
						string? fullName8 = assembly.FullName;
						if ((fullName8 != null && fullName8.StartsWith("0Harmony")) || assembly.IsDynamic)
						{
							continue;
						}
						Type[] array;
						try
						{
							array = assembly.GetTypes();
						}
						catch (ReflectionTypeLoadException ex)
						{
							array = ex.Types.Where((Type t) => t != null).ToArray();
						}
						catch
						{
							goto end_IL_0020;
						}
						Type[] array2 = array;
						foreach (Type type in array2)
						{
							try
							{
								if (!(type == null) && !type.IsAbstract && !type.IsInterface && !type.IsGenericTypeDefinition && IsDirectSaveableInheritor(type))
								{
									_discoveredSaveableTypes.Add(type);
								}
							}
							catch
							{
							}
						}
						end_IL_0020:;
					}
					catch
					{
					}
				}
			}
			catch (Exception ex2)
			{
				try
				{
					MelonLogger.Warning("[S1API] Error during saveable type discovery: " + ex2.Message);
				}
				catch
				{
				}
			}
		}

		private static bool IsDirectSaveableInheritor(Type type)
		{
			if (!typeof(Saveable).IsAssignableFrom(type))
			{
				return false;
			}
			if (type.IsAbstract || type.IsInterface)
			{
				return false;
			}
			Type baseType = type.BaseType;
			return baseType == typeof(Saveable);
		}

		[IteratorStateMachine(typeof(<GetOrCreateInstances>d__7))]
		private static IEnumerable<Saveable> GetOrCreateInstances()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetOrCreateInstances>d__7(-2);
		}

		internal static void ClearCache()
		{
			lock (_lock)
			{
				_discoveredSaveableTypes.Clear();
				_instances.Clear();
				_discoveryPerformed = false;
			}
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	public class SaveableField : Attribute
	{
		internal string SaveName { get; }

		public SaveableField(string saveName)
		{
			SaveName = saveName;
		}
	}
}
namespace S1API.Quests
{
	public abstract class Quest : Saveable
	{
		protected readonly List<QuestEntry> QuestEntries = new List<QuestEntry>();

		[SaveableField("QuestData")]
		private readonly QuestData _questData;

		internal readonly Quest S1Quest;

		private readonly GameObject _gameObject;

		protected abstract string Title { get; }

		protected abstract string Description { get; }

		protected virtual bool AutoBegin => true;

		protected QuestState QuestState => (QuestState)S1Quest.State;

		internal string? SaveFolder => S1Quest.SaveFolderName;

		protected virtual Sprite? QuestIcon => null;

		public Quest()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got Unknown
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			_questData = new QuestData(GetType().Name);
			_gameObject = new GameObject("Quest");
			S1Quest = _gameObject.AddComponent<Quest>();
			S1Quest.StaticGUID = string.Empty;
			FieldInfo fieldInfo = AccessTools.Field(typeof(Quest), "title");
			fieldInfo.SetValue(S1Quest, Title);
			S1Quest.onActiveState = new UnityEvent();
			S1Quest.onComplete = new UnityEvent();
			S1Quest.onInitialComplete = new UnityEvent();
			S1Quest.onQuestBegin = new UnityEvent();
			S1Quest.onQuestEnd = new UnityEvent<EQuestState>();
			S1Quest.onTrackChange = new UnityEvent<bool>();
			S1Quest.TrackOnBegin = true;
			S1Quest.AutoCompleteOnAllEntriesComplete = true;
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(Quest), "autoInitialize");
			fieldInfo2.SetValue(S1Quest, false);
			GameObject val = new GameObject("IconPrefab", new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Image>()
			});
			val.transform.SetParent(_gameObject.transform);
			Image component = val.GetComponent<Image>();
			component.sprite = QuestIcon ?? ((App<ContactsApp>)(object)PlayerSingleton<ContactsApp>.Instance).AppIcon;
			S1Quest.IconPrefab = val.GetComponent<RectTransform>();
			GameObject val2 = new GameObject("PoIUIPrefab", new Type[4]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<EventTrigger>(),
				CrossType.Of<Button>()
			});
			val2.transform.SetParent(_gameObject.transform);
			GameObject val3 = new GameObject("MainLabel", new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Text>()
			});
			val3.transform.SetParent(val2.transform);
			GameObject val4 = new GameObject("IconContainer", new Type[3]
			{
				CrossType.Of<RectTransform>(),
				CrossType.Of<CanvasRenderer>(),
				CrossType.Of<Image>()
			});
			val4.transform.SetParent(val2.transform);
			Image component2 = val4.GetComponent<Image>();
			component2.sprite = QuestIcon ?? ((App<ContactsApp>)(object)PlayerSingleton<ContactsApp>.Instance).AppIcon;
			RectTransform component3 = ((Component)component2).GetComponent<RectTransform>();
			component3.sizeDelta = new Vector2(20f, 20f);
			GameObject val5 = new GameObject("POIPrefab");
			val5.SetActive(false);
			val5.transform.SetParent(_gameObject.transform);
			POI val6 = val5.AddComponent<POI>();
			val6.DefaultMainText = "Did it work?";
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(POI), "UIPrefab");
			fieldInfo3.SetValue(val6, val2);
			S1Quest.PoIPrefab = val5;
			S1Quest.onQuestEnd.AddListener((UnityAction<EQuestState>)OnQuestEnded);
		}

		internal override void CreateInternal()
		{
			base.CreateInternal();
			S1Quest.InitializeQuest(Title, Description, Array.Empty<QuestEntryData>(), S1Quest?.StaticGUID);
			if (AutoBegin)
			{
				Quest s1Quest = S1Quest;
				if (s1Quest != null)
				{
					s1Quest.Begin(true);
				}
			}
		}

		internal override void SaveInternal(string folderPath, ref List<string> extraSaveables)
		{
			string text = Path.Combine(folderPath, S1Quest.SaveFolderName);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			base.SaveInternal(text, ref extraSaveables);
		}

		internal void OnQuestEnded(EQuestState questState)
		{
			Quest.Quests.Remove(S1Quest);
			QuestManager.Quests.Remove(this);
		}

		protected QuestEntry AddEntry(string title, Vector3? poiPosition = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("QuestEntry");
			Transform transform = val.transform;
			GameObject gameObject = _gameObject;
			transform.SetParent((gameObject != null) ? gameObject.transform : null);
			QuestEntry val2 = val.AddComponent<QuestEntry>();
			val2.PoILocation = val.transform;
			S1Quest.Entries.Add(val2);
			QuestEntry questEntry = new QuestEntry(val2)
			{
				Title = title,
				POIPosition = (Vector3)(((??)poiPosition) ?? Vector3.zero)
			};
			QuestEntries.Add(questEntry);
			return questEntry;
		}

		public void Begin()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Begin(true);
			}
		}

		public void Cancel()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Cancel(true);
			}
		}

		public void Expire()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Expire(true);
			}
		}

		public void Fail()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Fail(true);
			}
		}

		public void Complete()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.Complete(true);
			}
		}

		public void End()
		{
			Quest s1Quest = S1Quest;
			if (s1Quest != null)
			{
				s1Quest.End();
			}
		}
	}
	public class QuestData
	{
		public readonly string ClassName;

		public QuestData(string className)
		{
			ClassName = className;
		}
	}
	public class QuestEntry
	{
		internal readonly QuestEntry S1QuestEntry;

		public QuestState State => (QuestState)S1QuestEntry.State;

		public string Title
		{
			get
			{
				return S1QuestEntry.Title;
			}
			set
			{
				S1QuestEntry.SetEntryTitle(value);
			}
		}

		public Vector3 POIPosition
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return S1QuestEntry.PoILocation.position;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				S1QuestEntry.PoILocation.position = value;
			}
		}

		public event Action OnComplete
		{
			add
			{
				EventHelper.AddListener(value, S1QuestEntry.onComplete);
			}
			remove
			{
				EventHelper.RemoveListener(value, S1QuestEntry.onComplete);
			}
		}

		internal QuestEntry(QuestEntry questEntry)
		{
			S1QuestEntry = questEntry;
		}

		public void Begin()
		{
			S1QuestEntry.Begin();
		}

		public void Complete()
		{
			S1QuestEntry.Complete();
		}

		public void SetState(QuestState questState)
		{
			S1QuestEntry.SetState((EQuestState)questState, true);
		}
	}
	public static class QuestManager
	{
		internal static readonly List<Quest> Quests = new List<Quest>();

		public static Quest CreateQuest<T>(string? guid = null) where T : Quest
		{
			return CreateQuest(typeof(T), guid);
		}

		public static Quest CreateQuest(Type questType, string? guid = null)
		{
			Quest quest = (Quest)Activator.CreateInstance(questType);
			if (quest == null)
			{
				throw new Exception("Unable to create quest instance of " + questType.FullName + "!");
			}
			Quests.Add(quest);
			return quest;
		}

		public static Quest? GetQuestByGuid(string guid)
		{
			string guid2 = guid;
			return Quests.FirstOrDefault((Quest x) => x.S1Quest.StaticGUID == guid2);
		}

		public static Quest? GetQuestByName(string questName)
		{
			string questName2 = questName;
			return Quests.FirstOrDefault((Quest x) => x.S1Quest.Title == questName2);
		}
	}
}
namespace S1API.Quests.Constants
{
	public enum QuestAction
	{
		Begin,
		Success,
		Fail,
		Expire,
		Cancel
	}
	public enum QuestState
	{
		Inactive,
		Active,
		Completed,
		Failed,
		Expired,
		Cancelled
	}
}
namespace S1API.Property
{
	public abstract class BaseProperty
	{
		public abstract string PropertyName { get; }

		public abstract string PropertyCode { get; }

		public abstract float Price { get; set; }

		public abstract bool IsOwned { get; }

		public abstract int EmployeeCapacity { get; set; }

		public abstract void SetOwned();

		public abstract bool IsPointInside(Vector3 point);
	}
	public static class BusinessManager
	{
		public static List<BusinessWrapper> GetAllBusinesses()
		{
			List<BusinessWrapper> list = new List<BusinessWrapper>();
			foreach (Business business in Business.Businesses)
			{
				list.Add(new BusinessWrapper(business));
			}
			return list;
		}

		public static List<BusinessWrapper> GetOwnedBusinesses()
		{
			List<BusinessWrapper> list = new List<BusinessWrapper>();
			foreach (Business ownedBusiness in Business.OwnedBusinesses)
			{
				list.Add(new BusinessWrapper(ownedBusiness));
			}
			return list;
		}

		public static BusinessWrapper? FindBusinessByName(string name)
		{
			foreach (Business business in Business.Businesses)
			{
				if (((Property)business).PropertyName == name)
				{
					return new BusinessWrapper(business);
				}
			}
			return null;
		}
	}
	public class BusinessWrapper : PropertyWrapper
	{
		[CompilerGenerated]
		private sealed class <get_LaunderingCapacityPaths>d__19 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public BusinessWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_LaunderingCapacityPaths>d__19(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = "@Businesses/" + <baseName>5__1 + "/Grid/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <>4__this.PropertyName + "/Grid/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <baseName>5__1 + "/Grid (1)/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = "@Businesses/" + <>4__this.PropertyName + "/Grid (1)/ItemContainer/LaunderingStation_Built(Clone)/LaunderingInterface/CurrentOperations/Total/Max";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_LaunderingCapacityPaths>d__19 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_LaunderingCapacityPaths>d__19(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <get_SignPaths>d__15 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public BusinessWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_SignPaths>d__15(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign_Blue/Price";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign_Blue (1)/Price";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign_Blue/Price";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign_Blue (1)/Price";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_SignPaths>d__15 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_SignPaths>d__15(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		internal readonly Business InnerBusiness;

		public float LaunderCapacity
		{
			get
			{
				return InnerBusiness.LaunderCapacity;
			}
			set
			{
				InnerBusiness.LaunderCapacity = value;
				foreach (string launderingCapacityPath in LaunderingCapacityPaths)
				{
					if (TrySetTMPText(launderingCapacityPath, MoneyManager.FormatAmount(value, false, false), "laundering capacity"))
					{
						break;
					}
				}
			}
		}

		public List<LaunderingOperation> LaunderingOperations
		{
			get
			{
				List<LaunderingOperation> list = new List<LaunderingOperation>();
				foreach (LaunderingOperation launderingOperation in InnerBusiness.LaunderingOperations)
				{
					list.Add(new LaunderingOperation(launderingOperation));
				}
				return list;
			}
		}

		public float CurrentLaunderTotal => InnerBusiness.currentLaunderTotal;

		public float AppliedLaunderLimit => InnerBusiness.appliedLaunderLimit;

		internal override string SignPrefix => "@Businesses/";

		internal override IEnumerable<string> SignPaths
		{
			[IteratorStateMachine(typeof(<get_SignPaths>d__15))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_SignPaths>d__15 <get_SignPaths>d__ = new <get_SignPaths>d__15(-2);
				<get_SignPaths>d__.<>4__this = this;
				return <get_SignPaths>d__;
			}
		}

		internal override string WhiteboardPath => "Map/Container/RE Office/Interior/Whiteboard (1)/PropertyListing " + PropertyName + "/Price";

		internal IEnumerable<string> LaunderingCapacityPaths
		{
			[IteratorStateMachine(typeof(<get_LaunderingCapacityPaths>d__19))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_LaunderingCapacityPaths>d__19 <get_LaunderingCapacityPaths>d__ = new <get_LaunderingCapacityPaths>d__19(-2);
				<get_LaunderingCapacityPaths>d__.<>4__this = this;
				return <get_LaunderingCapacityPaths>d__;
			}
		}

		public BusinessWrapper(Business business)
			: base((Property)(object)business)
		{
			InnerBusiness = business;
		}

		public void AddLaunderingOperation(float amount, int minutesSinceStarted)
		{
			InnerBusiness.StartLaunderingOperation(amount, minutesSinceStarted);
		}
	}
	public class LaunderingOperation
	{
		internal readonly LaunderingOperation InnerLaunderingOperation;

		public BusinessWrapper Business
		{
			get
			{
				return new BusinessWrapper(InnerLaunderingOperation.business);
			}
			set
			{
				InnerLaunderingOperation.business = value.InnerBusiness;
			}
		}

		public float Amount
		{
			get
			{
				return InnerLaunderingOperation.amount;
			}
			set
			{
				InnerLaunderingOperation.amount = value;
			}
		}

		public int MinutesSinceStarted
		{
			get
			{
				return InnerLaunderingOperation.minutesSinceStarted;
			}
			set
			{
				InnerLaunderingOperation.minutesSinceStarted = value;
			}
		}

		public int CompletionTimeInMinutes
		{
			get
			{
				return InnerLaunderingOperation.completionTime_Minutes;
			}
			set
			{
				InnerLaunderingOperation.completionTime_Minutes = value;
			}
		}

		public LaunderingOperation(LaunderingOperation launderingOperation)
		{
			InnerLaunderingOperation = launderingOperation;
		}

		public LaunderingOperation(BusinessWrapper business, float amount, int minutesSinceStarted, int completionTimeInMinutes = 1140)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			InnerLaunderingOperation = new LaunderingOperation(business.InnerBusiness, amount, minutesSinceStarted);
			InnerLaunderingOperation.completionTime_Minutes = completionTimeInMinutes;
		}
	}
	public static class PropertyManager
	{
		public static List<PropertyWrapper> GetAllProperties()
		{
			List<PropertyWrapper> list = new List<PropertyWrapper>();
			foreach (Property property in Property.Properties)
			{
				list.Add(new PropertyWrapper(property));
			}
			return list;
		}

		public static List<PropertyWrapper> GetOwnedProperties()
		{
			List<PropertyWrapper> list = new List<PropertyWrapper>();
			foreach (Property ownedProperty in Property.OwnedProperties)
			{
				list.Add(new PropertyWrapper(ownedProperty));
			}
			return list;
		}

		public static PropertyWrapper FindPropertyByName(string name)
		{
			foreach (Property property in Property.Properties)
			{
				if (property.PropertyName == name)
				{
					return new PropertyWrapper(property);
				}
			}
			return null;
		}
	}
	public class PropertyWrapper : BaseProperty
	{
		[CompilerGenerated]
		private sealed class <get_SignPaths>d__21 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			public PropertyWrapper <>4__this;

			private string <baseName>5__1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <get_SignPaths>d__21(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<baseName>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<baseName>5__1 = <>4__this.PropertyName.Replace(" ", "");
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign/Price";
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign/Price";
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <baseName>5__1 + "/ForSaleSign (1)/Price";
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = <>4__this.SignPrefix + <>4__this.PropertyName + "/ForSaleSign (1)/Price";
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<get_SignPaths>d__21 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <get_SignPaths>d__21(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		internal readonly Property InnerProperty;

		public override string PropertyName => InnerProperty.PropertyName;

		public override string PropertyCode => InnerProperty.PropertyCode;

		public override float Price
		{
			get
			{
				return InnerProperty.Price;
			}
			set
			{
				InnerProperty.Price = value;
				UpdatePriceDisplay(value);
			}
		}

		public override bool IsOwned => InnerProperty.IsOwned;

		public override int EmployeeCapacity
		{
			get
			{
				return InnerProperty.EmployeeCapacity;
			}
			set
			{
				InnerProperty.EmployeeCapacity = value;
			}
		}

		internal virtual string SignPrefix => "@Properties/";

		internal virtual string WhiteboardPath => "Map/Container/RE Office/Interior/Whiteboard/PropertyListing " + PropertyName + "/Price";

		internal virtual IEnumerable<string> SignPaths
		{
			[IteratorStateMachine(typeof(<get_SignPaths>d__21))]
			get
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				<get_SignPaths>d__21 <get_SignPaths>d__ = new <get_SignPaths>d__21(-2);
				<get_SignPaths>d__.<>4__this = this;
				return <get_SignPaths>d__;
			}
		}

		public PropertyWrapper(Property property)
		{
			InnerProperty = property;
		}

		public override void SetOwned()
		{
			InnerProperty.SetOwned();
		}

		public override bool IsPointInside(Vector3 point)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return InnerProperty.DoBoundsContainPoint(point);
		}

		internal void UpdatePriceDisplay(float price)
		{
			string priceText = MoneyManager.FormatAmount(price, false, false);
			TrySetTMPText(WhiteboardPath, priceText, "whiteboard");
			foreach (string signPath in SignPaths)
			{
				if (TrySetTMPText(signPath, priceText, "sign"))
				{
					break;
				}
			}
		}

		internal bool TrySetTMPText(string path, string priceText, string context)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				TMP_Text component = val.GetComponent<TMP_Text>();
				if ((Object)(object)component != (Object)null)
				{
					component.text = priceText;
					return true;
				}
				Debug.LogWarning((object)("TMP_Text not found on " + context + " price object."));
			}
			else
			{
				Debug.LogWarning((object)(context + " price object not found at path: " + path));
			}
			return false;
		}
	}
}
namespace S1API.Properties
{
	public class ProductPropertyWrapper : PropertyBase
	{
		private readonly Property _innerProperty;

		public override string ID => _innerProperty.ID;

		public override string Name => _innerProperty.Name;

		public override string name => ((Object)_innerProperty).name;

		public override string Description => _innerProperty.Description;

		public override int Tier => _innerProperty.Tier;

		public override float Addictiveness => _innerProperty.Addictiveness;

		internal Property InnerProperty => _innerProperty;

		internal ProductPropertyWrapper(Property property)
		{
			_innerProperty = property;
		}
	}
	public static class Property
	{
		public static readonly PropertyBase Munchies = new Munchies();

		public static readonly PropertyBase AntiGravity = new AntiGravity();

		public static readonly PropertyBase Energizing = new Energizing();

		public static readonly PropertyBase Focused = new Focused();

		public static readonly PropertyBase Smelly = new Smelly();

		public static readonly PropertyBase Euphoric = new Euphoric();

		public static readonly PropertyBase Cyclopean = new Cyclopean();

		public static readonly PropertyBase Slippery = new Slippery();

		public static readonly PropertyBase Shrinking = new Shrinking();

		public static readonly PropertyBase Seizure = new Seizure();

		public static readonly PropertyBase Electrifying = new Electrifying();

		public static readonly PropertyBase Zombifying = new Zombifying();

		public static readonly PropertyBase Disorienting = new Disorienting();

		public static readonly PropertyBase Sedating = new Sedating();

		public static readonly PropertyBase CalorieDense = new CalorieDense();

		public static readonly PropertyBase TropicThunder = new TropicThunder();

		public static readonly PropertyBase Toxic = new Toxic();

		public static readonly PropertyBase ThoughtProvoking = new ThoughtProvoking();

		public static readonly PropertyBase Lethal = new Lethal();

		public static readonly PropertyBase Calming = new Calming();

		public static readonly PropertyBase Schizophrenic = new Schizophrenic();

		public static readonly PropertyBase Spicy = new Spicy();

		public static readonly PropertyBase Laxative = new Laxative();

		public static readonly PropertyBase BrightEyed = new BrightEyed();

		public static readonly PropertyBase Sneaky = new Sneaky();

		public static readonly PropertyBase Jennerising = new Jennerising();

		public static readonly PropertyBase Balding = new Balding();

		public static readonly PropertyBase Glowie = new Glowie();

		public static readonly PropertyBase Refreshing = new Refreshing();

		public static readonly PropertyBase Athletic = new Athletic();

		public static readonly PropertyBase LongFaced = new LongFaced();

		public static readonly PropertyBase Paranoia = new Paranoia();

		public static readonly PropertyBase Gingeritis = new Gingeritis();

		public static readonly PropertyBase Foggy = new Foggy();

		public static readonly PropertyBase Explosive = new Explosive();
	}
}
namespace S1API.Properties.Tokens
{
	public sealed class AntiGravity : PropertyToken
	{
		public AntiGravity()
			: base("antigravity", "AntiGravity")
		{
		}
	}
	public sealed class Athletic : PropertyToken
	{
		public Athletic()
			: base("athletic", "Athletic")
		{
		}
	}
	public sealed class Balding : PropertyToken
	{
		public Balding()
			: base("balding", "Balding")
		{
		}
	}
	public sealed class BrightEyed : PropertyToken
	{
		public BrightEyed()
			: base("brighteyed", "BrightEyed")
		{
		}
	}
	public sealed class Calming : PropertyToken
	{
		public Calming()
			: base("calming", "Calming")
		{
		}
	}
	public sealed class CalorieDense : PropertyToken
	{
		public CalorieDense()
			: base("caloriedense", "CalorieDense")
		{
		}
	}
	public sealed class Cyclopean : PropertyToken
	{
		public Cyclopean()
			: base("cyclopean", "Cyclopean")
		{
		}
	}
	public sealed class Disorienting : PropertyToken
	{
		public Disorienting()
			: base("disorienting", "Disorienting")
		{
		}
	}
	public sealed class Electrifying : PropertyToken
	{
		public Electrifying()
			: base("electrifying", "Electrifying")
		{
		}
	}
	public sealed class Energizing : PropertyToken
	{
		public Energizing()
			: base("energizing", "Energizing")
		{
		}
	}
	public sealed class Euphoric : PropertyToken
	{
		public Euphoric()
			: base("euphoric", "Euphoric")
		{
		}
	}
	public sealed class Explosive : PropertyToken
	{
		public Explosive()
			: base("explosive", "Explosive")
		{
		}
	}
	public sealed class Focused : PropertyToken
	{
		public Focused()
			: base("focused", "Focused")
		{
		}
	}
	public sealed class Foggy : PropertyToken
	{
		public Foggy()
			: base("foggy", "Foggy")
		{
		}
	}
	public sealed class Gingeritis : PropertyToken
	{
		public Gingeritis()
			: base("gingeritis", "Gingeritis")
		{
		}
	}
	public sealed class Glowie : PropertyToken
	{
		public Glowie()
			: base("glowie", "Glowie")
		{
		}
	}
	public sealed class Jennerising : PropertyToken
	{
		public Jennerising()
			: base("jennerising", "Jennerising")
		{
		}
	}
	public sealed class Laxative : PropertyToken
	{
		public Laxative()
			: base("laxative", "Laxative")
		{
		}
	}
	public sealed class Lethal : PropertyToken
	{
		public Lethal()
			: base("lethal", "Lethal")
		{
		}
	}
	public sealed class LongFaced : PropertyToken
	{
		public LongFaced()
			: base("longfaced", "LongFaced")
		{
		}
	}
	public sealed class Munchies : PropertyToken
	{
		public Munchies()
			: base("munchies", "Munchies")
		{
		}
	}
	public sealed class Paranoia : PropertyToken
	{
		public Paranoia()
			: base("paranoia", "Paranoia")
		{
		}
	}
	public abstract class PropertyToken : PropertyBase
	{
		private readonly string _id;

		private readonly string _unityName;

		private readonly string _displayName;

		private readonly string _description;

		private readonly int _tier;

		private readonly float _addictiveness;

		public override string ID => _id;

		public override string Name => _displayName;

		public override string name => _unityName;

		public override string Description => _description;

		public override int Tier => _tier;

		public override float Addictiveness => _addictiveness;

		protected PropertyToken(string id, string unityName = null, string displayName = null, string description = null, int tier = 1, float addictiveness = 0f)
		{
			_id = id ?? string.Empty;
			_unityName = unityName ?? id ?? string.Empty;
			_displayName = displayName ?? id ?? string.Empty;
			_description = description ?? string.Empty;
			_tier = tier;
			_addictiveness = addictiveness;
		}
	}
	public sealed class Refreshing : PropertyToken
	{
		public Refreshing()
			: base("refreshing", "Refreshing")
		{
		}
	}
	public sealed class Schizophrenic : PropertyToken
	{
		public Schizophrenic()
			: base("schizophrenic", "Schizophrenic")
		{
		}
	}
	public sealed class Sedating : PropertyToken
	{
		public Sedating()
			: base("sedating", "Sedating")
		{
		}
	}
	public sealed class Seizure : PropertyToken
	{
		public Seizure()
			: base("seizure", "Seizure")
		{
		}
	}
	public sealed class Shrinking : PropertyToken
	{
		public Shrinking()
			: base("shrinking", "Shrinking")
		{
		}
	}
	public sealed class Slippery : PropertyToken
	{
		public Slippery()
			: base("slippery", "Slippery")
		{
		}
	}
	public sealed class Smelly : PropertyToken
	{
		public Smelly()
			: base("smelly", "Smelly")
		{
		}
	}
	public sealed class Sneaky : PropertyToken
	{
		public Sneaky()
			: base("sneaky", "Sneaky")
		{
		}
	}
	public sealed class Spicy : PropertyToken
	{
		public Spicy()
			: base("spicy", "Spicy")
		{
		}
	}
	public sealed class ThoughtProvoking : PropertyToken
	{
		public ThoughtProvoking()
			: base("thoughtprovoking", "ThoughtProvoking")
		{
		}
	}
	public sealed class Toxic : PropertyToken
	{
		public Toxic()
			: base("toxic", "Toxic")
		{
		}
	}
	public sealed class TropicThunder : PropertyToken
	{
		public TropicThunder()
			: base("tropicthunder", "TropicThunder")
		{
		}
	}
	public sealed class Zombifying : PropertyToken
	{
		public Zombifying()
			: base("zombifying", "Zombifying")
		{
		}
	}
}
namespace S1API.Properties.Internal
{
	internal static class PropertyResolver
	{
		private static readonly string[] SearchPaths = new string[5] { "Properties/Tier1", "Properties/Tier2", "Properties/Tier3", "Properties/Tier4", "Properties/Tier5" };

		internal static List<Property> ResolveToGameProperties(IEnumerable<PropertyBase> items)
		{
			List<Property> list = new List<Property>();
			if (items == null)
			{
				return list;
			}
			foreach (PropertyBase item in items)
			{
				if (item == null)
				{
					continue;
				}
				if (item is ProductPropertyWrapper productPropertyWrapper)
				{
					Property innerProperty = productPropertyWrapper.InnerProperty;
					if ((Object)(object)innerProperty != (Object)null && !list.Contains(innerProperty))
					{
						list.Add(innerProperty);
					}
				}
				else
				{
					Property val = FindByIdOrName(item.ID, item.name);
					if ((Object)(object)val != (Object)null && !list.Contains(val))
					{
						list.Add(val);
					}
				}
			}
			return list;
		}

		private static Property FindByIdOrName(string id, string unityName)
		{
			string idNorm = (id ?? string.Empty).Trim();
			string nameNorm = (unityName ?? string.Empty).Trim();
			string[] searchPaths = SearchPaths;
			foreach (string text in searchPaths)
			{
				Property[] array = Resources.LoadAll<Property>(text);
				if (array == null || array.Length == 0)
				{
					continue;
				}
				if (!string.IsNullOrEmpty(idNorm))
				{
					Property val = ((IEnumerable<Property>)array).FirstOrDefault((Func<Property, bool>)((Property p) => (Object)(object)p != (Object)null && string.Equals(p.ID, idNorm, StringComparison.OrdinalIgnoreCase)));
					if ((Object)(object)val != (Object)null)
					{
						return val;
					}
				}
				if (!string.IsNullOrEmpty(nameNorm))
				{
					Property val2 = ((IEnumerable<Property>)array).FirstOrDefault((Func<Property, bool>)((Property p) => (Object)(object)p != (Object)null && string.Equals(((Object)p).name, nameNorm, StringComparison.OrdinalIgnoreCase)));
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
			}
			return null;
		}
	}
}
namespace S1API.Properties.Interfaces
{
	public abstract class PropertyBase
	{
		public abstract string ID { get; }

		public abstract string Name { get; }

		public abstract string name { get; }

		public abstract string Description { get; }

		public abstract int Tier { get; }

		public abstract float Addictiveness { get; }
	}
}
namespace S1API.Products
{
	public class CocaineDefinition : ProductDefinition
	{
		internal CocaineDefinition S1CocaineDefinition => CrossType.As<CocaineDefinition>(base.S1ItemDefinition);

		internal CocaineDefinition(CocaineDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>(((ItemDefinition)S1CocaineDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			List<Property> list2 = ((PropertyItemDefinition)(S1CocaineDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(list2[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			List<Property> list2 = ((PropertyItemDefinition)(S1CocaineDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(list2[i]);
				}
			}
			return list;
		}
	}
	public enum DrugType
	{
		Marijuana,
		Methamphetamine,
		Cocaine,
		MDMA,
		Shrooms,
		Heroin
	}
	public class MethDefinition : ProductDefinition
	{
		internal MethDefinition S1MethDefinition => CrossType.As<MethDefinition>(base.S1ItemDefinition);

		internal MethDefinition(MethDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>(((ItemDefinition)S1MethDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			List<Property> list2 = ((PropertyItemDefinition)(S1MethDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(list2[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			List<Property> list2 = ((PropertyItemDefinition)(S1MethDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(list2[i]);
				}
			}
			return list;
		}
	}
	public class PackagingDefinition : ItemDefinition
	{
		internal PackagingDefinition S1PackagingDefinition => CrossType.As<PackagingDefinition>(base.S1ItemDefinition);

		public int Quantity => S1PackagingDefinition.Quantity;

		internal PackagingDefinition(ItemDefinition s1ItemDefinition)
			: base(s1ItemDefinition)
		{
		}
	}
	public class ProductDefinition : ItemDefinition
	{
		internal ProductDefinition S1ProductDefinition => CrossType.As<ProductDefinition>(base.S1ItemDefinition);

		public float Price => S1ProductDefinition.Price;

		public float BasePrice => S1ProductDefinition.BasePrice;

		public float MarketValue => S1ProductDefinition.MarketValue;

		public new Sprite Icon => ((ItemDefinition)S1ProductDefinition).Icon;

		public IReadOnlyList<PropertyBase> Properties
		{
			get
			{
				List<Property> properties = ((PropertyItemDefinition)S1ProductDefinition).Properties;
				List<PropertyBase> list = new List<PropertyBase>(properties.Count);
				for (int i = 0; i < properties.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(properties[i]));
				}
				return list.AsReadOnly();
			}
		}

		public List<DrugTypeContainer> DrugTypes => S1ProductDefinition.DrugTypes;

		public EDrugType DrugType => S1ProductDefinition.DrugType;

		internal ProductDefinition(ItemDefinition productDefinition)
			: base(productDefinition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>(((ItemDefinition)S1ProductDefinition).GetDefaultInstance(quantity)));
		}
	}
	public static class ProductDefinitionWrapper
	{
		public static ProductDefinition Wrap(ProductDefinition def)
		{
			ItemDefinition s1ItemDefinition = def.S1ItemDefinition;
			if (CrossType.Is<WeedDefinition>(s1ItemDefinition, out var result))
			{
				return new WeedDefinition(result);
			}
			if (CrossType.Is<MethDefinition>(s1ItemDefinition, out var result2))
			{
				return new MethDefinition(result2);
			}
			if (CrossType.Is<CocaineDefinition>(s1ItemDefinition, out var result3))
			{
				return new CocaineDefinition(result3);
			}
			return def;
		}
	}
	public class ProductInstance : ItemInstance
	{
		internal ProductItemInstance S1ProductInstance => CrossType.As<ProductItemInstance>(S1ItemInstance);

		public bool IsPackaged => Object.op_Implicit((Object)(object)S1ProductInstance.AppliedPackaging);

		public PackagingDefinition AppliedPackaging => new PackagingDefinition((ItemDefinition)(object)S1ProductInstance.AppliedPackaging);

		public Quality Quality => ((QualityItemInstance)S1ProductInstance).Quality.ToAPI();

		public new ProductDefinition Definition => new ProductDefinition(((ItemInstance)S1ProductInstance).Definition);

		public IReadOnlyList<PropertyBase> Properties => Definition.Properties;

		internal ProductInstance(ProductItemInstance productInstance)
			: base((ItemInstance)(object)productInstance)
		{
		}
	}
	public static class ProductManager
	{
		public static ProductDefinition[] DiscoveredProducts => (from productDefinition in ProductManager.DiscoveredProducts.ToArray()
			select ProductDefinitionWrapper.Wrap(new ProductDefinition((ItemDefinition)(object)productDefinition))).ToArray();
	}
	public enum Quality
	{
		Trash,
		Poor,
		Standard,
		Premium,
		Heavenly
	}
	internal static class QualityExtensions
	{
		internal static Quality ToAPI(this EQuality quality)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected I4, but got Unknown
			if (1 == 0)
			{
			}
			Quality result = (int)quality switch
			{
				0 => Quality.Trash, 
				1 => Quality.Poor, 
				2 => Quality.Standard, 
				3 => Quality.Premium, 
				4 => Quality.Heavenly, 
				_ => Quality.Trash, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		internal static EQuality ToInternal(this Quality quality)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: 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_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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EQuality result = (EQuality)(quality switch
			{
				Quality.Trash => 0, 
				Quality.Poor => 1, 
				Quality.Standard => 2, 
				Quality.Premium => 3, 
				Quality.Heavenly => 4, 
				_ => 0, 
			});
			if (1 == 0)
			{
			}
			return result;
		}
	}
	public class WeedDefinition : ProductDefinition
	{
		internal WeedDefinition S1WeedDefinition => CrossType.As<WeedDefinition>(base.S1ItemDefinition);

		internal WeedDefinition(WeedDefinition definition)
			: base((ItemDefinition)(object)definition)
		{
		}

		public override ItemInstance CreateInstance(int quantity = 1)
		{
			return new ProductInstance(CrossType.As<ProductItemInstance>(((ItemDefinition)S1WeedDefinition).GetDefaultInstance(quantity)));
		}

		public List<PropertyBase> GetProperties()
		{
			List<PropertyBase> list = new List<PropertyBase>();
			List<Property> list2 = ((PropertyItemDefinition)(S1WeedDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(new ProductPropertyWrapper(list2[i]));
				}
			}
			return list;
		}

		[Obsolete("Use GetProperties() instead for IL2CPP compatibility")]
		public List<Property> GetRawProperties()
		{
			List<Property> list = new List<Property>();
			List<Property> list2 = ((PropertyItemDefinition)(S1WeedDefinition?)).Properties;
			if (list2 != null)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(list2[i]);
				}
			}
			return list;
		}
	}
}
namespace S1API.PhoneCalls
{
	public class CallerDefinition
	{
		internal readonly CallerID S1CallerIDEntry;

		public string Name
		{
			get
			{
				return S1CallerIDEntry.Name;
			}
			set
			{
				S1CallerIDEntry.Name = value;
			}
		}

		public Sprite? ProfilePicture
		{
			get
			{
				return S1CallerIDEntry.ProfilePicture;
			}
			set
			{
				S1CallerIDEntry.ProfilePicture = value;
			}
		}

		internal CallerDefinition(CallerID s1CallerID)
		{
			S1CallerIDEntry = s1CallerID;
		}
	}
	public static class CallManager
	{
		private static readonly Queue<PhoneCallData> PendingCalls = new Queue<PhoneCallData>();

		internal static bool IsDispatchingToGameQueue;

		public static int PendingCount => PendingCalls.Count;

		public static void QueueCall(PhoneCallDefinition phoneCallDefinition)
		{
			if (phoneCallDefinition == null)
			{
				throw new ArgumentNullException("phoneCallDefinition");
			}
			PendingCalls.Enqueue(phoneCallDefinition.S1PhoneCallData);
			TryProcessQueue();
		}

		internal static void QueueCall(PhoneCallData phoneCallData)
		{
			if ((Object)(object)phoneCallData == (Object)null)
			{
				throw new ArgumentNullException("phoneCallData");
			}
			PendingCalls.Enqueue(phoneCallData);
			TryProcessQueue();
		}

		public static void ClearPendingQueue()
		{
			PendingCalls.Clear();
		}

		private static PhoneCallData GetQueuedCallData(CallManager manager)
		{
			object obj = global::S1API.Internal.Utils.ReflectionUtils.TryGetFieldOrProperty(manager, "QueuedCallData");
			return (PhoneCallData)((obj is PhoneCallData) ? obj : null);
		}

		internal static void TryProcessQueue()
		{
			CallManager instance = Singleton<CallManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			CallInterface instance2 = Singleton<CallInterface>.Instance;
			if ((Object)(object)instance2 == (Object)null || (Object)(object)instance2.ActiveCallData != (Object)null || (Object)(object)GetQueuedCallData(instance) != (Object)null || PendingCalls.Count == 0)
			{
				return;
			}
			PhoneCallData val = null;
			while (PendingCalls.Count > 0)
			{
				PhoneCallData val2 = PendingCalls.Dequeue();
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)val2.CallerID == (Object)null)
					{
						CallerID val3 = ScriptableObject.CreateInstance<CallerID>();
						val3.Name = "Unknown Caller";
						val3.ProfilePicture = null;
						val2.CallerID = val3;
					}
					if (val2.Stages == null)
					{
						val2.Stages = Array.Empty<Stage>();
					}
				}
				catch
				{
				}
				if (val2.Stages == null || val2.Stages.Length == 0)
				{
					continue;
				}
				val = val2;
				break;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			IsDispatchingToGameQueue = true;
			try
			{
				instance.QueueCall(val);
			}
			finally
			{
				IsDispatchingToGameQueue = false;
			}
		}
	}
	public class CallStageEntry
	{
		internal readonly Stage S1Stage;

		protected readonly List<SystemTriggerEntry> StartTriggerEntries = new List<SystemTriggerEntry>();

		protected readonly List<SystemTriggerEntry> DoneTriggerEntries = new List<SystemTriggerEntry>();

		public string Text
		{
			get
			{
				return S1Stage.Text;
			}
			set
			{
				S1Stage.Text = value;
			}
		}

		internal CallStageEntry(Stage stage)
		{
			S1Stage = stage;
		}

		public SystemTriggerEntry AddSystemTrigger(SystemTriggerType triggerType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SystemTrigger val = new SystemTrigger();
			SystemTriggerEntry systemTriggerEntry = new SystemTriggerEntry(val);
			switch (triggerType)
			{
			case SystemTriggerType.StartTrigger:
				S1Stage.OnStartTriggers = S1Stage.OnStartTriggers.AddItemToArray(val);
				StartTriggerEntries.Add(systemTriggerEntry);
				break;
			case SystemTriggerType.DoneTrigger:
				S1Stage.OnDoneTriggers = S1Stage.OnDoneTriggers.AddItemToArray(val);
				DoneTriggerEntries.Add(systemTriggerEntry);
				break;
			}
			return systemTriggerEntry;
		}
	}
	public abstract class PhoneCallDefinition
	{
		public CallerDefinition? Caller;

		public readonly PhoneCallData S1PhoneCallData;

		protected readonly List<CallStageEntry> StageEntries = new List<CallStageEntry>();

		protected PhoneCallDefinition(string name, Sprite? profilePicture = null)
		{
			S1PhoneCallData = ScriptableObject.CreateInstance<PhoneCallData>();
			PhoneCallData s1PhoneCallData = S1PhoneCallData;
			if (s1PhoneCallData.Stages == null)
			{
				s1PhoneCallData.Stages = Array.Empty<Stage>();
			}
			AddCallerID(name, profilePicture);
		}

		protected PhoneCallDefinition(NPC? npcCallerID)
		{
			S1PhoneCallData = ScriptableObject.CreateInstance<PhoneCallData>();
			PhoneCallData s1PhoneCallData = S1PhoneCallData;
			if (s1PhoneCallData.Stages == null)
			{
				s1PhoneCallData.Stages = Array.Empty<Stage>();
			}
			AddCallerID(npcCallerID);
		}

		protected CallerDefinition AddCallerID(string name, Sprite? profilePicture = null)
		{
			CallerID val = ScriptableObject.CreateInstance<CallerID>();
			val.Name = name;
			val.ProfilePicture = profilePicture;
			S1PhoneCallData.CallerID = val;
			Caller = new CallerDefinition(val)
			{
				Name = name,
				ProfilePicture = profilePicture
			};
			return Caller;
		}

		protected CallerDefinition AddCallerID(NPC? npc)
		{
			CallerID val = ScriptableObject.CreateInstance<CallerID>();
			val.Name = npc?.FullName ?? "Unknown Caller";
			val.ProfilePicture = npc?.Icon;
			S1PhoneCallData.CallerID = val;
			Caller = new CallerDefinition(val)
			{
				Name = (npc?.FullName ?? "Unknown Caller"),
				ProfilePicture = npc?.Icon
			};
			return Caller;
		}

		protected CallStageEntry AddStage(string text)
		{
			//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
			Stage val = new Stage
			{
				Text = text
			};
			S1PhoneCallData.Stages = S1PhoneCallData.Stages.AddItemToArray(val);
			CallStageEntry callStageEntry = new CallStageEntry(val)
			{
				Text = text
			};
			StageEntries.Add(callStageEntry);
			return callStageEntry;
		}

		public void Completed()
		{
			S1PhoneCallData.Completed();
		}
	}
}
namespace S1API.PhoneCalls.Constants
{
	public enum EvaluationType
	{
		PassOnTrue,
		PassOnFalse
	}
	public enum SystemTriggerType
	{
		StartTrigger,
		DoneTrigger
	}
}
namespace S1API.PhoneApp
{
	public abstract class PhoneApp : Registerable
	{
		public enum EOrientation
		{
			Horizontal,
			Vertical
		}

		protected static readonly Log Logger = new Log("PhoneApp");

		private GameObject? _appPanel;

		private bool _appCreated;

		private bool _iconModified;

		private Image? _iconImage;

		private Sprite? _pendingIconSprite;

		private HomeScreen? _homeScreenInstance;

		private Action? _closeAppAction;

		private ExitDelegate? _exitDelegate;

		private Action? _onPhoneClosedAction;

		protected abstract string AppName { get; }

		protected abstract string AppTitle { get; }

		protected abstract string IconLabel { get; }

		protected abstract string IconFileName { get; }

		protected virtual Sprite? IconSprite => null;

		protected virtual EOrientation Orientation => EOrientation.Horizontal;

		protected abstract void OnCreatedUI(GameObject container);

		protected override void OnCreated()
		{
			PhoneAppRegistry.Register(this);
		}

		protected override void OnDestroyed()
		{
			if ((Object)(object)_appPanel != (Object)null)
			{
				Object.Destroy((Object)(object)_appPanel);
				_appPanel = null;
			}
			_appCreated = false;
			_iconModified = false;
			_iconImage = null;
			_pendingIconSprite = null;
			if (PlayerSingleton<Phone>.InstanceExists && _closeAppAction != null)
			{
				Phone instance = PlayerSingleton<Phone>.Instance;
				instance.closeApps = (Action)Delegate.Remove(instance.closeApps, _closeAppAction);
				_closeAppAction = null;
			}
			if (_exitDelegate != null)
			{
				GameInput.DeregisterExitListener(_exitDelegate);
				_exitDelegate = null;
			}
			if (PlayerSingleton<Phone>.InstanceExists && _onPhoneClosedAction != null)
			{
				Phone instance2 = PlayerSingleton<Phone>.Instance;
				instance2.onPhoneClosed = (Action)Delegate.Remove(instance2.onPhoneClosed, _onPhoneClosedAction);
				_onPhoneClosedAction = null;
			}
		}

		public virtual void Exit(ExitAction exit)
		{
			if (!exit.Used && IsOpen() && PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen)
			{
				exit.Used = true;
				CloseApp();
			}
		}

		protected virtual void OnPhoneClosed()
		{
		}

		public bool IsOpen()
		{
			return (Object)(object)_appPanel != (Object)null && _appPanel.activeInHierarchy && (Object)(object)Phone.ActiveApp == (Object)(object)_appPanel;
		}

		internal void SpawnUI(HomeScreen homeScreenInstance)
		{
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			_homeScreenInstance = homeScreenInstance;
			Transform obj = ((Component)homeScreenInstance).transform.parent.Find("AppsCanvas");
			GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val == (Object)null)
			{
				Logger.Error("AppsCanvas not found.");
				return;
			}
			

Plugins/S1APILoader.MelonLoader.dll

Decompiled 5 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using MelonLoader;
using Microsoft.CodeAnalysis;
using S1APILoader;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::S1APILoader.S1APILoader), "S1APILoader", "2.4.4", "KaBooMa", null)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("S1APILoader")]
[assembly: AssemblyConfiguration("MonoMelon")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+21b49735b3a97d2b7233612280572874f9b3bd7b")]
[assembly: AssemblyProduct("S1APILoader")]
[assembly: AssemblyTitle("S1APILoader")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace S1APILoader
{
	public class S1APILoader : MelonPlugin
	{
		private const string BuildFolderName = "S1API";

		public override void OnPreModsLoaded()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			if (directoryName == null)
			{
				throw new Exception("Failed to identify plugins folder.");
			}
			string fullPath = Path.GetFullPath(Path.Combine(directoryName, "../Mods"));
			string text = (MelonUtils.IsGameIl2Cpp() ? "Il2Cpp" : "Mono");
			string build = ((!MelonUtils.IsGameIl2Cpp()) ? "Il2Cpp" : "Mono");
			MelonLogger.Msg("Loading S1API for " + text + "...");
			NormalizeBuild(fullPath, text, shouldBeEnabled: true);
			NormalizeBuild(fullPath, build, shouldBeEnabled: false);
			MelonLogger.Msg("Successfully loaded S1API for " + text + "!");
		}

		private static void NormalizeBuild(string modsFolder, string build, bool shouldBeEnabled)
		{
			string text = Path.Combine(modsFolder, "S1API." + build + ".MelonLoader.dll");
			string text2 = text + ".disabled";
			bool flag = File.Exists(text);
			bool flag2 = File.Exists(text2);
			string text3 = null;
			if (flag)
			{
				text3 = text;
			}
			if (flag2)
			{
				text3 = ChooseNewest(text3, text2);
			}
			if (text3 == null)
			{
				return;
			}
			if (shouldBeEnabled)
			{
				if (!StringComparer.OrdinalIgnoreCase.Equals(text3, text))
				{
					SafeDelete(text);
					SafeMoveReplace(text3, text);
				}
				SafeDelete(text2);
			}
			else
			{
				if (!StringComparer.OrdinalIgnoreCase.Equals(text3, text2))
				{
					SafeDelete(text2);
					SafeMoveReplace(text3, text2);
				}
				SafeDelete(text);
			}
		}

		private static string ChooseNewest(string? currentBestPath, string candidatePath)
		{
			if (currentBestPath == null)
			{
				return candidatePath;
			}
			Version version = TryGetAssemblyVersion(currentBestPath);
			Version version2 = TryGetAssemblyVersion(candidatePath);
			if (version != null && version2 != null)
			{
				return (version2 > version) ? candidatePath : currentBestPath;
			}
			DateTime safeWriteTimeUtc = GetSafeWriteTimeUtc(currentBestPath);
			DateTime safeWriteTimeUtc2 = GetSafeWriteTimeUtc(candidatePath);
			return (safeWriteTimeUtc2 > safeWriteTimeUtc) ? candidatePath : currentBestPath;
		}

		private static Version? TryGetAssemblyVersion(string path)
		{
			try
			{
				return AssemblyName.GetAssemblyName(path).Version;
			}
			catch
			{
				return null;
			}
		}

		private static DateTime GetSafeWriteTimeUtc(string path)
		{
			try
			{
				return File.GetLastWriteTimeUtc(path);
			}
			catch
			{
				return DateTime.MinValue;
			}
		}

		private static void SafeMoveReplace(string sourcePath, string destinationPath)
		{
			try
			{
				if (File.Exists(destinationPath))
				{
					File.Delete(destinationPath);
				}
				File.Move(sourcePath, destinationPath);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Failed to move '" + sourcePath + "' to '" + destinationPath + "': " + ex.Message);
			}
		}

		private static void SafeDelete(string path)
		{
			try
			{
				if (File.Exists(path))
				{
					File.Delete(path);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Failed to delete '" + path + "': " + ex.Message);
			}
		}
	}
}