Decompiled source of The Internet v1.0.1

Mods/WoodStudios.TheInternet.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using HarmonyLib;
using HoldTheFort;
using Il2CppFishNet;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.AvatarFramework;
using Il2CppScheduleOne.AvatarFramework.Animation;
using Il2CppScheduleOne.Building;
using Il2CppScheduleOne.Core.Items.Framework;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.Equipping;
using Il2CppScheduleOne.Instancing;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Map;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.NPCs.Relation;
using Il2CppScheduleOne.Networking;
using Il2CppScheduleOne.Persistence;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Property;
using Il2CppScheduleOne.Storage;
using Il2CppScheduleOne.Tiles;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.Shop;
using Il2CppScheduleOne.Weather;
using Il2CppSteamworks;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using S1API.Entities;
using S1API.Items;
using S1API.Items.Storable;
using S1API.Lifecycle;
using S1API.Rendering;
using S1API.Shops;
using S2_NET.FybCommon;
using S2_NET.WoodKit;
using Schedule2;
using Schedule2.Game;
using TheInternetMod;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(TheInternetCore), "The Internet", "1.0.0", "Wood Studios", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonOptionalDependencies(new string[] { "HoldTheFort" })]
[assembly: AssemblyTitle("WoodStudios.TheInternet")]
[assembly: AssemblyProduct("WoodStudios.TheInternet")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Schedule2
{
	internal static class Perf
	{
		internal static bool On;

		public static long Start()
		{
			return 0L;
		}

		public static void Stop(string key, long t0)
		{
		}
	}
	internal static class S2Asm
	{
		internal static bool Is(Assembly a)
		{
			if (a == null)
			{
				return false;
			}
			try
			{
				string name = a.GetName().Name;
				return name == "HoldTheFort" || name == "WoodStudios.Schedule2";
			}
			catch
			{
				return false;
			}
		}
	}
	internal static class FrameShare
	{
		private static int _frame = -1;

		private static Vector2 _mouse;

		private static bool _down;

		private static bool _legacyBroken;

		public static void Mouse(out Vector2 guiMouse, out bool leftDown)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			int frameCount = Time.frameCount;
			if (frameCount != _frame)
			{
				_frame = frameCount;
				Vector2 val = default(Vector2);
				bool flag = false;
				bool down = false;
				if (!_legacyBroken)
				{
					try
					{
						val = Vector2.op_Implicit(Input.mousePosition);
						down = Input.GetMouseButtonDown(0);
						flag = true;
					}
					catch
					{
						_legacyBroken = true;
					}
				}
				if (!flag)
				{
					try
					{
						Mouse current = Mouse.current;
						if (current != null)
						{
							val = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
							down = current.leftButton.wasPressedThisFrame;
						}
					}
					catch
					{
					}
				}
				_mouse = new Vector2(val.x, (float)Screen.height - val.y);
				_down = down;
			}
			guiMouse = _mouse;
			leftDown = _down;
		}
	}
	internal static class InputShare
	{
		private static int _f = -1;

		private static bool _any;

		private static bool _broken;

		public static bool Any()
		{
			int frameCount = Time.frameCount;
			if (frameCount == _f)
			{
				return _any;
			}
			_f = frameCount;
			_any = false;
			if (!_broken)
			{
				try
				{
					_any = Input.anyKeyDown || Input.GetMouseButton(0) || Input.GetMouseButton(1);
					return _any;
				}
				catch
				{
					_broken = true;
				}
			}
			try
			{
				Keyboard current = Keyboard.current;
				Mouse current2 = Mouse.current;
				_any = (current != null && ((ButtonControl)current.anyKey).wasPressedThisFrame) || (current2 != null && (current2.leftButton.isPressed || current2.rightButton.isPressed));
			}
			catch
			{
				_any = true;
			}
			return _any;
		}
	}
	internal static class PlayerSnap
	{
		private static readonly List<Player> _l = new List<Player>();

		private static int _f = -1;

		public static List<Player> List()
		{
			if (_f == Time.frameCount)
			{
				return _l;
			}
			_f = Time.frameCount;
			_l.Clear();
			try
			{
				List<Player> playerList = Player.PlayerList;
				int num = playerList?.Count ?? 0;
				for (int i = 0; i < num; i++)
				{
					Player val = playerList[i];
					if ((Object)(object)val != (Object)null)
					{
						_l.Add(val);
					}
				}
			}
			catch
			{
			}
			return _l;
		}
	}
	internal static class CamSnap
	{
		private static int _f = -1;

		private static bool _ok;

		private static Vector3 _p;

		public static bool Pos(out Vector3 p)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (_f != Time.frameCount)
			{
				_f = Time.frameCount;
				_ok = false;
				try
				{
					PlayerCamera instance = PlayerSingleton<PlayerCamera>.Instance;
					Transform val = (((Object)(object)instance != (Object)null && (Object)(object)instance.Camera != (Object)null) ? ((Component)instance.Camera).transform : (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform : null));
					if ((Object)(object)val != (Object)null)
					{
						_p = val.position;
						_ok = true;
					}
				}
				catch
				{
				}
			}
			p = _p;
			return _ok;
		}
	}
	internal static class PinNear
	{
		private static int _f = -1;

		private static readonly List<Vector3> _p = new List<Vector3>();

		public static bool Near(Vector3 spot)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			int frameCount = Time.frameCount;
			if (frameCount != _f)
			{
				_f = frameCount;
				_p.Clear();
				try
				{
					foreach (Player item in PlayerSnap.List())
					{
						if ((Object)(object)item != (Object)null)
						{
							_p.Add(((Component)item).transform.position);
						}
					}
				}
				catch
				{
				}
				if (CamSnap.Pos(out var p))
				{
					_p.Add(p);
				}
			}
			if (_p.Count == 0)
			{
				return true;
			}
			for (int i = 0; i < _p.Count; i++)
			{
				Vector3 val = _p[i] - spot;
				if (((Vector3)(ref val)).sqrMagnitude < 6400f)
				{
					return true;
				}
			}
			return false;
		}
	}
	internal static class Npcs
	{
		internal sealed class Info
		{
			public IntPtr Key;

			public NPC Npc;

			private NPCMovement _move;

			private NavMeshAgent _agent;

			private Transform _agentTr;

			private bool _haveMove;

			private string _id;

			private bool _haveId;

			public NPCMovement Move
			{
				get
				{
					if (!_haveMove)
					{
						_haveMove = true;
						try
						{
							_move = Npc.Movement;
							_agent = (((Object)(object)_move != (Object)null) ? _move._agent : null);
							_agentTr = (((Object)(object)_agent != (Object)null) ? ((Component)_agent).transform : null);
						}
						catch
						{
						}
					}
					return _move;
				}
			}

			public NavMeshAgent Agent
			{
				get
				{
					_ = Move;
					return _agent;
				}
			}

			public Transform AgentTr
			{
				get
				{
					_ = Move;
					return _agentTr;
				}
			}

			public string Id
			{
				get
				{
					if (!_haveId)
					{
						_haveId = true;
						try
						{
							_id = Npc.ID ?? "";
						}
						catch
						{
							_id = "";
						}
					}
					return _id;
				}
			}
		}

		private static readonly List<Info> _list = new List<Info>();

		private static readonly Dictionary<IntPtr, Info> _byKey = new Dictionary<IntPtr, Info>();

		private static readonly HashSet<IntPtr> _seen = new HashSet<IntPtr>();

		private static float _at = -10f;

		private static int _count = -1;

		public static List<Info> All
		{
			get
			{
				float unscaledTime = Time.unscaledTime;
				if (unscaledTime - _at < 1f && unscaledTime >= _at)
				{
					return _list;
				}
				_at = unscaledTime;
				try
				{
					List<NPC> nPCRegistry = NPCManager.NPCRegistry;
					int num = nPCRegistry?.Count ?? 0;
					_list.Clear();
					_seen.Clear();
					for (int i = 0; i < num; i++)
					{
						NPC val = nPCRegistry[i];
						if (!((Object)(object)val == (Object)null))
						{
							IntPtr pointer = ((Il2CppObjectBase)val).Pointer;
							if (!_byKey.TryGetValue(pointer, out var value) || (Object)(object)value.Npc == (Object)null)
							{
								value = new Info
								{
									Key = pointer,
									Npc = val
								};
								_byKey[pointer] = value;
							}
							_list.Add(value);
							_seen.Add(pointer);
						}
					}
					if (_byKey.Count > _list.Count + 32)
					{
						List<IntPtr> list = new List<IntPtr>();
						foreach (IntPtr key in _byKey.Keys)
						{
							if (!_seen.Contains(key))
							{
								list.Add(key);
							}
						}
						foreach (IntPtr item in list)
						{
							_byKey.Remove(item);
						}
					}
					_count = num;
				}
				catch
				{
				}
				return _list;
			}
		}

		public static void Reset()
		{
			_list.Clear();
			_byKey.Clear();
			_at = -10f;
		}
	}
	internal static class Prim
	{
		private static readonly Dictionary<PrimitiveType, Mesh> Meshes = new Dictionary<PrimitiveType, Mesh>();

		private static Mesh MeshOf(PrimitiveType t)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (Meshes.TryGetValue(t, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			GameObject obj = GameObject.CreatePrimitive(t);
			value = obj.GetComponent<MeshFilter>().sharedMesh;
			Object.DestroyImmediate((Object)(object)obj);
			Meshes[t] = value;
			return value;
		}

		internal unsafe static GameObject Part(Transform parent, PrimitiveType type, Vector3 pos, Vector3 scale, Material m, Vector3? euler, bool collider, string name)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			GameObject val;
			if (collider)
			{
				val = GameObject.CreatePrimitive(type);
			}
			else
			{
				val = new GameObject(((object)(*(PrimitiveType*)(&type))/*cast due to .constrained prefix*/).ToString());
				val.AddComponent<MeshFilter>().sharedMesh = MeshOf(type);
				val.AddComponent<MeshRenderer>();
			}
			Transform transform = val.transform;
			transform.SetParent(parent, false);
			transform.localPosition = pos;
			transform.localRotation = Quaternion.Euler((Vector3)(((??)euler) ?? Vector3.zero));
			transform.localScale = scale;
			((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = m;
			if (name != null)
			{
				((Object)val).name = name;
			}
			return val;
		}
	}
	internal static class LocalsCache
	{
		private static readonly List<NPC> _list = new List<NPC>();

		private static readonly HashSet<IntPtr> _set = new HashSet<IntPtr>();

		private static int _count = -1;

		private static float _at = -1000f;

		internal static void Fill(List<NPC> into, HashSet<IntPtr> set)
		{
			Refresh();
			foreach (NPC item in _list)
			{
				into.Add(item);
			}
			foreach (IntPtr item2 in _set)
			{
				set.Add(item2);
			}
		}

		private static void Refresh()
		{
			List<NPC> nPCRegistry = NPCManager.NPCRegistry;
			int num = nPCRegistry?.Count ?? 0;
			bool flag = _list.Count > 0 && (Object)(object)_list[0] == (Object)null;
			if (num == _count && !flag && Time.unscaledTime - _at < 300f)
			{
				return;
			}
			long t = Perf.Start();
			_count = num;
			_at = Time.unscaledTime;
			_list.Clear();
			_set.Clear();
			HashSet<IntPtr> hashSet = new HashSet<IntPtr>();
			Assembly assembly = typeof(NPC).Assembly;
			try
			{
				foreach (NPC item in NPC.All)
				{
					try
					{
						if (item != null && ((object)item).GetType().Assembly != assembly && (Object)(object)item.gameObject != (Object)null)
						{
							hashSet.Add(((Il2CppObjectBase)item.gameObject).Pointer);
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			int num2 = 0;
			while (nPCRegistry != null && num2 < nPCRegistry.Count)
			{
				NPC val = nPCRegistry[num2];
				try
				{
					if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && !hashSet.Contains(((Il2CppObjectBase)((Component)val).gameObject).Pointer) && val.RelationData != null && !((Object)(object)((Component)val).GetComponent<Customer>() == (Object)null))
					{
						_list.Add(val);
						_set.Add(((Il2CppObjectBase)val).Pointer);
					}
				}
				catch
				{
				}
				num2++;
			}
			Perf.Stop("Locals.Find", t);
		}
	}
	internal static class Res
	{
		private static readonly Assembly Asm = typeof(Res).Assembly;

		private static Dictionary<string, string> _alias;

		private static string Alias(string name)
		{
			if (_alias == null)
			{
				_alias = new Dictionary<string, string>();
				try
				{
					using Stream stream = Asm.GetManifestResourceStream("S2.res.alias.json");
					if (stream != null)
					{
						using StreamReader streamReader = new StreamReader(stream);
						Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(streamReader.ReadToEnd());
						if (dictionary != null)
						{
							_alias = dictionary;
						}
					}
				}
				catch
				{
				}
			}
			if (!_alias.TryGetValue(name, out var value))
			{
				return null;
			}
			return value;
		}

		public static Stream Open(string name)
		{
			Stream manifestResourceStream = Asm.GetManifestResourceStream(name);
			if (manifestResourceStream == null)
			{
				string text = Alias(name);
				if (text != null)
				{
					manifestResourceStream = Asm.GetManifestResourceStream(text);
				}
			}
			if (manifestResourceStream == null)
			{
				return null;
			}
			int num = manifestResourceStream.ReadByte();
			int num2 = manifestResourceStream.ReadByte();
			int num3 = manifestResourceStream.ReadByte();
			int num4 = manifestResourceStream.ReadByte();
			if (num == 83 && num2 == 50 && num3 == 66 && num4 == 82)
			{
				MemoryStream memoryStream = new MemoryStream();
				using (BrotliStream brotliStream = new BrotliStream(manifestResourceStream, CompressionMode.Decompress))
				{
					brotliStream.CopyTo(memoryStream);
				}
				memoryStream.Position = 0L;
				return memoryStream;
			}
			manifestResourceStream.Position = 0L;
			if (num != 31 || num2 != 139)
			{
				return manifestResourceStream;
			}
			MemoryStream memoryStream2 = new MemoryStream();
			using (GZipStream gZipStream = new GZipStream(manifestResourceStream, CompressionMode.Decompress))
			{
				gZipStream.CopyTo(memoryStream2);
			}
			memoryStream2.Position = 0L;
			return memoryStream2;
		}
	}
	internal static class NpcCompat
	{
		private static bool _no;

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static CapsuleCollider Field(NPCMovement m)
		{
			return m._capsuleCollider;
		}

		internal static CapsuleCollider Cap(NPCMovement m)
		{
			if ((Object)(object)m == (Object)null)
			{
				return null;
			}
			if (!_no)
			{
				try
				{
					return Field(m);
				}
				catch (Exception)
				{
					_no = true;
				}
			}
			return ((Component)m).GetComponent<CapsuleCollider>();
		}
	}
	internal static class WkSnap
	{
		private static int _f = -1;

		private static Player _p;

		private static Camera _c;

		private static bool _busy;

		private static string _eq;

		private static IntPtr _eqPtr;

		private static int _hf = -1;

		private static float _hr;

		private static IntPtr _hc;

		private static Il2CppStructArray<RaycastHit> _hits;

		public static void Get(out Player player, out Camera cam, out bool busy, out string equipped)
		{
			int frameCount = Time.frameCount;
			if (frameCount != _f)
			{
				_f = frameCount;
				_p = null;
				_c = null;
				_busy = false;
				try
				{
					_p = Player.Local;
				}
				catch
				{
				}
				try
				{
					PlayerCamera instance = PlayerSingleton<PlayerCamera>.Instance;
					_c = (((Object)(object)instance != (Object)null && (Object)(object)instance.Camera != (Object)null) ? instance.Camera : Camera.main);
					if ((Object)(object)instance != (Object)null && instance.ActiveUIElementCount > 0)
					{
						_busy = true;
					}
				}
				catch
				{
				}
				try
				{
					if (!_busy && GameInput.IsTyping)
					{
						_busy = true;
					}
					if (!_busy && (Object)(object)_p != (Object)null && (_p.IsInVehicle || _p.IsSleeping || _p.IsArrested))
					{
						_busy = true;
					}
				}
				catch
				{
				}
				try
				{
					PlayerInventory instance2 = PlayerSingleton<PlayerInventory>.Instance;
					object obj4;
					if (instance2 == null)
					{
						obj4 = null;
					}
					else
					{
						HotbarSlot equippedSlot = instance2.equippedSlot;
						obj4 = ((equippedSlot != null) ? ((ItemSlot)equippedSlot).ItemInstance : null);
					}
					ItemInstance val = (ItemInstance)obj4;
					if (val == null)
					{
						_eq = null;
						_eqPtr = IntPtr.Zero;
					}
					else if (((Il2CppObjectBase)val).Pointer != _eqPtr)
					{
						_eqPtr = ((Il2CppObjectBase)val).Pointer;
						_eq = ((BaseItemInstance)val).ID;
					}
				}
				catch
				{
					_eq = null;
					_eqPtr = IntPtr.Zero;
				}
			}
			player = _p;
			cam = _c;
			busy = _busy;
			equipped = _eq;
		}

		public static Il2CppStructArray<RaycastHit> Hits(Camera cam, float reach)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			int frameCount = Time.frameCount;
			if (frameCount != _hf || reach != _hr || ((Il2CppObjectBase)cam).Pointer != _hc || _hits == null)
			{
				_hf = frameCount;
				_hr = reach;
				_hc = ((Il2CppObjectBase)cam).Pointer;
				_hits = Physics.RaycastAll(new Ray(((Component)cam).transform.position, ((Component)cam).transform.forward), reach, -5, (QueryTriggerInteraction)1);
			}
			return _hits;
		}
	}
	internal static class UiTheme
	{
		public static readonly Color PanelBg = new Color(0.055f, 0.06f, 0.075f, 0.95f);

		public static readonly Color Accent = new Color(0.96f, 0.74f, 0.27f, 1f);

		public static Color Panel(Color c, Rect r)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (c.a < 0.7f || ((Rect)(ref r)).width < 120f || ((Rect)(ref r)).height < 44f)
			{
				return c;
			}
			float num = Mathf.Max(c.r, Mathf.Max(c.g, c.b));
			float num2 = Mathf.Min(c.r, Mathf.Min(c.g, c.b));
			if (num > 0.125f || num - num2 > 0.05f)
			{
				return c;
			}
			float num3 = Mathf.Clamp01((num - 0.04f) / 0.085f) * 0.04f;
			return new Color(PanelBg.r + num3, PanelBg.g + num3, PanelBg.b + num3 * 1.2f, Mathf.Max(c.a, 0.9f));
		}

		public static Color Button(bool enabled, bool selected, bool hover)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled)
			{
				return new Color(0.11f, 0.115f, 0.13f, 0.88f);
			}
			if (selected)
			{
				return Accent;
			}
			if (!hover)
			{
				return new Color(0.13f, 0.14f, 0.18f, 0.97f);
			}
			return new Color(0.21f, 0.23f, 0.29f, 0.98f);
		}

		public static Color Edge(bool enabled, bool hover)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled)
			{
				return new Color(1f, 1f, 1f, 0.05f);
			}
			if (!hover)
			{
				return new Color(1f, 1f, 1f, 0.14f);
			}
			return new Color(Accent.r, Accent.g, Accent.b, 0.85f);
		}

		public static Color Label(bool enabled, bool selected)
		{
			//IL_003f: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			if (enabled)
			{
				if (!selected)
				{
					return new Color(0.94f, 0.95f, 0.97f);
				}
				return new Color(0.08f, 0.07f, 0.05f);
			}
			return new Color(0.48f, 0.5f, 0.55f);
		}
	}
	public static class Co
	{
		public static object Start(IEnumerator e)
		{
			return MelonCoroutines.Start((Perf.On && e != null) ? Wrap(e) : e);
		}

		private static string Name(IEnumerator e)
		{
			string name = e.GetType().Name;
			int num = name.IndexOf('<');
			int num2 = name.IndexOf('>');
			string text = ((e.GetType().DeclaringType != null) ? (e.GetType().DeclaringType.Name + ".") : "");
			return "co:" + text + ((num >= 0 && num2 > num) ? name.Substring(num + 1, num2 - num - 1) : name);
		}

		private static IEnumerator Wrap(IEnumerator e)
		{
			string k = Name(e);
			while (true)
			{
				long t = Perf.Start();
				bool flag;
				try
				{
					flag = e.MoveNext();
				}
				finally
				{
					Perf.Stop(k, t);
				}
				if (!flag)
				{
					break;
				}
				object current = e.Current;
				yield return (current is IEnumerator e2) ? Wrap(e2) : current;
			}
		}
	}
}
namespace Schedule2.Game
{
	internal static class Sfx
	{
		private static readonly (string mod, string[] game)[] Map = new(string, string[])[87]
		{
			("CF_Chime", new string[1] { "Oven ding" }),
			("CF_Clunk", new string[1] { "Wood impact 1" }),
			("CF_Creak", new string[1] { "Metal Squeak" }),
			("CF_Drain", new string[1] { "Pour water onto surface" }),
			("CF_Fill", new string[1] { "Liquid fill" }),
			("CF_Flush", new string[1] { "foley-toilet-flush-without-tank-refill-238004" }),
			("CF_FridgeOpen", new string[1] { "Locker door open" }),
			("CF_FridgeShut", new string[1] { "Locker door close" }),
			("CF_Shower", new string[1] { "Gentle running water LOOPED" }),
			("CF_Tap", new string[1] { "Gentle running water LOOPED" }),
			("CF_Spin", new string[1] { "1915_Antique_Washing_Machine LOOP" }),
			("CF_Wash", new string[1] { "1915_Antique_Washing_Machine LOOP" }),
			("CF_Thud", new string[1] { "Wood impact 2" }),
			("FI_Bite", new string[1] { "Small_Single_Splash_01" }),
			("FI_Plop", new string[1] { "Small_Single_Splash_01" }),
			("FI_Splash", new string[1] { "Small_Single_Splash_01" }),
			("FI_Snap", new string[1] { "Line cut" }),
			("HTF_Click", new string[1] { "Quick click fixed" }),
			("HTF_Crumble", new string[1] { "Gravel drag 1" }),
			("HTF_Cup", new string[1] { "Generic_Ball_Catch_Impact_02" }),
			("HTF_Ding", new string[1] { "Oven ding" }),
			("HTF_DoorBlow", new string[1] { "metal_solid_impact_19" }),
			("HTF_Inhale", new string[1] { "Light smoke cigarette" }),
			("HTF_HitConcrete", new string[1] { "Generic smooth hammer impact 1" }),
			("HTF_HitWood", new string[1] { "Wood impact 1" }),
			("HTF_Paper", new string[1] { "Trash rustle 1" }),
			("HTF_Putt", new string[1] { "Generic_Ball_Catch_Impact_03" }),
			("HTF_RangeShot", new string[1] { "Colt_M1911_Pistol_Single_Shot_01" }),
			("HTF_Reload", new string[1] { "m1911 reload" }),
			("HTF_SkiBump", new string[1] { "Skateboard land 2" }),
			("HTF_ZipClack", new string[1] { "Small hollow metal impact 1" }),
			("HTF_ZipLand", new string[1] { "Skateboard land 1" }),
			("HTF_Boing", new string[1] { "Boing 2" }),
			("HTF_Burner", new string[1] { "Gas torch burn looped" }),
			("HTF_Crackle", new string[2] { "SFX_FireSmall_L", "fire_wood_stove_02_60_loop" }),
			("HTF_Thunder", new string[2] { "Thunder-2", "Thunder-3" }),
			("LJ_Chop", new string[1] { "Wood impact 3" }),
			("LJ_Crack", new string[1] { "Twig Crunch" }),
			("LJ_Dig", new string[1] { "Gravel drag 2" }),
			("MR_Thud", new string[1] { "Single_Cardboard_Box_Hit_01" }),
			("PF_Thud", new string[1] { "hollywood_punch_01" }),
			("PF_Tick", new string[1] { "Tick 1" }),
			("PT_Brick", new string[1] { "Concrete1" }),
			("PT_Scrape", new string[1] { "Gravel drag 3" }),
			("PT_Step", new string[1] { "Concrete2" }),
			("TW_Bang", new string[1] { "Colt_M1911_Pistol_Single_Shot_02" }),
			("TW_Glass", new string[1] { "Car_Medium_Light_Smash_Glass_01" }),
			("TW_Pin", new string[1] { "Mechanical eject" }),
			("TW_Whoosh", new string[1] { "punch_whoosh_05" }),
			("ZL_Clack", new string[1] { "Small hollow metal impact 1" }),
			("ZL_Land", new string[1] { "Skateboard land 1" }),
			("bd_boing", new string[1] { "Boing 1" }),
			("bd_load", new string[1] { "Revolver shell insert" }),
			("bd_puff", new string[1] { "poof-of-smoke-87381" }),
			("bd_thunk", new string[1] { "Wood impact 2" }),
			("rc_beep", new string[1] { "Single_Function_Beep_Office_Fax_01" }),
			("rc_crunch", new string[1] { "metal_impact_01" }),
			("vac_dump", new string[1] { "Trash rustle 2" }),
			("vac_slurp", new string[1] { "Slurping" }),
			("bi_Printer", new string[1] { "Printer loop" }),
			("lab_start", new string[1] { "washing_machine_button_01" }),
			("lab_done", new string[1] { "Oven ding" }),
			("PF_Bell", new string[1] { "wav:ring_bell" }),
			("PF_Roar", new string[1] { "BoxingMatchSFX" }),
			("HTF_FwBoom", new string[2] { "wav:boom", "Thunder-4" }),
			("rc_boom", new string[2] { "wav:boom", "Thunder-3" }),
			("rc_crackle", new string[1] { "SFX_FireSmall_L" }),
			("TW_Crackle", new string[1] { "SFX_FireSmall_L" }),
			("TW_Hiss", new string[1] { "spray_paint_spray_loop_01" }),
			("rc_go", new string[1] { "Retro win" }),
			("rc_flag", new string[1] { "Retro win" }),
			("HTF_SkiEngine", new string[1] { "idle" }),
			("HTF_ZipWhir", new string[1] { "Skateboard rolling" }),
			("ZL_Whir", new string[1] { "Skateboard rolling" }),
			("LJ_SawIdle", new string[1] { "Hair trimmer fixed" }),
			("LJ_SawCut", new string[1] { "Hair trimmer fixed" }),
			("LJ_Crash", new string[1] { "Wood impact 2" }),
			("vac_hum", new string[1] { "air_conditioner_drone_03_20_loop" }),
			("HTF_ShipHum", new string[1] { "Low rumble" }),
			("HTF_TubBubbles", new string[1] { "Pot of liquid boil loop" }),
			("CF_Dry", new string[1] { "1915_Antique_Washing_Machine LOOP" }),
			("CF_Ignite", new string[1] { "lighter false start" }),
			("CF_Whistle", new string[1] { "Pot of liquid boil loop" }),
			("HTF_Clack", new string[1] { "Generic_Ball_Catch_Impact_01" }),
			("HTF_Exhale", new string[1] { "Light smoke bong" }),
			("MR_Flutter", new string[1] { "Trash rustle 5" }),
			("TW_Ring", new string[1] { "Monotone_Wind_01" })
		};

		private static readonly Dictionary<string, AudioClip> Wavs = new Dictionary<string, AudioClip>();

		private static Dictionary<string, AudioClip> _game;

		private static readonly HashSet<IntPtr> Borrowed = new HashSet<IntPtr>();

		private static float _indexedAt = -100f;

		private static AudioClip Wav(string name)
		{
			if (Wavs.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			try
			{
				using Stream stream = Res.Open("Schedule2.sfx." + name + ".wav");
				if (stream == null)
				{
					return null;
				}
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				byte[] array = memoryStream.ToArray();
				int num = BitConverter.ToInt16(array, 22);
				int num2 = BitConverter.ToInt32(array, 24);
				int i = 12;
				int num3 = -1;
				int num4 = 0;
				int num5;
				for (; i + 8 <= array.Length; i += 8 + num5)
				{
					string text = Encoding.ASCII.GetString(array, i, 4);
					num5 = BitConverter.ToInt32(array, i + 4);
					if (text == "data")
					{
						num3 = i + 8;
						num4 = Math.Min(num5, array.Length - num3);
						break;
					}
				}
				if (num3 < 0)
				{
					return null;
				}
				int num6 = num4 / 2;
				float[] array2 = new float[num6];
				for (int j = 0; j < num6; j++)
				{
					array2[j] = (float)BitConverter.ToInt16(array, num3 + j * 2) / 32768f;
				}
				value = AudioClip.Create("S2_" + name, num6 / num, num, num2, false);
				value.SetData(new Il2CppStructArray<float>(array2), 0);
				Borrowed.Add(((Il2CppObjectBase)value).Pointer);
				Wavs[name] = value;
				return value;
			}
			catch
			{
				return null;
			}
		}

		private static void Index()
		{
			if (_game != null && _game.Count > 50 && Time.unscaledTime - _indexedAt < 120f)
			{
				return;
			}
			_indexedAt = Time.unscaledTime;
			_game = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase);
			try
			{
				foreach (AudioClip item in Resources.FindObjectsOfTypeAll<AudioClip>())
				{
					if ((Object)(object)item != (Object)null && !string.IsNullOrEmpty(((Object)item).name) && !_game.ContainsKey(((Object)item).name) && !Borrowed.Contains(((Il2CppObjectBase)item).Pointer))
					{
						_game[((Object)item).name] = item;
					}
				}
			}
			catch
			{
			}
		}

		private static AudioClip Find(string modName)
		{
			(string, string[])[] map = Map;
			for (int i = 0; i < map.Length; i++)
			{
				var (text, array) = map[i];
				if (!modName.Equals(text, StringComparison.OrdinalIgnoreCase) && !modName.EndsWith("_" + text, StringComparison.OrdinalIgnoreCase) && (!(text == "HTF_Thunder") || !modName.StartsWith(text, StringComparison.OrdinalIgnoreCase)) && !modName.EndsWith(text, StringComparison.OrdinalIgnoreCase))
				{
					continue;
				}
				Index();
				string[] array2 = array;
				foreach (string text2 in array2)
				{
					AudioClip value;
					if (text2.StartsWith("wav:"))
					{
						AudioClip val = Wav(text2.Substring(4));
						if ((Object)(object)val != (Object)null)
						{
							return val;
						}
					}
					else if (_game.TryGetValue(text2, out value) && (Object)(object)value != (Object)null && value.length > 0.05f)
					{
						return value;
					}
				}
				return null;
			}
			return null;
		}

		public static string Has(params string[] names)
		{
			Index();
			StringBuilder stringBuilder = new StringBuilder();
			foreach (string text in names)
			{
				stringBuilder.Append(text).Append(_game.ContainsKey(text) ? " yes; " : " NO; ");
			}
			return stringBuilder.ToString();
		}

		public static void PlayGame(Vector3 at, float volume, params string[] names)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Index();
				foreach (string key in names)
				{
					if (_game.TryGetValue(key, out var value) && (Object)(object)value != (Object)null && value.length > 0.05f)
					{
						AudioSource.PlayClipAtPoint(value, at, volume);
						break;
					}
				}
			}
			catch
			{
			}
		}

		public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream)
		{
			try
			{
				AudioClip val = Find(name ?? "");
				if ((Object)(object)val != (Object)null)
				{
					Borrowed.Add(((Il2CppObjectBase)val).Pointer);
					return val;
				}
			}
			catch
			{
			}
			return AudioClip.Create(name, lengthSamples, channels, frequency, stream);
		}

		public static bool SetData(AudioClip clip, Il2CppStructArray<float> data, int offset)
		{
			if ((Object)(object)clip == (Object)null || Borrowed.Contains(((Il2CppObjectBase)clip).Pointer))
			{
				return false;
			}
			return clip.SetData(data, offset);
		}
	}
}
namespace TheInternetMod
{
	internal static class Art
	{
		private static Texture2D _fanBody;

		private static Texture2D _fanBlades;

		private static Texture2D _stalk;

		private static Texture2D _stalkCob;

		private static Texture2D _bag;

		private static Texture2D _guyOpen;

		private static Texture2D _guyShut;

		private static Texture2D _heart;

		public static Texture2D FanBody => _fanBody ?? (_fanBody = MakeFanBody());

		public static Texture2D FanBlades => _fanBlades ?? (_fanBlades = MakeBlades());

		public static Texture2D Stalk => _stalk ?? (_stalk = MakeStalk(cob: false));

		public static Texture2D StalkCob => _stalkCob ?? (_stalkCob = MakeStalk(cob: true));

		public static Texture2D Bag => _bag ?? (_bag = MakeBag());

		public static Texture2D Heart => _heart ?? (_heart = MakeHeart());

		private static Texture2D MakeFanBody()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(128, 160, Color.clear);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.82f, 0.84f, 0.86f);
			Color c = default(Color);
			((Color)(ref c))..ctor(0.35f, 0.37f, 0.4f);
			px.Rect(34f, 4f, 94f, 16f, c);
			px.Rect(58f, 14f, 70f, 52f, val);
			px.Ellipse(64f, 96f, 60f, 60f, new Color(0.25f, 0.27f, 0.3f, 0.35f));
			for (int i = 0; i < 3; i++)
			{
				float num = 60 - i * 18;
				px.Ellipse(64f, 96f, num, num, val);
				px.Ellipse(64f, 96f, num - 3f, num - 3f, new Color(0f, 0f, 0f, 0f));
			}
			Px px2 = new Px(128, 160, Color.clear);
			for (int j = 0; j < 160; j++)
			{
				for (int k = 0; k < 128; k++)
				{
					float num2 = k - 64;
					float num3 = j - 96;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					bool num5 = Mathf.Abs(num4 - 60f) < 2.5f || Mathf.Abs(num4 - 42f) < 1.5f || Mathf.Abs(num4 - 24f) < 1.5f;
					bool flag = num4 < 60f && (Mathf.Abs(num2) < 1.2f || Mathf.Abs(num3) < 1.2f || Mathf.Abs(num2 - num3) < 1.6f || Mathf.Abs(num2 + num3) < 1.6f);
					if (num5 || flag)
					{
						px2.P[j * 128 + k] = Color32.op_Implicit(val);
					}
					else if (j < 52)
					{
						px2.P[j * 128 + k] = px.P[j * 128 + k];
					}
				}
			}
			px2.Ellipse(64f, 96f, 9f, 9f, c);
			return px2.Tex();
		}

		private static Texture2D MakeBlades()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(128, 128, Color.clear);
			Color c = default(Color);
			((Color)(ref c))..ctor(0.36f, 0.66f, 0.92f);
			for (int i = 0; i < 3; i++)
			{
				px.Blade(64f, 64f, 8f, 56f, (float)i * 120f, (float)i * 120f + 70f, c);
			}
			px.Ellipse(64f, 64f, 10f, 10f, new Color(0.2f, 0.42f, 0.66f));
			return px.Tex();
		}

		private static Texture2D MakeStalk(bool cob)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(96, 192, Color.clear);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.32f, 0.62f, 0.22f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.24f, 0.5f, 0.17f);
			px.Rect(44f, 0f, 52f, 180f, val);
			for (int i = 0; i < 4; i++)
			{
				float num = 30 + i * 36;
				bool flag = i % 2 == 0;
				px.Line(48f, num, flag ? 8 : 88, num + 26f, 6f, (i % 2 == 0) ? val : val2);
			}
			px.Line(48f, 178f, 40f, 192f, 3f, new Color(0.8f, 0.7f, 0.35f));
			px.Line(48f, 178f, 56f, 192f, 3f, new Color(0.8f, 0.7f, 0.35f));
			if (cob)
			{
				px.Ellipse(62f, 104f, 11f, 26f, new Color(0.98f, 0.82f, 0.22f));
				for (int j = 84; j < 126; j += 6)
				{
					for (int k = 55; k < 70; k += 5)
					{
						px.Ellipse(k, j, 1.6f, 1.6f, new Color(0.88f, 0.66f, 0.1f));
					}
				}
				px.Line(52f, 82f, 60f, 128f, 4f, val2);
				px.Line(72f, 82f, 66f, 128f, 4f, val2);
			}
			return px.Tex();
		}

		private static Texture2D MakeBag()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(128, 128, new Color(0.96f, 0.95f, 0.93f));
			px.Rect(28f, 18f, 100f, 104f, new Color(0.86f, 0.9f, 0.94f, 0.9f));
			px.Rect(28f, 96f, 100f, 104f, new Color(0.85f, 0.2f, 0.25f));
			for (int i = 0; i < 7; i++)
			{
				float num = 46 + i * 37 % 40;
				float num2 = 34 + i * 23 % 40;
				px.Ellipse(num, num2, 13f, 10f, new Color(0.3f + (float)(i % 3) * 0.05f, 0.55f, 0.22f));
				px.Ellipse(num + 3f, num2 + 2f, 3f, 2f, new Color(0.85f, 0.55f, 0.25f));
			}
			return px.Tex();
		}

		private static Texture2D MakeHeart()
		{
			//IL_0004: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(64, 64, Color.clear);
			Color c = default(Color);
			((Color)(ref c))..ctor(0.95f, 0.25f, 0.35f);
			px.Ellipse(22f, 40f, 14f, 14f, c);
			px.Ellipse(42f, 40f, 14f, 14f, c);
			for (int i = 8; i < 40; i++)
			{
				float num = (float)(i - 8) * 0.9f;
				px.Rect(32f - num, i, 32f + num, i + 1, c);
			}
			return px.Tex();
		}

		public static Texture2D Guy(bool open)
		{
			object obj;
			if (!open)
			{
				obj = _guyShut;
				if (obj == null)
				{
					return _guyShut = MakeGuy(open: false);
				}
			}
			else
			{
				obj = _guyOpen ?? (_guyOpen = MakeGuy(open: true));
			}
			return (Texture2D)obj;
		}

		private static Texture2D MakeGuy(bool open)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			Px px = new Px(256, 256, new Color(0.14f, 0.12f, 0.2f));
			for (int i = 0; i < 9; i++)
			{
				px.Ellipse(20 + i * 30, 230 - i % 3 * 12, 7f, 7f, new Color(1f, 0.85f, 0.3f, 0.8f));
			}
			px.Rect(96f, 0f, 160f, 70f, new Color(0.85f, 0.25f, 0.3f));
			px.Rect(120f, 60f, 136f, 84f, new Color(0.95f, 0.78f, 0.6f));
			px.Ellipse(128f, 130f, 50f, 58f, new Color(0.95f, 0.78f, 0.6f));
			px.Ellipse(128f, 180f, 54f, 22f, new Color(0.35f, 0.2f, 0.1f));
			px.Ellipse(108f, 140f, 9f, 11f, Color.white);
			px.Ellipse(148f, 140f, 9f, 11f, Color.white);
			px.Ellipse(110f, 138f, 4f, 5f, Color.black);
			px.Ellipse(146f, 138f, 4f, 5f, Color.black);
			px.Line(98f, 156f, 116f, 152f, 3f, new Color(0.3f, 0.18f, 0.1f));
			px.Line(140f, 152f, 158f, 156f, 3f, new Color(0.3f, 0.18f, 0.1f));
			if (open)
			{
				px.Ellipse(128f, 100f, 16f, 20f, new Color(0.35f, 0.05f, 0.08f));
				px.Ellipse(128f, 92f, 9f, 6f, new Color(0.9f, 0.4f, 0.45f));
			}
			else
			{
				px.Line(112f, 104f, 144f, 104f, 4f, new Color(0.45f, 0.15f, 0.15f));
			}
			px.Rect(196f, 20f, 206f, 120f, new Color(0.25f, 0.25f, 0.28f));
			px.Ellipse(201f, 128f, 12f, 15f, new Color(0.15f, 0.15f, 0.17f));
			return px.Tex();
		}

		public static Texture2D Face(int seed)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			Random r = new Random(seed);
			Px px = new Px(256, 256, new Color(0.93f, 0.94f, 0.97f));
			Color val = Color.HSVToRGB(F(0.02f, 0.13f), F(0.25f, 0.65f), F(0.45f, 0.98f));
			if (r.Next(6) == 0)
			{
				val = Color.HSVToRGB(F(0.2f, 0.35f), F(0.2f, 0.45f), F(0.6f, 0.9f));
			}
			float num = F(52f, 92f);
			float num2 = F(70f, 108f);
			float num3 = 128f + F(-8f, 8f);
			float num4 = 120f;
			px.Ellipse(num3, num4, num, num2, val);
			if (r.Next(2) == 0)
			{
				px.Ellipse(num3 - num, num4, F(10f, 26f), F(16f, 30f), val);
				px.Ellipse(num3 + num, num4 + F(-10f, 10f), F(10f, 26f), F(16f, 30f), val);
			}
			Color c = Color.HSVToRGB(F(0f, 0.12f), F(0.3f, 0.9f), F(0.1f, 0.6f));
			int num5 = r.Next(4);
			if (num5 == 0)
			{
				px.Ellipse(num3, num4 + num2 * 0.75f, num * 0.9f, num2 * 0.35f, c);
			}
			if (num5 == 1)
			{
				for (int i = 0; i < 12; i++)
				{
					px.Line(num3 - num * 0.6f + (float)i * num * 0.11f, num4 + num2 * 0.8f, num3 - num * 0.6f + (float)i * num * 0.11f + F(-14f, 14f), num4 + num2 + F(6f, 30f), 4f, c);
				}
			}
			if (num5 == 2)
			{
				px.Ellipse(num3 + F(-20f, 20f), num4 + num2 * 0.9f, F(14f, 30f), F(10f, 22f), c);
			}
			float num6 = num4 + F(5f, 30f);
			float num7 = F(16f, 40f);
			float num8 = F(6f, 22f);
			float num9 = F(6f, 22f);
			px.Ellipse(num3 - num7, num6 + F(-6f, 6f), num8, num8 * F(0.6f, 1.3f), Color.white);
			px.Ellipse(num3 + num7, num6 + F(-8f, 8f), num9, num9 * F(0.6f, 1.3f), Color.white);
			px.Ellipse(num3 - num7 + F(-4f, 4f), num6 + F(-3f, 3f), num8 * 0.45f, num8 * 0.45f, Color.black);
			px.Ellipse(num3 + num7 + F(-4f, 4f), num6 + F(-3f, 3f), num9 * 0.45f, num9 * 0.45f, Color.black);
			if (r.Next(3) == 0)
			{
				px.Line(num3 - num7 - num8, num6 + num8 + 6f, num3 + num7 + num9, num6 + num9 + 6f, 6f, c);
			}
			Color c2 = default(Color);
			((Color)(ref c2))..ctor(val.r * 0.85f, val.g * 0.7f, val.b * 0.7f);
			px.Ellipse(num3 + F(-6f, 6f), num6 - F(18f, 34f), F(7f, 22f), F(9f, 24f), c2);
			float num10 = num4 - num2 * F(0.35f, 0.6f);
			float num11 = F(14f, 42f);
			if (r.Next(2) == 0)
			{
				px.Ellipse(num3, num10, num11, F(4f, 14f), new Color(0.45f, 0.12f, 0.15f));
			}
			else
			{
				px.Line(num3 - num11, num10 + F(-8f, 8f), num3 + num11, num10 + F(-8f, 8f), 5f, new Color(0.45f, 0.12f, 0.15f));
			}
			if (r.Next(2) == 0)
			{
				px.Rect(num3 - 6f, num10 - 2f, num3 + 2f, num10 + 6f, Color.white);
			}
			for (int num12 = r.Next(4); num12 > 0; num12--)
			{
				px.Ellipse(num3 + F((0f - num) * 0.7f, num * 0.7f), num4 + F((0f - num2) * 0.6f, num2 * 0.3f), F(3f, 6f), F(3f, 6f), new Color(0.45f, 0.3f, 0.2f));
			}
			return px.Tex();
			float F(float a, float b)
			{
				return a + (float)r.NextDouble() * (b - a);
			}
		}
	}
	internal static class Browser
	{
		private sealed class Site
		{
			public string Name;

			public string Url;

			public string Tag;

			public Color Bg;

			public Color Fg;
		}

		public static bool Open;

		private static int _site = -1;

		private static float _openedAt;

		private static readonly Site[] Sites = new Site[6]
		{
			new Site
			{
				Name = "OnlyFans",
				Url = "www.onlyfans.lol",
				Tag = "Exclusive fan content. Six fans. All of them spin.",
				Bg = new Color(0.16f, 0.62f, 0.9f),
				Fg = Color.white
			},
			new Site
			{
				Name = "Corn Hub",
				Url = "www.cornhub.farm",
				Tag = "The internet's biggest corn field. Pluck responsibly.",
				Bg = new Color(0.98f, 0.76f, 0.12f),
				Fg = new Color(0.1f, 0.25f, 0.08f)
			},
			new Site
			{
				Name = "Instagrams",
				Url = "www.instagrams.weed",
				Tag = "Tap a gram. Watch the number go up. #blessed",
				Bg = new Color(0.82f, 0.25f, 0.55f),
				Fg = Color.white
			},
			new Site
			{
				Name = "YouTune",
				Url = "www.youtune.tv",
				Tag = "One guy. One song. Millions of views. Probably.",
				Bg = new Color(0.86f, 0.12f, 0.12f),
				Fg = Color.white
			},
			new Site
			{
				Name = "FaceFuck",
				Url = "www.facefuck.com",
				Tag = "Rate faces only a mother could love.",
				Bg = new Color(0.24f, 0.36f, 0.66f),
				Fg = Color.white
			},
			new Site
			{
				Name = "NEWS",
				Url = "www.news.hp",
				Tag = "BREAKING: The world can now be ended with one button.",
				Bg = new Color(0.12f, 0.12f, 0.14f),
				Fg = new Color(1f, 0.3f, 0.25f)
			}
		};

		private static readonly bool[] FanOn = new bool[6];

		private static readonly float[] FanSpeed = new float[6];

		private static readonly float[] FanAngle = new float[6];

		private static readonly string[] FanNames = new string[6] { "@BreezyBetty", "@TurboTina", "@ChillWillie", "@DraftyDan", "@GustyGus", "@OscillatingOlga" };

		private static readonly float[] CornBack = new float[18];

		public static int Corn;

		public static int Grams;

		public static int Rated;

		private static float _starSum;

		private static readonly float[] HeartAt = new float[9];

		private static int _face = 1;

		private static Texture2D _faceTex;

		private static string _faceName = "";

		private static float _endAt = -1f;

		private static readonly string[] First = new string[14]
		{
			"Gary", "Brenda", "Dwayne", "Lorna", "Kevin", "Mildred", "Chad", "Doreen", "Todd", "Bev",
			"Rusty", "Gail", "Wendell", "Pam"
		};

		private static readonly string[] Last = new string[10] { "Nubbins", "Crumb", "Wartley", "Snodgrass", "Pickle", "Gristle", "Bunyan", "Moldoon", "Fumble", "Slackjaw" };

		private static bool _killed;

		private static bool _deadWatch;

		public static void Show()
		{
			if (!Open)
			{
				Open = true;
				_site = -1;
				_openedAt = Time.unscaledTime;
				FortifyApi.OpenMenu("net_desk");
			}
		}

		public static void Close()
		{
			if (Open)
			{
				Open = false;
				Tune.Play(on: false);
				FortifyApi.CloseMenu("net_desk");
			}
		}

		public static void Update()
		{
			if (_endAt > 0f)
			{
				EndTick();
			}
			if (_deadWatch)
			{
				DeadMouse();
			}
			if (!Open)
			{
				return;
			}
			if (Time.unscaledTime - _openedAt > 0.2f && FortifyApi.KeyDown((KeyCode)27))
			{
				if (_site >= 0)
				{
					Go(-1);
				}
				else
				{
					Close();
				}
				return;
			}
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			for (int i = 0; i < 6; i++)
			{
				FanSpeed[i] = Mathf.MoveTowards(FanSpeed[i], FanOn[i] ? (900f + (float)i * 90f) : 0f, unscaledDeltaTime * 600f);
				FanAngle[i] = (FanAngle[i] + FanSpeed[i] * unscaledDeltaTime) % 360f;
			}
			Tune.Play(_site == 3);
		}

		private static void Go(int site)
		{
			_site = site;
			if (site == 4 && (Object)(object)_faceTex == (Object)null)
			{
				NextFace();
			}
		}

		public static void Draw()
		{
			//IL_0083: 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_00a6: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			if (_endAt > 0f)
			{
				DrawEnd();
			}
			else
			{
				if (!Open)
				{
					return;
				}
				float num = Mathf.Min((float)Screen.width * 0.86f, 1400f);
				float num2 = Mathf.Min((float)Screen.height * 0.86f, 860f);
				Rect r = default(Rect);
				((Rect)(ref r))..ctor(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2);
				FortifyApi.UiFill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0f, 0f, 0f, 0.45f));
				FortifyApi.UiFill(r, new Color(0.93f, 0.93f, 0.95f));
				Rect r2 = default(Rect);
				((Rect)(ref r2))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y, num, 48f);
				FortifyApi.UiFill(r2, new Color(0.2f, 0.21f, 0.24f));
				if (FortifyApi.UiButton(new Rect(((Rect)(ref r2)).x + 10f, ((Rect)(ref r2)).y + 8f, 40f, 32f), "<", _site >= 0))
				{
					Go(-1);
				}
				if (FortifyApi.UiButton(new Rect(((Rect)(ref r2)).x + 56f, ((Rect)(ref r2)).y + 8f, 72f, 32f), "Home"))
				{
					Go(-1);
				}
				Rect r3 = default(Rect);
				((Rect)(ref r3))..ctor(((Rect)(ref r2)).x + 140f, ((Rect)(ref r2)).y + 9f, num - 260f, 30f);
				FortifyApi.UiFill(r3, new Color(0.97f, 0.97f, 0.98f));
				FortifyApi.UiText(new Rect(((Rect)(ref r3)).x + 12f, ((Rect)(ref r3)).y, ((Rect)(ref r3)).width - 20f, ((Rect)(ref r3)).height), (_site < 0) ? "home.theinternet" : Sites[_site].Url, 15, new Color(0.25f, 0.25f, 0.3f), (TextAnchor)3, bold: false);
				if (FortifyApi.UiButton(new Rect(((Rect)(ref r2)).xMax - 108f, ((Rect)(ref r2)).y + 8f, 98f, 32f), "Close (Esc)"))
				{
					Close();
					return;
				}
				Rect page = default(Rect);
				((Rect)(ref page))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 48f, num, num2 - 48f);
				switch (_site)
				{
				case -1:
					Home(page);
					break;
				case 0:
					OnlyFans(page);
					break;
				case 1:
					CornHub(page);
					break;
				case 2:
					Instagrams(page);
					break;
				case 3:
					YouTune(page);
					break;
				case 4:
					FaceFuck(page);
					break;
				case 5:
					News(page);
					break;
				}
			}
		}

		private static void Header(Rect page, Site s, string right = null)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref page)).x, ((Rect)(ref page)).y, ((Rect)(ref page)).width, 64f);
			FortifyApi.UiFill(r, s.Bg);
			FortifyApi.UiText(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y, 420f, ((Rect)(ref r)).height), s.Name, 34, s.Fg, (TextAnchor)3);
			if (right != null)
			{
				FortifyApi.UiText(new Rect(((Rect)(ref r)).xMax - 520f, ((Rect)(ref r)).y, 496f, ((Rect)(ref r)).height), right, 17, s.Fg, (TextAnchor)5);
			}
		}

		private static void Home(Rect page)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x, ((Rect)(ref page)).y + 18f, ((Rect)(ref page)).width, 50f), "The Internet", 38, new Color(0.18f, 0.2f, 0.25f), (TextAnchor)4);
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x, ((Rect)(ref page)).y + 62f, ((Rect)(ref page)).width, 26f), "Everything worth seeing. Six things, to be exact.", 16, new Color(0.4f, 0.42f, 0.48f), (TextAnchor)4, bold: false);
			float num = Mathf.Min(((Rect)(ref page)).width - 80f, 1100f);
			float num2 = (num - 40f) / 3f;
			float num3 = (((Rect)(ref page)).height - 160f) / 2f;
			float num4 = ((Rect)(ref page)).x + (((Rect)(ref page)).width - num) / 2f;
			float num5 = ((Rect)(ref page)).y + 110f;
			Rect r = default(Rect);
			for (int i = 0; i < 6; i++)
			{
				Site site = Sites[i];
				((Rect)(ref r))..ctor(num4 + (float)(i % 3) * (num2 + 20f), num5 + (float)(i / 3) * (num3 + 20f), num2, num3);
				bool flag = S2_NET.WoodKit.Ui.Hover(r);
				FortifyApi.UiFill(r, flag ? Color.Lerp(site.Bg, Color.white, 0.12f) : site.Bg);
				FortifyApi.UiText(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.18f, ((Rect)(ref r)).width, ((Rect)(ref r)).height * 0.4f), site.Name, 40, site.Fg, (TextAnchor)4);
				FortifyApi.UiText(new Rect(((Rect)(ref r)).x + 16f, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.6f, ((Rect)(ref r)).width - 32f, ((Rect)(ref r)).height * 0.3f), site.Tag, 15, site.Fg, (TextAnchor)1, bold: false);
				if (S2_NET.WoodKit.Ui.Click(r))
				{
					Go(i);
				}
			}
		}

		private static void OnlyFans(Rect page)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			bool[] fanOn = FanOn;
			for (int i = 0; i < fanOn.Length; i++)
			{
				if (fanOn[i])
				{
					num++;
				}
			}
			Header(page, Sites[0], num + " of 6 fans spinning for you");
			float num2 = (((Rect)(ref page)).width - 80f) / 3f;
			float num3 = (((Rect)(ref page)).height - 64f - 60f) / 2f;
			Rect r = default(Rect);
			Rect r2 = default(Rect);
			for (int j = 0; j < 6; j++)
			{
				((Rect)(ref r))..ctor(((Rect)(ref page)).x + 20f + (float)(j % 3) * (num2 + 20f), ((Rect)(ref page)).y + 84f + (float)(j / 3) * (num3 + 20f), num2, num3);
				FortifyApi.UiFill(r, Color.white);
				float num4 = Mathf.Min(((Rect)(ref r)).width * 0.5f, ((Rect)(ref r)).height - 70f);
				((Rect)(ref r2))..ctor(((Rect)(ref r)).center.x - num4 * 0.4f, ((Rect)(ref r)).y + 12f, num4 * 0.8f, num4);
				Px.Draw(new Rect(((Rect)(ref r2)).x + ((Rect)(ref r2)).width * 0.5f - num4 * 0.33f, ((Rect)(ref r2)).y + num4 * 0.025f, num4 * 0.66f, num4 * 0.66f), Art.FanBlades, FanAngle[j]);
				Px.Draw(r2, Art.FanBody);
				FortifyApi.UiText(new Rect(((Rect)(ref r)).x + 14f, ((Rect)(ref r)).yMax - 54f, ((Rect)(ref r)).width * 0.55f, 40f), FanNames[j], 16, new Color(0.2f, 0.22f, 0.28f), (TextAnchor)3);
				if (FortifyApi.UiButton(new Rect(((Rect)(ref r)).xMax - 150f, ((Rect)(ref r)).yMax - 52f, 136f, 38f), FanOn[j] ? "Unsubscribe" : "Subscribe", enabled: true, FanOn[j], 15))
				{
					FanOn[j] = !FanOn[j];
				}
			}
		}

		private static void CornHub(Rect page)
		{
			//IL_0000: 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_005d: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			Header(page, Sites[1], "Corn plucked: " + Corn);
			FortifyApi.UiFill(new Rect(((Rect)(ref page)).x, ((Rect)(ref page)).y + 64f, ((Rect)(ref page)).width, ((Rect)(ref page)).height - 64f), new Color(0.55f, 0.75f, 0.95f));
			FortifyApi.UiFill(new Rect(((Rect)(ref page)).x, ((Rect)(ref page)).yMax - 120f, ((Rect)(ref page)).width, 120f), new Color(0.45f, 0.32f, 0.18f));
			float num = ((Rect)(ref page)).width / 9.75f;
			float num2 = (((Rect)(ref page)).height - 120f) / 2f;
			Rect r = default(Rect);
			for (int i = 0; i < 18; i++)
			{
				((Rect)(ref r))..ctor(((Rect)(ref page)).x + num * 0.1f + (float)(i % 9) * num + (float)(i / 9) * num * 0.5f, ((Rect)(ref page)).y + 70f + (float)(i / 9) * num2 * 0.6f, num, num2 * 1.15f);
				bool flag = Time.unscaledTime >= CornBack[i];
				Px.Draw(r, flag ? Art.StalkCob : Art.Stalk);
				if (flag && S2_NET.WoodKit.Ui.Click(r))
				{
					CornBack[i] = Time.unscaledTime + 20f;
					Corn++;
				}
			}
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x, ((Rect)(ref page)).yMax - 40f, ((Rect)(ref page)).width, 30f), "Click a cob to pluck it. They grow back in 20 seconds. Categories: Sweet  Popcorn  Candy  On the cob", 15, Color.white, (TextAnchor)4, bold: false);
		}

		private static void Instagrams(Rect page)
		{
			//IL_0000: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			Header(page, Sites[2], Grams + " gram" + ((Grams == 1) ? "" : "s") + "   " + Grams / 28 + " oz");
			float num = Mathf.Min((((Rect)(ref page)).width - 120f) / 3f, (((Rect)(ref page)).height - 64f - 60f) / 3f);
			float num2 = ((Rect)(ref page)).x + (((Rect)(ref page)).width - num * 3f - 40f) / 2f;
			Rect r = default(Rect);
			for (int i = 0; i < 9; i++)
			{
				((Rect)(ref r))..ctor(num2 + (float)(i % 3) * (num + 20f), ((Rect)(ref page)).y + 84f + (float)(i / 3) * (num + 10f), num, num);
				Px.Draw(r, Art.Bag);
				FortifyApi.UiText(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 34f, ((Rect)(ref r)).width, 30f), "1g  #" + i switch
				{
					8 => "gassy", 
					4 => "loud", 
					0 => "blessed", 
					_ => "dank", 
				}, 14, new Color(0.25f, 0.25f, 0.3f), (TextAnchor)4, bold: false);
				float num3 = Time.unscaledTime - HeartAt[i];
				if (num3 < 0.6f)
				{
					float num4 = num * (0.35f + num3 * 0.4f);
					Px.Draw(new Rect(((Rect)(ref r)).center.x - num4 / 2f, ((Rect)(ref r)).center.y - num4 / 2f - num3 * 30f, num4, num4), Art.Heart);
				}
				if (S2_NET.WoodKit.Ui.Click(r))
				{
					Grams++;
					HeartAt[i] = Time.unscaledTime;
				}
			}
		}

		private static void YouTune(Rect page)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			Header(page, Sites[3]);
			float num = Mathf.Min(((Rect)(ref page)).width - 80f, (((Rect)(ref page)).height - 200f) * 16f / 9f);
			float num2 = num * 9f / 16f;
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref page)).x + (((Rect)(ref page)).width - num) / 2f, ((Rect)(ref page)).y + 80f, num, num2);
			FortifyApi.UiFill(r, Color.black);
			float num3 = Tune.Mouth();
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref r)).center.x - num2 / 2f, ((Rect)(ref r)).y, num2, num2);
			Px.Draw(r2, Art.Guy(num3 > 0.35f));
			if (!Tune.Muted && num3 > 0.3f)
			{
				FortifyApi.UiText(new Rect(((Rect)(ref r2)).xMax - 20f, ((Rect)(ref r2)).y + num2 * 0.2f, 80f, 40f), "la", 26 + (int)(num3 * 10f), new Color(1f, 0.9f, 0.4f), (TextAnchor)4);
			}
			FortifyApi.UiText(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax + 6f, ((Rect)(ref r)).width * 0.7f, 30f), "Guy Sings A Song About Nothing (Official Video)", 19, new Color(0.12f, 0.12f, 0.14f), (TextAnchor)3);
			FortifyApi.UiText(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax + 34f, ((Rect)(ref r)).width * 0.6f, 24f), "4,206,969 views   uploaded 3 hours ago   12 comments, all \"first\"", 14, new Color(0.4f, 0.4f, 0.45f), (TextAnchor)3, bold: false);
			if (FortifyApi.UiButton(new Rect(((Rect)(ref r)).xMax - 150f, ((Rect)(ref r)).yMax + 10f, 150f, 40f), Tune.Muted ? "Unmute" : "Mute him", enabled: true, Tune.Muted, 16))
			{
				Tune.Muted = !Tune.Muted;
			}
		}

		private static void NextFace()
		{
			_face = Random.Range(1, 1000000);
			if ((Object)(object)_faceTex != (Object)null)
			{
				Object.Destroy((Object)(object)_faceTex);
			}
			_faceTex = Art.Face(_face);
			Random random = new Random(_face);
			_faceName = First[random.Next(First.Length)] + " " + Last[random.Next(Last.Length)] + ", " + random.Next(19, 71) + ", Hyland Point";
		}

		private static void FaceFuck(Rect page)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			Header(page, Sites[4], (Rated > 0) ? ("You've rated " + Rated + " face" + ((Rated == 1) ? "" : "s") + ", average " + (_starSum / (float)Rated).ToString("0.0") + " stars") : "Be honest. They can't see you.");
			float num = Mathf.Min(((Rect)(ref page)).height - 64f - 150f, ((Rect)(ref page)).width * 0.45f);
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref page)).center.x - num / 2f - 20f, ((Rect)(ref page)).y + 80f, num + 40f, num + 120f);
			FortifyApi.UiFill(r, Color.white);
			Px.Draw(new Rect(((Rect)(ref r)).x + 20f, ((Rect)(ref r)).y + 20f, num, num), _faceTex);
			FortifyApi.UiText(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + num + 24f, ((Rect)(ref r)).width, 28f), _faceName, 17, new Color(0.18f, 0.2f, 0.28f), (TextAnchor)4);
			float num2 = 64f;
			float num3 = 8f;
			float num4 = ((Rect)(ref r)).center.x - (5f * num2 + 4f * num3) / 2f;
			for (int i = 1; i <= 5; i++)
			{
				if (FortifyApi.UiButton(new Rect(num4 + (float)(i - 1) * (num2 + num3), ((Rect)(ref r)).y + num + 60f, num2, 40f), i + " star" + ((i == 1) ? "" : "s"), enabled: true, selected: false, 13))
				{
					Rated++;
					_starSum += i;
					NextFace();
				}
			}
		}

		private static void News(Rect page)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			Header(page, Sites[5], DateTime.Now.ToString("dddd") + " edition");
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x + 40f, ((Rect)(ref page)).y + 90f, ((Rect)(ref page)).width - 80f, 70f), "SCIENTISTS: THE WORLD CAN NOW BE ENDED WITH ONE BUTTON", 34, new Color(0.1f, 0.1f, 0.12f), (TextAnchor)4);
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x + 80f, ((Rect)(ref page)).y + 170f, ((Rect)(ref page)).width - 160f, 80f), "Officials confirmed Tuesday that a large red button labeled END THE WORLD has been placed on this website \"for transparency.\" Experts urge residents not to press it. Residents have been pressing it.", 17, new Color(0.3f, 0.3f, 0.34f), (TextAnchor)1, bold: false);
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref page)).center.x - 180f, ((Rect)(ref page)).y + 290f, 360f, 110f);
			bool flag = S2_NET.WoodKit.Ui.Hover(r);
			FortifyApi.UiFill(new Rect(((Rect)(ref r)).x - 6f, ((Rect)(ref r)).y - 6f, ((Rect)(ref r)).width + 12f, ((Rect)(ref r)).height + 12f), new Color(0.35f, 0.02f, 0.02f));
			FortifyApi.UiFill(r, flag ? new Color(1f, 0.15f, 0.1f) : new Color(0.85f, 0.05f, 0.05f));
			FortifyApi.UiText(r, "END THE WORLD", 34, Color.white, (TextAnchor)4);
			FortifyApi.UiText(new Rect(((Rect)(ref page)).x, ((Rect)(ref r)).yMax + 20f, ((Rect)(ref page)).width, 26f), "(You will die and have to load your last save.)", 14, new Color(0.45f, 0.45f, 0.5f), (TextAnchor)4, bold: false);
			if (S2_NET.WoodKit.Ui.Click(r))
			{
				Close();
				_endAt = Time.unscaledTime;
				Instance log = TheInternetCore.Log;
				if (log != null)
				{
					log.Msg("The Internet: someone pressed END THE WORLD.");
				}
			}
		}

		private static void EndTick()
		{
			float num = Time.unscaledTime - _endAt;
			if (!_killed && num > 1.6f)
			{
				_killed = true;
				_deadWatch = true;
				try
				{
					Player local = Player.Local;
					if ((Object)(object)local != (Object)null)
					{
						local.Health.TakeDamage(99999f, false, false);
					}
				}
				catch (Exception ex)
				{
					Instance log = TheInternetCore.Log;
					if (log != null)
					{
						log.Warning("END THE WORLD: " + ex.Message);
					}
				}
			}
			if (num > 3.2f)
			{
				_endAt = -1f;
				_killed = false;
			}
		}

		private static void DeadMouse()
		{
			bool flag = false;
			try
			{
				Player local = Player.Local;
				flag = (Object)(object)local != (Object)null && !local.Health.IsAlive;
			}
			catch
			{
			}
			if (!flag)
			{
				if (_endAt < 0f)
				{
					_deadWatch = false;
				}
			}
			else
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		private static void DrawEnd()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			float num = Time.unscaledTime - _endAt;
			float num2 = ((num < 0.25f) ? (num / 0.25f) : ((num > 2.6f) ? Mathf.Clamp01((3.2f - num) / 0.6f) : 1f));
			FortifyApi.UiFill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(1f, 1f, 1f, num2));
			FortifyApi.UiText(new Rect(0f, (float)Screen.height * 0.42f, (float)Screen.width, 80f), "THE WORLD HAS ENDED", 48, new Color(0.1f, 0.1f, 0.1f, num2), (TextAnchor)4);
		}

		internal static string DevEnd()
		{
			Close();
			_endAt = Time.unscaledTime;
			return "ending";
		}

		public static void Reset()
		{
			if (Open)
			{
				Close();
			}
			_endAt = -1f;
			_killed = false;
			_deadWatch = false;
			Tune.Reset();
		}
	}
	internal sealed class Px
	{
		public readonly int W;

		public readonly int H;

		public readonly Color32[] P;

		private static readonly Dictionary<IntPtr, GUIStyle> Styles = new Dictionary<IntPtr, GUIStyle>();

		public Px(int w, int h, Color bg)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			W = w;
			H = h;
			P = (Color32[])(object)new Color32[w * h];
			Color32 val = Color32.op_Implicit(bg);
			for (int i = 0; i < P.Length; i++)
			{
				P[i] = val;
			}
		}

		public void Dot(int x, int y, Color c)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (x >= 0 && y >= 0 && x < W && y < H)
			{
				if (c.a >= 0.99f)
				{
					P[y * W + x] = Color32.op_Implicit(c);
					return;
				}
				Color val = Color32.op_Implicit(P[y * W + x]);
				P[y * W + x] = Color32.op_Implicit(Color.Lerp(val, new Color(c.r, c.g, c.b, Mathf.Max(val.a, c.a)), c.a));
			}
		}

		public void Ellipse(float cx, float cy, float rx, float ry, Color c)
		{
			//IL_0062: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			for (int i = Mathf.Max(0, (int)(cy - ry - 1f)); i <= Mathf.Min(H - 1, (int)(cy + ry + 1f)); i++)
			{
				for (int j = Mathf.Max(0, (int)(cx - rx - 1f)); j <= Mathf.Min(W - 1, (int)(cx + rx + 1f)); j++)
				{
					float num = ((float)j + 0.5f - cx) / rx;
					float num2 = ((float)i + 0.5f - cy) / ry;
					float num3 = num * num + num2 * num2;
					if (num3 <= 1f)
					{
						Dot(j, i, (Color)((num3 > 0.9f) ? new Color(c.r, c.g, c.b, c.a * Mathf.Clamp01((1f - num3) * 10f)) : c));
					}
				}
			}
		}

		public void Rect(float x0, float y0, float x1, float y1, Color c)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			for (int i = Mathf.Max(0, (int)y0); i < Mathf.Min(H, (int)y1); i++)
			{
				for (int j = Mathf.Max(0, (int)x0); j < Mathf.Min(W, (int)x1); j++)
				{
					Dot(j, i, c);
				}
			}
		}

		public void Line(float x0, float y0, float x1, float y1, float th, Color c)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(1f, Vector2.Distance(new Vector2(x0, y0), new Vector2(x1, y1)));
			for (float num2 = 0f; num2 <= num; num2 += 0.5f)
			{
				float num3 = num2 / num;
				Ellipse(Mathf.Lerp(x0, x1, num3), Mathf.Lerp(y0, y1, num3), th / 2f, th / 2f, c);
			}
		}

		public void Blade(float cx, float cy, float r0, float r1, float a0, float a1, Color c)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			for (int i = Mathf.Max(0, (int)(cy - r1)); i <= Mathf.Min(H - 1, (int)(cy + r1)); i++)
			{
				for (int j = Mathf.Max(0, (int)(cx - r1)); j <= Mathf.Min(W - 1, (int)(cx + r1)); j++)
				{
					float num = (float)j + 0.5f - cx;
					float num2 = (float)i + 0.5f - cy;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					if (!(num3 < r0) && !(num3 > r1))
					{
						float num4 = Mathf.Atan2(num2, num) * 57.29578f;
						if (num4 < 0f)
						{
							num4 += 360f;
						}
						float num5 = (a1 - a0) * (0.55f + 0.45f * (num3 - r0) / (r1 - r0));
						float num6 = (a0 + a1) * 0.5f;
						if (Mathf.Abs(Mathf.DeltaAngle(num4, num6)) <= num5 / 2f)
						{
							Dot(j, i, c);
						}
					}
				}
			}
		}

		public Texture2D Tex()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			Texture2D val = new Texture2D(W, H, (TextureFormat)4, false);
			val.SetPixels32(new Il2CppStructArray<Color32>(P));
			val.Apply();
			((Object)val).hideFlags = (HideFlags)32;
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		public static void Draw(Rect r, Texture2D t, float angle = 0f)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)t == (Object)null))
			{
				if (!Styles.TryGetValue(((Il2CppObjectBase)t).Pointer, out var value) || value == null)
				{
					value = new GUIStyle();
					value.normal.background = t;
					Styles[((Il2CppObjectBase)t).Pointer] = value;
				}
				if (angle != 0f)
				{
					Matrix4x4 matrix = GUI.matrix;
					GUIUtility.RotateAroundPivot(angle, ((Rect)(ref r)).center);
					GUI.Label(r, "", value);
					GUI.matrix = matrix;
				}
				else
				{
					GUI.Label(r, "", value);
				}
			}
		}
	}
	public sealed class TheInternetCore : MelonMod
	{
		internal const string DeskId = "net_desk";

		internal static Instance Log;

		private static MelonPreferences_Entry<float> _price;

		private static GameObject _devDesk;

		public override void OnInitializeMelon()
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			Log = ((MelonBase)this).LoggerInstance;
			try
			{
				Host.Init((MelonMod)(object)this, "TheInternet", "The Internet", "net_", null, Loaded, Unloaded);
				_price = (MelonPreferences.GetCategory("TheInternet") ?? MelonPreferences.CreateCategory("TheInternet", "The Internet")).CreateEntry<float>("PriceMultiplier", 1f, "Price multiplier", "Multiplies the computer desk's price (1 = $5,000, 0 = free).", false, false, (ValueValidator)null, (string)null);
				Kit.PriceMultiplier = () => _price?.Value ?? 1f;
				FortifyApi.SetNotifyIcon("net_desk");
				Catalog.Add(new ItemSpec
				{
					Id = "net_desk",
					Name = "Computer Desk",
					Kind = PlaceKind.Ground,
					Price = 5000f,
					RotateStep = 90f,
					StackLimit = 1,
					IconColor = new Color(0.2f, 0.45f, 0.75f),
					BuildModel = Desk.Build,
					FitLift = 0f,
					Description = "A desk with a computer on it, connected to The Internet: OnlyFans, Corn Hub, Instagrams, YouTune, FaceFuck and NEWS. Walk up and press E to browse."
				});
				Kit.Use["net_desk"] = Use;
				Kit.Busy = () => Browser.Open;
				Host.Ok = true;
				((MelonBase)this).LoggerInstance.Msg("The Internet loaded. The Computer Desk is for sale at Dan's Hardware and Handy Hank's Hardware.");
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Error("The Internet couldn't start: " + ex.Message + ". It needs MelonLoader 0.7 and S1API (Bars fork) 3.2.3 or newer.");
			}
		}

		private static bool Use(Placement.Placed p, RaycastHit hit, out string hint)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			hint = $"[{FortifyApi.UseKey}] Use computer    [Hold RMB] Pick up";
			if (FortifyApi.KeyDown(FortifyApi.UseKey))
			{
				Browser.Show();
			}
			return true;
		}

		internal static string DevPlaceUp(string up)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			string result = DevPlace();
			try
			{
				if ((Object)(object)_devDesk != (Object)null)
				{
					Transform transform = _devDesk.transform;
					transform.position += Vector3.up * float.Parse(up, CultureInfo.InvariantCulture);
				}
			}
			catch
			{
			}
			return result;
		}

		internal static string DevPlace()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Player local = Player.Local;
				float num = Mathf.Round(((Component)Camera.main).transform.eulerAngles.y / 90f) * 90f;
				Quaternion val = Quaternion.Euler(0f, num, 0f);
				Vector3 pos = ((Component)local).transform.position + val * Vector3.forward * 1.7f;
				ItemSpec spec = null;
				foreach (ItemSpec item in Catalog.Items)
				{
					if (item.Id == "net_desk")
					{
						spec = item;
					}
				}
				_devDesk = Placement.PlaceFree(spec, pos, val)?.Go;
				return "placed at " + ((Vector3)(ref pos)).ToString("F2") + " yaw " + num;
			}
			catch (Exception ex)
			{
				return ex.Message;
			}
		}

		internal static string DevShot(string name, string side)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00cd: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			try
			{
				if ((Object)(object)_devDesk == (Object)null)
				{
					return "no desk";
				}
				Transform transform = _devDesk.transform;
				float num = ((side == "r") ? 1.5f : (-1.5f));
				GameObject val = new GameObject("net_devcam");
				Camera val2 = val.AddComponent<Camera>();
				val2.fieldOfView = 55f;
				val2.nearClipPlane = 0.05f;
				val.transform.position = transform.position + transform.rotation * new Vector3(num, 1.55f, -2.1f);
				val.transform.LookAt(transform.position + Vector3.up * 0.85f);
				RenderTexture val3 = (val2.targetTexture = new RenderTexture(1920, 1080, 24));
				val2.Render();
				RenderTexture.active = val3;
				Texture2D val5 = new Texture2D(1920, 1080, (TextureFormat)3, false);
				val5.ReadPixels(new Rect(0f, 0f, 1920f, 1080f), 0, 0);
				val5.Apply();
				RenderTexture.active = null;
				val2.targetTexture = null;
				Object.Destroy((Object)val);
				val3.Release();
				string text = Path.Combine(MelonEnvironment.UserDataDirectory, "Shots");
				Directory.CreateDirectory(text);
				File.WriteAllBytes(Path.Combine(text, name + ".png"), Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)ImageConversion.EncodeToPNG(val5)));
				return "shot " + name;
			}
			catch (Exception ex)
			{
				return ex.Message;
			}
		}

		private static void NativeHint(string text)
		{
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(text))
			{
				return;
			}
			List<(string, string)> list = new List<(string, string)>();
			string[] array = text.Split(new string[1] { "    " }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < array.Length; i++)
			{
				string text2 = array[i].Trim();
				if (text2.StartsWith("[") && text2.IndexOf(']') > 0)
				{
					list.Add((text2.Substring(1, text2.IndexOf(']') - 1), text2.Substring(text2.IndexOf(']') + 1).Trim()));
				}
				else
				{
					list.Add(("", text2));
				}
			}
			float num = (float)Screen.height * 0.585f;
			Rect r2 = default(Rect);
			foreach (var item3 in list)
			{
				string item = item3.Item1;
				string item2 = item3.Item2;
				bool flag = item.Length > 1;
				float num2 = (flag ? (10f + (float)item.Length * 8.5f) : 26f);
				float num3 = 26f;
				float num4 = 12f * (float)item2.Length + 10f;
				float num5 = (float)Screen.width * 0.5f - (num2 + 10f + num4) * 0.5f;
				if (item.Length > 0)
				{
					Rect r = new Rect(num5, num, num2, num3);
					S2_NET.FybCommon.Ui.Fill(r, new Color(0.22f, 0.22f, 0.24f, 0.92f));
					S2_NET.FybCommon.Ui.Frame(r, new Color(0.75f, 0.75f, 0.78f, 0.9f), 1f);
					S2_NET.FybCommon.Ui.Text(r, item, flag ? 13 : 16, Color.white, (TextAnchor)4, bold: true, wrap: false);
					num5 += num2 + 10f;
				}
				((Rect)(ref r2))..ctor(num5 + 1f, num + 1f, num4, num3);
				S2_NET.FybCommon.Ui.Text(r2, item2, 21, new Color(0f, 0f, 0f, 0.6f), (TextAnchor)3, bold: true, wrap: false);
				((Rect)(ref r2)).x = ((Rect)(ref r2)).x - 1f;
				((Rect)(ref r2)).y = ((Rect)(ref r2)).y - 1f;
				S2_NET.FybCommon.Ui.Text(r2, item2, 21, Color.white, (TextAnchor)3, bold: true, wrap: false);
				num += num3 + 8f;
			}
		}

		internal static string DevPlaceFace(string up)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			try
			{
				Player local = Player.Local;
				Vector3 forward = ((Component)Camera.main).transform.forward;
				forward.y = 0f;
				((Vector3)(ref forward)).Normalize();
				Vector3 pos = ((Component)local).transform.position + forward * 1.3f + Vector3.up * float.Parse(up, CultureInfo.InvariantCulture);
				ItemSpec spec = null;
				foreach (ItemSpec item in Catalog.Items)
				{
					if (item.Id == "net_desk")
					{
						spec = item;
					}
				}
				_devDesk = Placement.PlaceFree(spec, pos, Quaternion.LookRotation(forward))?.Go;
				return "placed at " + ((Vector3)(ref pos)).ToString("F2");
			}
			catch (Exception ex)
			{
				return ex.Message;
			}
		}

		private static void Loaded()
		{
		}

		private static void Unloaded()
		{
			Browser.Reset();
		}

		public override void OnUpdate()
		{
			if (!Host.Update())
			{
				return;
			}
			try
			{
				S2_NET.WoodKit.Ui.Capture();
			}
			catch
			{
			}
			try
			{
				S2_NET.FybCommon.Ui.Capture();
			}
			catch
			{
			}
			try
			{
				Browser.Update();
				Desk.Update();
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("The Internet: " + ex.Message);
			}
		}

		public override void OnGUI()
		{
			if (!Host.Ok || !FortifyApi.InGame)
			{
				return;
			}
			if (!Browser.Open)
			{
				try
				{
					NativeHint(Placement.Hint);
					PickupHold.Draw();
				}
				catch
				{
				}
			}
			try
			{
				Browser.Draw();
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("The Internet screen: " + ex.Message);
			}
		}
	}
	internal static class Desk
	{
		private static Material _screen;

		private static float _pulse;

		public static GameObject Build()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			/