Decompiled source of Echoes of the Seer v1.0.0

EchoesOfTheSeer.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Xml.Linq;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using Fusion;
using HarmonyLib;
using HarmonyLib.Tools;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Invector;
using Microsoft.CodeAnalysis;
using SSSGame;
using SSSGame.AI;
using SSSGame.Combat;
using SSSGame.Controllers;
using SSSGame.Localization;
using SSSGame.UI;
using SSSGame.Weather;
using SandSailorStudio.Attributes;
using SandSailorStudio.Inventory;
using SandSailorStudio.UI;
using SandSailorStudio.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using eots.bepinex.mod.Core;
using eots.bepinex.mod.Core.Helpers;
using eots.bepinex.mod.Helpers;
using eots.bepinex.mod.Managers;
using eots.bepinex.mod.Managers.CharacterHelpers;
using eots.bepinex.mod.Managers.Glyphs.Behaviors;
using eots.bepinex.mod.Managers.Glyphs.Core;
using eots.bepinex.mod.Managers.Inputs;
using eots.bepinex.mod.Managers.Inputs.Commands;
using eots.bepinex.mod.Managers.ItemSpawner;
using eots.bepinex.mod.Managers.Prefabs;
using eots.bepinex.mod.Managers.RunePowers;
using eots.bepinex.mod.Managers.RunePowers.Earth.Basic;
using eots.bepinex.mod.Managers.RunePowers.Earth.Core;
using eots.bepinex.mod.Managers.RunePowers.Fire;
using eots.bepinex.mod.Managers.Spells.Core;
using eots.bepinex.mod.Managers.Spells.Fire;
using eots.bepinex.mod.Managers.StatusEffects;
using eots.bepinex.mod.Managers.Weather;
using eots.bepinex.mod.Patches;
using eots.bepinex.mod.Tools;
using eots.bepinex.mod.UI.Numpad;
using eots.bepinex.mod.UI.RunePowers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("EchoesOfTheSeer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a1f6894bda307e0ef55cbb0e4539a79653f6680a")]
[assembly: AssemblyProduct("Echoes of the Seer")]
[assembly: AssemblyTitle("EchoesOfTheSeer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class Glyph
{
	private GameObject gameObject;

	private Vector3 originalScale;

	public GameObject GameObject => gameObject;

	public float OrbitAngle { get; set; }

	public float OrbitSpeed { get; set; }

	public float SpinSpeed { get; set; }

	public int Index { get; private set; }

	public float BaseHeight { get; private set; }

	public Vector3 OrbitAxis { get; private set; }

	public float OrbitDistance { get; private set; }

	public Vector3 OriginalScale => originalScale;

	public Glyph(GameObject prefab, Transform parent, float baseHeight, float orbitDistance, float orbitSpeed, float spinSpeed, int index, Vector3 orbitAxis)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		BaseHeight = baseHeight * 0.5f;
		OrbitDistance = orbitDistance * 0.5f;
		OrbitSpeed = orbitSpeed;
		SpinSpeed = spinSpeed;
		Index = index;
		OrbitAxis = ((Vector3)(ref orbitAxis)).normalized;
		gameObject = Object.Instantiate<GameObject>(prefab, parent);
		Transform transform = gameObject.transform;
		originalScale = transform.localScale;
		gameObject.SetActive(true);
		Camera val = default(Camera);
		if (Extensions.TryGetComponentInChildren<Camera>(gameObject, ref val))
		{
			((Behaviour)val).enabled = false;
		}
		AudioListener val2 = default(AudioListener);
		if (Extensions.TryGetComponentInChildren<AudioListener>(gameObject, ref val2))
		{
			((Behaviour)val2).enabled = false;
		}
		Collider val3 = default(Collider);
		if (gameObject.TryGetComponent<Collider>(ref val3))
		{
			val3.enabled = false;
		}
		OrbitAngle = Random.Range(0f, 360f);
	}

	public void Update(GlyphContext context, IGlyphBehavior behavior)
	{
		if (!((Object)(object)gameObject == (Object)null) && !((Object)(object)gameObject.transform == (Object)null) && !((Object)(object)context.Center == (Object)null))
		{
			behavior.Update(this, context);
		}
	}

	public void Destroy()
	{
		if ((Object)(object)gameObject != (Object)null)
		{
			Object.Destroy((Object)(object)gameObject);
		}
	}
}
public class GlyphContext
{
	public float Time { get; set; }

	public Transform Center { get; set; }

	public GlyphState CurrentState { get; set; }

	public RunePowerType ActiveRune { get; set; }

	public float VerticalOffset { get; set; }

	public int TotalGlyphs { get; set; }
}
internal class GlyphLifecycleController
{
	private readonly Dictionary<RunePowerType, List<Glyph>> glyphGroups;

	private readonly Transform glyphContainer;

	private readonly float powerToGlyphRatio;

	private readonly int maxGlyphsPerRune;

	public GlyphLifecycleController(Dictionary<RunePowerType, List<Glyph>> glyphGroups, Transform glyphContainer, float powerToGlyphRatio = 30f, int maxGlyphsPerRune = 6)
	{
		this.glyphGroups = glyphGroups ?? new Dictionary<RunePowerType, List<Glyph>>();
		this.glyphContainer = glyphContainer;
		this.powerToGlyphRatio = powerToGlyphRatio;
		this.maxGlyphsPerRune = maxGlyphsPerRune;
	}

	public void RefreshGlyphs(RunePowerType activeRune, float powerLevel, bool forceRebuild = false)
	{
		if ((Object)(object)glyphContainer == (Object)null)
		{
			return;
		}
		int num = Mathf.Clamp(Mathf.CeilToInt(powerLevel / powerToGlyphRatio), 0, maxGlyphsPerRune);
		if (!glyphGroups.TryGetValue(activeRune, out var value))
		{
			value = new List<Glyph>();
			glyphGroups[activeRune] = value;
		}
		int count = value.Count;
		if (!forceRebuild && num == count)
		{
			return;
		}
		if (num > count)
		{
			for (int i = count; i < num; i++)
			{
				Glyph glyph = GlyphFactory.Create(activeRune, i, glyphContainer);
				if (glyph != null)
				{
					value.Add(glyph);
				}
			}
		}
		else
		{
			for (int num2 = count - 1; num2 >= num; num2--)
			{
				value[num2]?.Destroy();
				value.RemoveAt(num2);
			}
		}
	}

	public void DestroyAllGlyphs()
	{
		foreach (List<Glyph> value in glyphGroups.Values)
		{
			foreach (Glyph item in value)
			{
				item?.Destroy();
			}
		}
		glyphGroups.Clear();
	}
}
public class GlyphManager
{
	private readonly Transform playerTransform;

	private readonly GameObject glyphContainer;

	private readonly Dictionary<RunePowerType, List<Glyph>> glyphGroups = new Dictionary<RunePowerType, List<Glyph>>();

	private readonly Dictionary<RunePowerType, float> previousRunePowers = new Dictionary<RunePowerType, float>();

	private readonly GlyphLifecycleController lifecycleController;

	private readonly GlyphUpdater glyphUpdater;

	private readonly RunePowerTracker runePowerTracker;

	private readonly GlyphBehaviorRegistry behaviorRegistry;

	private float runeLogTimer;

	private const float RunningSpeedThreshold = 3f;

	private int glyphIndex;

	public static GlyphManager Instance { get; private set; }

	public Dictionary<RunePowerType, List<Glyph>> GlyphGroups => glyphGroups;

	public Transform GlyphContainer => glyphContainer.transform;

	public bool RunePowerActive { get; set; }

	public GlyphManager(Transform player, Dictionary<RunePowerType, GameObject> glyphPrefabs)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		if (Instance != null)
		{
			Debug.LogWarning(Object.op_Implicit("GlyphManager already exists, overwriting instance."));
		}
		Instance = this;
		playerTransform = player;
		glyphContainer = new GameObject("GlyphContainer");
		glyphContainer.transform.SetParent(playerTransform, false);
		GlyphFactory.Initialize(glyphPrefabs);
		behaviorRegistry = new GlyphBehaviorRegistry();
		behaviorRegistry.InitializeBehaviors();
		lifecycleController = new GlyphLifecycleController(glyphGroups, glyphContainer.transform);
		glyphUpdater = new GlyphUpdater(glyphGroups, behaviorRegistry, playerTransform);
		runePowerTracker = new RunePowerTracker(previousRunePowers);
		RunePowerService.OnRunePowerSwitched += HandleRuneSwitched;
	}

	~GlyphManager()
	{
		RunePowerService.OnRunePowerSwitched -= HandleRuneSwitched;
	}

	private void HandleRuneSwitched(RunePowerType newRune)
	{
		foreach (KeyValuePair<RunePowerType, List<Glyph>> glyphGroup in glyphGroups)
		{
			if (glyphGroup.Key == newRune)
			{
				continue;
			}
			foreach (Glyph item in glyphGroup.Value)
			{
				item?.Destroy();
			}
			glyphGroup.Value.Clear();
		}
		RefreshGlyphs(newRune, forceRebuild: true);
		Debug.Log(Object.op_Implicit($"[GlyphManager] Rune switched to {newRune}, refreshing glyphs."));
	}

	private void RefreshGlyphs(RunePowerType rune, bool forceRebuild)
	{
		float powerLevel = runePowerTracker.GetPowerLevel(rune);
		lifecycleController.RefreshGlyphs(rune, powerLevel, forceRebuild);
	}

	public void Update()
	{
		//IL_0028: 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)
		runeLogTimer += Time.deltaTime;
		float verticalOffset = 0f;
		Rigidbody val = default(Rigidbody);
		int num;
		if (((Component)playerTransform).TryGetComponent<Rigidbody>(ref val))
		{
			Vector3 velocity = val.velocity;
			num = ((((Vector3)(ref velocity)).magnitude > 3f) ? 1 : 0);
		}
		else
		{
			num = 0;
		}
		bool isPlayerRunning = (byte)num != 0;
		RunePowerType currentRunePower = runePowerTracker.GetCurrentRunePower();
		if (runePowerTracker.PowersChanged())
		{
			RefreshGlyphs(currentRunePower, forceRebuild: false);
		}
		glyphUpdater.UpdateGlyphs(currentRunePower, RunePowerActive, verticalOffset, isPlayerRunning);
	}

	public void TriggerSpecialOnOneGlyph(FireStructure fireStructure, Action onComplete, SpecialEffectType effectType)
	{
		RunePowerType currentRunePower = runePowerTracker.GetCurrentRunePower();
		if (glyphGroups.TryGetValue(currentRunePower, out var value) && value.Count != 0)
		{
			Glyph glyph = value[glyphIndex % value.Count];
			glyphIndex++;
			if (behaviorRegistry.TryGetDispatcher(currentRunePower, out var dispatcher))
			{
				dispatcher.TriggerSpecial(glyph, fireStructure, onComplete, effectType);
			}
		}
	}
}
public class EarthTerraformingCommands
{
	public class UserDefined : IRuneCommand
	{
		public string Name => "Terraform (General)";

		public string IconName => "HUD_atlas_controller_switch_22";

		public float CommandCost => TerraformCostHelper.CalculateRuneCost();

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral();
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class SmoothRoad : IRuneCommand
	{
		public string Name => "Terraform Road";

		public string IconName => "Item_Structures_TerrainRoad";

		public float CommandCost => 0.5f;

		public float RepeatDelay => 0.2f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)2, offsetAhead: 0f, width: 0f, height: 0f, blend: 3f, terrainType: (TerrainType)19);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class Smooth : IRuneCommand
	{
		public string Name => "Terraform Smooth";

		public string IconName => "UIFlat_WhiteIcon_FallDmg";

		public float CommandCost => 0.5f;

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)2, offsetAhead: 0f, width: 0f, height: 0f, blend: 7f, terrainType: (TerrainType)0);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class Level : IRuneCommand
	{
		public string Name => "Terraform Level";

		public string IconName => "HUD_atlas_controller_switch_5";

		public float CommandCost => 3f;

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)2, offsetAhead: 0f, width: 7f, height: 7f, blend: 3f, terrainType: (TerrainType)0);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class Raise : IRuneCommand
	{
		public string Name => "Terraform Raise";

		public string IconName => "HUD_atlas_controller_switch_26";

		public float CommandCost => 3f;

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)1, offsetAhead: 0f, width: 7f, height: 7f, blend: 3f, terrainType: (TerrainType)0);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class Dig : IRuneCommand
	{
		public string Name => "Terraform Dig";

		public string IconName => "HUD_atlas_controller_switch_24";

		public float CommandCost => 3f;

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)0, offsetAhead: 0f, width: 7f, height: 7f, blend: 3f, terrainType: (TerrainType)0);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}

	public class RestoreNature : IRuneCommand
	{
		public string Name => "Terraform Restore Nature";

		public string IconName => "UIFlat_Icon_flower";

		public float CommandCost => 0f;

		public float RepeatDelay => 0f;

		public float MinShamanismLevel => 0f;

		public void Execute(Transform playerTransform, int actionID)
		{
			TerraformOperationGeneral terraformOperationGeneral = new TerraformOperationGeneral((TerraformingToolOperation)3, offsetAhead: 0f, width: 0f, height: 0f, blend: 7f, terrainType: (TerrainType)0);
			StaticCoreHelpers.coroutineHelper.StartCoroutineHelper(terraformOperationGeneral.Execute());
		}
	}
}
public static class ItemSpawnerTools
{
	public static void SpawnItemsForward(Transform playerTransform, Vector3 startPos, IEnumerable<string> itemNames, float spaceBetweenItems = 1f, int quantity = 1)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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)
		Vector3 forward = playerTransform.forward;
		Vector3 normalized = ((Vector3)(ref forward)).normalized;
		int num = 0;
		foreach (string itemName in itemNames)
		{
			Vector3 pos = startPos + normalized * ((float)num * spaceBetweenItems);
			SpawnFromItemInfoSO(itemName, pos, Quaternion.identity, quantity);
			num++;
		}
	}

	public static void SpawnToInventoryWithLimit(string name, int quantity, Vector3 spawnPos, Quaternion spawnRot, int? qtyLimit = null, Character character = null, Villager villager = null)
	{
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Expected O, but got Unknown
		//IL_020f: 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)
		ItemCollection val = null;
		if ((Object)(object)character == (Object)null && (Object)(object)villager == (Object)null)
		{
			character = Globals.Character;
		}
		if ((Object)(object)character != (Object)null)
		{
			PlayerInteractionAgent component = ((Component)character).GetComponent<PlayerInteractionAgent>();
			if ((Object)(object)component == (Object)null)
			{
				Plugin.Log.LogInfo((object)"[InventorySpawnLimit] ERROR: No PlayerInteractionAgent found on character");
				return;
			}
			val = component.GetInventory();
		}
		if (val == null && (Object)(object)villager != (Object)null)
		{
			InventoryComponent inventory = ((Character)villager).Inventory;
			if ((Object)(object)inventory != (Object)null)
			{
				val = inventory.GetItemCollection();
			}
		}
		if (val == null)
		{
			Plugin.Log.LogInfo((object)"[InventorySpawnLimit] ERROR: No valid inventory found.");
			return;
		}
		ItemInfo valueOrDefault = Globals.GameObjectLists.ItemInfoSO.GetValueOrDefault(name);
		bool flag = default(bool);
		if ((Object)(object)valueOrDefault == (Object)null)
		{
			ManualLogSource log = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[InventorySpawnLimit] ERROR: No ItemInfo found for '");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
			}
			log.LogInfo(val2);
			return;
		}
		int num = ((valueOrDefault.stackSize <= 0) ? 1 : valueOrDefault.stackSize);
		int num2 = 0;
		IReadOnlyList<ItemContainer> containers = val.GetContainers();
		int num3 = 0;
		while (true)
		{
			ItemContainer val3;
			try
			{
				val3 = containers[num3];
			}
			catch
			{
				break;
			}
			List<Item> val4 = new List<Item>();
			val3.GetItemsToList(val4);
			Enumerator<Item> enumerator = val4.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Item current = enumerator.Current;
				if ((Object)(object)current.info == (Object)(object)valueOrDefault)
				{
					num2 += current.count;
				}
			}
			num3++;
		}
		int num4 = (qtyLimit.HasValue ? Math.Max(0, qtyLimit.Value - num2) : quantity);
		if (num4 <= 0)
		{
			return;
		}
		int num5 = Math.Min(quantity, num4);
		int num6 = 0;
		while (num5 > 0)
		{
			int num7 = Math.Min(num, num5);
			Item val5 = valueOrDefault.CreateItem();
			ItemEventContext val6 = (ItemEventContext)0;
			ItemContainer freeContainer = val.GetFreeContainer(valueOrDefault, false);
			if (freeContainer == null)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(55, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[InventorySpawnLimit] WARNING: No free container for '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
				}
				log2.LogInfo(val2);
				break;
			}
			if (num > 1)
			{
				freeContainer.AddItem(val5, num7, -1, val6);
			}
			else
			{
				freeContainer.AddItem(val5, 1, -1, val6);
			}
			num6 += num7;
			num5 -= num7;
			freeContainer.OnItemCountChanged?.Invoke(val5);
		}
	}

	public static void SpawnAndUseItem(string itemName, Vector3 spawnPos, Quaternion spawnRot)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Expected O, but got Unknown
		ItemInfo valueOrDefault = Globals.GameObjectLists.ItemInfoSO.GetValueOrDefault(itemName);
		bool flag = default(bool);
		if ((Object)(object)valueOrDefault == (Object)null)
		{
			ManualLogSource log = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnAndUseItem] ERROR: No ItemInfo found for '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(itemName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log.LogInfo(val);
			return;
		}
		Item val2 = valueOrDefault.CreateItem();
		if (val2 == null)
		{
			ManualLogSource log2 = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnAndUseItem] ERROR: Failed to create item '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(itemName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log2.LogInfo(val);
		}
		else
		{
			val2.Use(((Component)Globals.Character).gameObject);
		}
	}

	public static void SpawnToInventoryOrGround(string name, int quantity, Vector3 spawnPos, Quaternion spawnRot)
	{
		//IL_01e4: 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_02ec: Expected O, but got Unknown
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: 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_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Expected O, but got Unknown
		Character character = Globals.Character;
		if ((Object)(object)character == (Object)null)
		{
			Plugin.Log.LogInfo((object)"[SpawnToInventoryOrGround] ERROR: Character is null");
			return;
		}
		PlayerInteractionAgent component = ((Component)character).GetComponent<PlayerInteractionAgent>();
		if ((Object)(object)component == (Object)null)
		{
			Plugin.Log.LogInfo((object)"[SpawnToInventoryOrGround] ERROR: No PlayerInteractionAgent found");
			return;
		}
		ItemCollection inventory = component.GetInventory();
		if (inventory == null)
		{
			Plugin.Log.LogInfo((object)"[SpawnToInventoryOrGround] ERROR: No ItemCollection found");
			return;
		}
		ItemInfo valueOrDefault = Globals.GameObjectLists.ItemInfoSO.GetValueOrDefault(name);
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val;
		if ((Object)(object)valueOrDefault == (Object)null)
		{
			ManualLogSource log = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(58, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnToInventoryOrGround] ERROR: No ItemInfo found for '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log.LogInfo(val);
			return;
		}
		int num = ((valueOrDefault.stackSize <= 0) ? 1 : valueOrDefault.stackSize);
		int num2 = quantity;
		int num3 = 0;
		IReadOnlyList<ItemContainer> containers = inventory.GetContainers();
		int num4 = 0;
		while (true)
		{
			ItemContainer val2;
			try
			{
				val2 = containers[num4];
			}
			catch
			{
				break;
			}
			List<Item> val3 = new List<Item>();
			val2.GetItemsToList(val3);
			for (int i = 0; i < val3.Count; i++)
			{
				Item val4 = val3[i];
				if ((Object)(object)val4.info == (Object)(object)valueOrDefault && val4.count < num)
				{
					int num5 = Math.Min(num - val4.count, num2);
					val4.count += num5;
					num2 -= num5;
					num3 += num5;
					ManualLogSource log2 = Plugin.Log;
					val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnToInventoryOrGround] Merged ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num5);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" into existing stack");
					}
					log2.LogInfo(val);
					if (num2 <= 0)
					{
						break;
					}
				}
				val2.OnItemCountChanged?.Invoke(val4);
			}
			if (num2 <= 0)
			{
				break;
			}
			num4++;
		}
		while (num2 > 0)
		{
			int num6 = Math.Min(num2, num);
			Item val5 = valueOrDefault.CreateItem();
			ItemEventContext val6 = (ItemEventContext)0;
			ItemContainer freeContainer = inventory.GetFreeContainer(valueOrDefault, false);
			if (freeContainer == null || freeContainer.IsFull(true))
			{
				ManualLogSource log3 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(72, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnToInventoryOrGround] WARNING: No space for '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' — spawning to ground");
				}
				log3.LogInfo(val);
				SpawnStack(name, num6, spawnPos, spawnRot);
				num2 -= num6;
				continue;
			}
			freeContainer.AddItem(val5, num6, -1, val6);
			ManualLogSource log4 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnToInventoryOrGround] Added new stack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num6);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log4.LogInfo(val);
			num3 += num6;
			freeContainer.OnItemCountChanged?.Invoke(val5);
			num2 -= num6;
		}
		ManualLogSource log5 = Plugin.Log;
		val = new BepInExInfoLogInterpolatedStringHandler(75, 3, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpawnToInventoryOrGround] FINISHED: Requested ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(quantity);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", added ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num3);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", spawned ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(quantity - num3);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to ground");
		}
		log5.LogInfo(val);
	}

	public static void SpawnFromItemInfoSO(string internalName, Vector3 pos, Quaternion rot, int quantity = 1)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_0074: 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)
		Dictionary<string, ItemInfo> itemInfoSO = Globals.GameObjectLists.ItemInfoSO;
		if (itemInfoSO == null || !itemInfoSO.ContainsKey(internalName))
		{
			return;
		}
		ItemInfo val = itemInfoSO[internalName];
		if ((Object)(object)val == (Object)null || (Object)(object)val.spawnObject == (Object)null)
		{
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(58, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[ItemSpawnerTools] ERROR: ItemInfo '");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(internalName);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' has no valid prefab.");
			}
			log.LogInfo(val2);
		}
		else
		{
			for (int i = 0; i < quantity; i++)
			{
				Object.Instantiate<GameObject>(val.spawnObject, pos, rot);
			}
		}
	}

	public static GameObject SpawnStack(string name, int quantity, Vector3 pos, Quaternion rot)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//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)
		//IL_00b0: 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_007c: Expected O, but got Unknown
		SpawnableItem byName = SpawnableItemRegistry.GetByName(name);
		bool flag = default(bool);
		if (byName == null || (Object)(object)byName.Prefab == (Object)null)
		{
			ManualLogSource log = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ItemSpawnerTools] ERROR: Invalid item '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log.LogInfo(val);
			return null;
		}
		ItemInfo valueOrDefault = Globals.GameObjectLists.ItemInfoSO.GetValueOrDefault(name);
		if ((Object)(object)valueOrDefault == (Object)null)
		{
			ManualLogSource log2 = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ItemSpawnerTools] ERROR: No ItemInfo found for '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log2.LogInfo(val);
			return null;
		}
		ItemObjectSpawnContext val2 = (ItemObjectSpawnContext)1;
		Vector3 one = Vector3.one;
		Transform val3 = null;
		bool flag2 = true;
		return valueOrDefault.SpawnObject(ref val2, ref quantity, ref pos, ref rot, ref one, val3, flag2);
	}
}
public class RuneUIMenuManager : MonoBehaviour
{
	public GameObject earthMenu;

	public GameObject airMenu;

	public GameObject fireMenu;

	public GameObject waterMenu;

	public void ShowMenu(RunePowerType activeRune)
	{
		earthMenu.SetActive(activeRune == RunePowerType.Earth);
		airMenu.SetActive(activeRune == RunePowerType.Air);
		fireMenu.SetActive(activeRune == RunePowerType.Fire);
		waterMenu.SetActive(activeRune == RunePowerType.Water);
	}
}
public class SpellProjectile : MonoBehaviour
{
	private Vector3 target;

	private float speed = 10f;

	private Action onImpact;

	internal void Launch(Vector3 targetPosition, Action onImpact)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		target = targetPosition;
		this.onImpact = onImpact;
		ManualLogSource log = Plugin.Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SpellProjectile] Launching toward ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(targetPosition);
		}
		log.LogInfo(val);
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		if (Vector3.Distance(((Component)this).transform.position, target) < 0.1f)
		{
			Plugin.Log.LogInfo((object)"[SpellProjectile] Reached target, triggering impact.");
			onImpact?.Invoke();
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, target, speed * Time.deltaTime);
		}
	}
}
public class FireRefuelSpell : BaseSpellCommand
{
	public override string Name => "Refuel Nearby Fire";

	public override RunePowerType RuneType => RunePowerType.Fire;

	public override float PowerCost => 5f;

	protected override void OnCast(Transform caster)
	{
		//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)
		List<FireStructure> lowFuelFireStructures = FireStarter.GetLowFuelFireStructures(caster, new HashSet<FireStructure>());
		if (lowFuelFireStructures.Count == 0)
		{
			Debug.Log(Object.op_Implicit("[Spell] No low-fuel fires nearby."));
			return;
		}
		FireStructure val = lowFuelFireStructures[0];
		GameObject effect = PrefabManager.GetEffect("Item_Magic_ArtifactFire");
		if ((Object)(object)effect == (Object)null)
		{
			Debug.LogWarning(Object.op_Implicit("[Spell] RefuelDelivery effect prefab not found."));
			return;
		}
		GameObject obj = Object.Instantiate<GameObject>(effect, caster.position, Quaternion.identity);
		SpellEffectContext context = new SpellEffectContext
		{
			Caster = caster,
			Target = ((Component)val).transform,
			TargetData = val,
			OnComplete = delegate
			{
				Debug.Log(Object.op_Implicit("[Spell] Fire refuel complete."));
			}
		};
		obj.AddComponent<RefuelDeliveryEffect>().Initialize(context);
	}
}
[HarmonyPatch]
public static class CreativeModePatches
{
	[HarmonyPatch(typeof(ProficiencyPanel), "SetExpMultiplier")]
	public class ProficiencyPanelPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(object expMultiplier)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if (!isCreativeEnabled)
			{
				return false;
			}
			Property val = (Property)((expMultiplier is Property) ? expMultiplier : null);
			if (val != null)
			{
				float num = val.GetValue();
				val.SetValue(100f);
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(39, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Player Panel] Forced attr ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(val.id);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(num);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.GetValue());
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("x.");
				}
				log.LogInfo(val2);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Villager), "_OnProficiencyLevelChanged")]
	public class VillagerProficiencyPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(ref int id, ref float value)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			if (!isCreativeEnabled)
			{
				return false;
			}
			float num = value;
			value = 100f;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Villager] Proficiency id=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(id);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", original=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", new=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(value);
			}
			log.LogInfo(val);
			if (id == CharacterConstants.c_ShamanicProf_Attr)
			{
				ManualLogSource log2 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Villager] Shamanism detected.  Value: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				}
				log2.LogInfo(val);
			}
			return true;
		}
	}

	private static bool isCreativeEnabled => PluginSettingsManager.EOTS_CreativeEnabled.Value;

	[HarmonyPostfix]
	[HarmonyPatch(typeof(NodeTemplate), "Configure")]
	private static void Configure_Postfix(NodeTemplate __instance)
	{
		if (isCreativeEnabled && !((Object)(object)__instance == (Object)null))
		{
			__instance.blueprintConditionsRules = new List<BlueprintConditionsRule>();
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(NodeTemplate), "FillManifest")]
	private static void FillManifest_Postfix(NodeTemplate __instance, ref ItemManifest manifest)
	{
		if (isCreativeEnabled && !((Object)(object)__instance == (Object)null))
		{
			manifest.Clear();
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(ItemManifestContainer), "GetManifest")]
	private static void GetManifest_Postfix(ItemManifestContainer __instance, ref ItemManifest __result)
	{
		if (isCreativeEnabled)
		{
			ItemCollection inventory = ((ItemContainer)__instance)._inventory;
			FarmCrop val = ((inventory != null) ? inventory.Owner.GetComponentInParent<FarmCrop>() : null);
			if (!((Object)(object)val != (Object)null) || !((Object)((Component)val).gameObject).name.Contains("_Crop"))
			{
				__result.Clear();
			}
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(PlayerBuilder), "get_BuildPlacement")]
	private static void GetBuildPlacement_Postfix(PlayerBuilder __instance, ref Placement __result)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Invalid comparison between Unknown and I4
		if (isCreativeEnabled && !((Object)(object)__instance == (Object)null) && __result != null && (int)__instance.CurrentState == 1)
		{
			__result.Validity = (PlacementValidity)0;
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(PlayerBuilder), "set_BuildPlacement")]
	private static void SetBuildPlacement_Postfix(PlayerBuilder __instance, Placement value)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Invalid comparison between Unknown and I4
		if (isCreativeEnabled && !((Object)(object)__instance == (Object)null) && value != null && (int)__instance.CurrentState == 1)
		{
			value.Validity = (PlacementValidity)0;
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(DynamicDimensionsPlacementTool), "_ValidateFootprint")]
	[HarmonyPatch(new Type[] { typeof(LayerMask) })]
	private static void ValidateFootprint_Postfix(ref bool __result)
	{
		if (isCreativeEnabled)
		{
			__result = true;
		}
	}
}
[BepInPlugin("EchoesOfTheSeer", "Echoes of the Seer", "1.0.0")]
public class Plugin : BasePlugin
{
	internal static ManualLogSource Log;

	public override void Load()
	{
		Log = ((BasePlugin)this).Log;
		HarmonyFileLog.Enabled = true;
		Globals.Settings_ShowGodMode = false;
		Globals.Settings_ShowCreateMode = false;
		Globals.Settings_ShowDevelopmentMode = false;
		Globals.XMLExportsEnabled = false;
		try
		{
			InjectHelperClasses();
		}
		catch (Exception ex)
		{
			Log.LogError((object)("InjectHelperClasses failed: " + ex));
		}
		try
		{
			SettingsMenuStuff();
		}
		catch (Exception ex2)
		{
			Log.LogError((object)("SettingsMenuStuff failed: " + ex2));
		}
		try
		{
			ApplyHarmonyPatches();
		}
		catch (Exception ex3)
		{
			Log.LogError((object)("ApplyHarmonyPatches failed: " + ex3));
		}
		try
		{
			RunTheOtherStuff();
		}
		catch (Exception ex4)
		{
			Log.LogError((object)("RunTheOtherStuff failed: " + ex4));
		}
		if (PluginSettingsManager.EOTS_DevelopmentFeatures.Value)
		{
			try
			{
				InitializeDevelopmentOnlyStuff();
			}
			catch (Exception ex5)
			{
				Log.LogError((object)("InitializeDevelopmentOnlyStuff failed: " + ex5));
			}
		}
	}

	private static void InjectHelperClasses()
	{
		ClassInjector.RegisterTypeInIl2Cpp<CoroutineHelper>();
		ClassInjector.RegisterTypeInIl2Cpp<EOTS_InputManager>();
		ClassInjector.RegisterTypeInIl2Cpp<EOTS_StatusEffectsManager>();
		ClassInjector.RegisterTypeInIl2Cpp<SceneWatcher>();
		ClassInjector.RegisterTypeInIl2Cpp<RunePowerManager>();
		ClassInjector.RegisterTypeInIl2Cpp<RunePowerIndicator>();
		ClassInjector.RegisterTypeInIl2Cpp<RunePowerToggleManager>();
		ClassInjector.RegisterTypeInIl2Cpp<NumpadHUDManager>();
		ClassInjector.RegisterTypeInIl2Cpp<IgniteTornadoEffect>();
		ClassInjector.RegisterTypeInIl2Cpp<RefuelDeliveryEffect>();
		ClassInjector.RegisterTypeInIl2Cpp<SpellProjectile>();
	}

	private void ApplyHarmonyPatches()
	{
		TryPatch(typeof(CharacterPatch));
		TryPatch(typeof(HudPatch));
		TryPatch(typeof(MainMenuPatch));
		TryPatch(typeof(PraystationPatch));
		TryPatch(typeof(SettingsMenuPatchV2));
		TryPatch(typeof(WeatherSystemPatch));
		if (PluginSettingsManager.EOTS_CreativeEnabled.Value)
		{
			TryPatch(typeof(CreativeModePatches));
		}
	}

	private void TryPatch(Type patchType)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		try
		{
			Harmony.CreateAndPatchAll(patchType, (string)null);
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(18, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to patch ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(patchType.Name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
			}
			log.LogError(val);
		}
	}

	private void SettingsMenuStuff()
	{
		PluginSettingsManager.Initialize(((BasePlugin)this).Config);
		StaticCoreHelpers.OnSettingsMenu = (Action<Transform>)Delegate.Combine(StaticCoreHelpers.OnSettingsMenu, new Action<Transform>(MainSettingsBuilder.Build));
	}

	private void RunTheOtherStuff()
	{
		try
		{
			RunePowerConfig.Init(((BasePlugin)this).Config);
		}
		catch (Exception ex)
		{
			Log.LogError((object)("RunePowerConfig.Init failed: " + ex));
		}
		try
		{
			StaticCoreHelpers.RefreshResourceInfos();
		}
		catch (Exception ex2)
		{
			Log.LogError((object)("RefreshResourceInfos failed: " + ex2));
		}
		try
		{
			ItemSpawnerResourceLoader.LoadAllResources();
		}
		catch (Exception ex3)
		{
			Log.LogError((object)("ItemSpawnerResourceLoader.LoadAllResources failed: " + ex3));
		}
		try
		{
			SpawnableItemRegistry.RegisterAll();
		}
		catch (Exception ex4)
		{
			Log.LogError((object)("SpawnableItemRegistry.RegisterAll failed: " + ex4));
		}
		try
		{
			RuneCommandRegistry.AssignSpellsToKeyPad();
		}
		catch (Exception ex5)
		{
			Log.LogError((object)("RuneCommandRegistry.AssignSpellsToKeyPad failed: " + ex5));
		}
		try
		{
			PrefabManager.Initialize();
		}
		catch (Exception ex6)
		{
			Log.LogError((object)("PrefabManager.Initialize failed: " + ex6));
		}
		try
		{
			ItemInfoManager.Initialize();
		}
		catch (Exception ex7)
		{
			Log.LogError((object)("ItemInfoManager.Initialize failed: " + ex7));
		}
	}

	private static void InitializeDevelopmentOnlyStuff()
	{
		if (Globals.XMLExportsEnabled)
		{
			ItemSpawnerHelpers.ExportEverything();
			StatusEffectsHelper.ExportAllStatusEffectsToXml();
		}
		Harmony.CreateAndPatchAll(typeof(BuildMenuPatch), (string)null);
	}
}
namespace eots.bepinex.mod
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EchoesOfTheSeer";

		public const string PLUGIN_NAME = "Echoes of the Seer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace eots.bepinex.mod.Tools
{
	public static class UIInspector
	{
		public static void InspectAndExportMenuComponentsXML(Transform root, bool exportToXml = true)
		{
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			if ((Object)(object)root == (Object)null)
			{
				Plugin.Log.LogInfo((object)"[UIInspector] Root transform is null.");
			}
			else if (exportToXml)
			{
				XElement xElement = new XElement("UIRoot");
				xElement.Add(new XComment("Key:"));
				xElement.Add(new XComment("N = Name"));
				xElement.Add(new XComment("RT = RectTransform present"));
				xElement.Add(new XComment("Ap = AnchoredPos"));
				xElement.Add(new XComment("Sd = SizeDelta"));
				xElement.Add(new XComment("Amn = AnchorMin"));
				xElement.Add(new XComment("Amx = AnchorMax"));
				xElement.Add(new XComment("Pv = Pivot"));
				xElement.Add(new XComment("C = Component"));
				ExportRecursive(root, xElement);
				string text = Path.Combine(Globals.XMLExportDirectory, ((Object)root).name + "_UIExport.xml");
				xElement.Save(text);
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[UIInspector] Export complete. File saved to: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				log.LogInfo(val);
			}
			else
			{
				InspectRecursive(root, "");
			}
		}

		private static void InspectRecursive(Transform current, string indent)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			string text = indent + ((Object)current).name;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[UIInspector] GameObject: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
			}
			log.LogInfo(val);
			foreach (Component component in ((Component)current).GetComponents<Component>())
			{
				if (!((Object)(object)component == (Object)null))
				{
					ManualLogSource log2 = Plugin.Log;
					val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  └─ Component: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((object)component).GetType().Name);
					}
					log2.LogInfo(val);
				}
			}
			for (int i = 0; i < current.childCount; i++)
			{
				InspectRecursive(current.GetChild(i), indent + "  ");
			}
		}

		private static void ExportRecursive(Transform current, XElement parentElement)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			XElement xElement = new XElement("GO", new XAttribute("N", ((Object)current).name));
			RectTransform component = ((Component)current).GetComponent<RectTransform>();
			if ((Object)(object)component != (Object)null)
			{
				xElement.Add(new XAttribute("RT", true));
				xElement.Add(new XAttribute("Ap", component.anchoredPosition));
				xElement.Add(new XAttribute("Sd", component.sizeDelta));
				xElement.Add(new XAttribute("Amn", component.anchorMin));
				xElement.Add(new XAttribute("Amx", component.anchorMax));
				xElement.Add(new XAttribute("Pv", component.pivot));
			}
			foreach (Component component2 in ((Component)current).GetComponents<Component>())
			{
				if (!((Object)(object)component2 == (Object)null))
				{
					xElement.Add(new XElement("C", ((object)component2).GetType().Name));
				}
			}
			parentElement.Add(xElement);
			for (int i = 0; i < current.childCount; i++)
			{
				ExportRecursive(current.GetChild(i), xElement);
			}
		}

		public static Transform FindDeepChild(Transform parent, string name)
		{
			for (int i = 0; i < parent.childCount; i++)
			{
				Transform child = parent.GetChild(i);
				if (((Object)child).name == name)
				{
					return child;
				}
				Transform val = FindDeepChild(child, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}
	}
}
namespace eots.bepinex.mod.UI
{
	public class CustomTabButtonCategory : TabButtonCategory
	{
		public Action OnSelected;

		public override void _OnSelect()
		{
			Plugin.Log.LogInfo((object)"_OnSelect");
			OnSelected?.Invoke();
		}

		public override void OnSelect(BaseEventData eventData)
		{
			Plugin.Log.LogInfo((object)"OnSelect");
		}
	}
	public static class UIHelpers
	{
		public static Toggle CreateToggle(string name, string text, bool startValue, Transform parent, Vector2 size, Vector2 anchorPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, UnityAction<bool> callback = null, Color bgColor = default(Color))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_003f: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0071: Expected O, but got Unknown
			//IL_0096: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_00f2: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: 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_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Transform)val2).localPosition = Vector3.zero;
			val2.sizeDelta = size;
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.pivot = pivot;
			val2.anchoredPosition = anchorPosition;
			Rect rect = val2.rect;
			Vector2 size2 = ((Rect)(ref rect)).size;
			Toggle val3 = val.AddComponent<Toggle>();
			GameObject val4 = new GameObject("Toggle");
			val4.transform.SetParent(val.transform, false);
			RectTransform obj = val4.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 0.5f);
			obj.anchorMax = new Vector2(0f, 0.5f);
			obj.pivot = new Vector2(0f, 0.5f);
			obj.sizeDelta = new Vector2(size2.x / 4f, size2.y);
			GameObject val5 = new GameObject("Background");
			val5.transform.SetParent(val4.transform, false);
			RectTransform obj2 = val5.AddComponent<RectTransform>();
			obj2.sizeDelta = new Vector2(16f, 16f);
			obj2.anchorMin = new Vector2(0.5f, 0.5f);
			obj2.anchorMax = new Vector2(0.5f, 0.5f);
			obj2.pivot = new Vector2(0.5f, 0.5f);
			obj2.anchoredPosition = new Vector2(0f, 0f);
			Image val6 = val5.AddComponent<Image>();
			((Graphic)val6).color = Color.white;
			GameObject val7 = new GameObject("Checkmark");
			val7.transform.SetParent(val5.transform, false);
			RectTransform obj3 = val7.AddComponent<RectTransform>();
			obj3.sizeDelta = new Vector2(13f, 13f);
			obj3.anchorMin = new Vector2(0.5f, 0.5f);
			obj3.anchorMax = new Vector2(0.5f, 0.5f);
			obj3.pivot = new Vector2(0.5f, 0.5f);
			obj3.anchoredPosition = new Vector2(0f, 0f);
			Image val8 = val7.AddComponent<Image>();
			((Graphic)val8).color = Color.green;
			((Selectable)val3).targetGraphic = (Graphic)(object)val6;
			val3.graphic = (Graphic)(object)val8;
			val3.isOn = startValue;
			GameObject val9 = new GameObject("text");
			RectTransform obj4 = val9.AddComponent<RectTransform>();
			((Transform)obj4).SetParent((Transform)(object)val2, false);
			obj4.anchorMin = new Vector2(0f, 0f);
			obj4.anchorMax = new Vector2(1f, 1f);
			obj4.offsetMin = new Vector2(size2.x / 4f, 0f);
			obj4.offsetMax = new Vector2(0f, 0f);
			TextMeshProUGUI obj5 = val9.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj5).text = text;
			((TMP_Text)obj5).fontSize = val2.sizeDelta.y / 2f;
			((TMP_Text)obj5).alignment = (TextAlignmentOptions)513;
			if ((Delegate)(object)callback != (Delegate)null)
			{
				((UnityEvent<bool>)(object)val3.onValueChanged).AddListener(callback);
			}
			return val3;
		}

		public static Slider AddSlider(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, float minSliderValue, float maxSliderValue, float stepSize, float initialValue, UnityAction<float> callback)
		{
			//IL_000e: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0063: 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_0081: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			float num = size.y / 3f;
			RectTransform val = new GameObject("SliderContainer").AddComponent<RectTransform>();
			((Transform)val).SetParent(parent, false);
			val.anchorMin = anchorMin;
			val.anchorMax = anchorMax;
			val.anchoredPosition = anchoredPosition;
			val.pivot = pivot;
			val.sizeDelta = size;
			((TMP_Text)AddTextMeshPro(text, num, (Transform)(object)val, new Vector2(size.x, num), new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f))).alignment = (TextAlignmentOptions)514;
			TextMeshProUGUI valueText = AddTextMeshPro("1.0", num, (Transform)(object)val, new Vector2(size.x, num), new Vector2(0f, (0f - size.y) / 3f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f));
			((TMP_Text)valueText).alignment = (TextAlignmentOptions)514;
			GameObject val2 = new GameObject("Slider");
			RectTransform val3 = val2.AddComponent<RectTransform>();
			((Transform)val3).SetParent((Transform)(object)val, false);
			val3.anchorMin = new Vector2(0f, 0f);
			val3.anchorMax = new Vector2(1f, 0f);
			val3.anchoredPosition = new Vector2(0f, 0f);
			val3.pivot = new Vector2(0.5f, 0f);
			val3.sizeDelta = new Vector2(-5f, num / 2f);
			((Graphic)val2.AddComponent<Image>()).color = color;
			Slider slider = val2.AddComponent<Slider>();
			slider.minValue = minSliderValue;
			slider.maxValue = maxSliderValue;
			slider.wholeNumbers = false;
			slider.value = initialValue;
			RectTransform val4 = new GameObject("fill").AddComponent<RectTransform>();
			RectTransform val5 = new GameObject("bar").AddComponent<RectTransform>();
			((Transform)val4).SetParent((Transform)(object)val3, false);
			((Transform)val5).SetParent((Transform)(object)val3, false);
			Vector2 val6 = default(Vector2);
			((Vector2)(ref val6))..ctor(0f, 0f);
			val5.anchoredPosition = val6;
			val4.anchoredPosition = val6;
			((Vector2)(ref val6))..ctor(0.5f, 0.5f);
			val5.anchorMin = val6;
			val4.anchorMin = val6;
			((Vector2)(ref val6))..ctor(0.5f, 0.5f);
			val5.anchorMax = val6;
			val4.anchorMax = val6;
			((Vector2)(ref val6))..ctor(0.5f, 0.5f);
			val5.pivot = val6;
			val4.pivot = val6;
			val5.sizeDelta = new Vector2(val3.sizeDelta.y + 2f, val3.sizeDelta.y + 2f);
			((Graphic)((Component)val5).gameObject.AddComponent<Image>()).color = Color.white;
			slider.fillRect = val4;
			slider.handleRect = val5;
			UnityAction<float> val7 = UnityAction<float>.op_Implicit((Action<float>)delegate(float value)
			{
				float num2 = value / stepSize * stepSize;
				num2 = Mathf.Round(num2 * 10f) / 10f;
				slider.value = num2;
				((TMP_Text)valueText).text = value.ToString("F1");
			});
			callback = ((!((Delegate)(object)callback == (Delegate)null)) ? (callback + val7) : val7);
			((UnityEvent<float>)(object)slider.onValueChanged).AddListener(callback);
			((UnityEvent<float>)(object)slider.onValueChanged)?.Invoke(slider.value);
			return slider;
		}

		public static TMP_Dropdown AddDropDown(string name, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, List<string> values, UnityAction<int> callback)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: 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_017a: 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_01b0: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			GameObject val = new GameObject("DropDown");
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Transform)val2).SetParent(parent, false);
			val2.sizeDelta = size;
			val2.anchoredPosition = anchoredPosition;
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.pivot = pivot;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = Color.green;
			TMP_Dropdown val4 = val.AddComponent<TMP_Dropdown>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			GameObject val5 = new GameObject("arrow");
			RectTransform obj = val5.AddComponent<RectTransform>();
			((Transform)obj).SetParent((Transform)(object)val2, false);
			obj.anchorMin = new Vector2(1f, 0f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(1f, 0.5f);
			obj.anchoredPosition = new Vector2(-10f, 0f);
			obj.sizeDelta = new Vector2(24f, 24f);
			Image obj2 = val5.AddComponent<Image>();
			obj2.sprite = SpriteHelpers.GetSprite(ESprite.DropDown);
			((Graphic)obj2).color = Constants.colorRed;
			ScrollRect val6 = AddScrollView((Transform)(object)val2, new Vector2(0f, 150f), Vector2.zero, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 1f), isVertical: true, 1f);
			TextMeshProUGUI captionText = AddTextMeshPro("Options", 16f, (Transform)(object)val2, new Vector2(0f, 10f), Vector2.zero, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f));
			Toggle val7 = CreateToggle("toggle", "OptionA", startValue: false, (Transform)(object)val6.content, new Vector2(0f, 20f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), null, Constants.colorBlue);
			val4.template = ((Component)val6).gameObject.GetComponent<RectTransform>();
			val4.captionText = (TMP_Text)(object)captionText;
			((Graphic)val4.captionText).color = Color.green;
			val4.itemText = (TMP_Text)(object)((Component)val7).GetComponentInChildren<TextMeshProUGUI>();
			List<OptionData> val8 = new List<OptionData>();
			foreach (string value in values)
			{
				val8.Add(new OptionData(value));
			}
			val4.AddOptions(val8);
			if ((Delegate)(object)callback != (Delegate)null)
			{
				((UnityEvent<int>)(object)val4.onValueChanged).AddListener(callback);
			}
			return val4;
		}

		public static Button AddButton(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, UnityAction callback)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0024: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Button");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			((Graphic)val.AddComponent<Image>()).color = color;
			Button val2 = val.AddComponent<Button>();
			obj.sizeDelta = size;
			((Transform)obj).localPosition = Vector3.zero;
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.anchoredPosition = anchoredPosition;
			Rect rect = obj.rect;
			Vector2 size2 = ((Rect)(ref rect)).size;
			AddTextMeshPro(text, size2.y / 2f, val.transform, Vector2.zero, Vector2.zero, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f));
			if ((Delegate)(object)callback != (Delegate)null)
			{
				((UnityEvent)val2.onClick).AddListener(callback);
			}
			return val2;
		}

		public static Button AddButton(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, Sprite backGroundImage, UnityAction callback)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Button obj = AddButton(text, parent, size, anchoredPosition, anchorMin, anchorMax, pivot, color, callback);
			((Component)obj).GetComponent<Image>().sprite = backGroundImage;
			return obj;
		}

		public static void AddUnityInputField(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MyInputField");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = size;
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.anchoredPosition = anchoredPosition;
			((Graphic)val.AddComponent<Image>()).color = Color.white;
			InputField obj2 = val.AddComponent<InputField>();
			GameObject val2 = new GameObject("Placeholder");
			RectTransform obj3 = val2.AddComponent<RectTransform>();
			((Transform)obj3).SetParent(val.transform, false);
			obj3.anchorMin = new Vector2(0f, 0f);
			obj3.anchorMax = new Vector2(1f, 1f);
			obj3.offsetMin = Vector2.zero;
			obj3.offsetMax = Vector2.zero;
			Text val3 = val2.AddComponent<Text>();
			val3.text = "Enter text...";
			((Graphic)val3).color = Color.gray;
			val3.supportRichText = false;
			GameObject val4 = new GameObject("Text");
			val4.AddComponent<RectTransform>();
			val4.transform.SetParent(val.transform, false);
			Text val5 = val4.AddComponent<Text>();
			((Graphic)val5).color = Color.black;
			val5.supportRichText = false;
			obj2.placeholder = (Graphic)(object)val3;
			obj2.textComponent = val5;
		}

		public static TMP_InputField AddInputField(Transform parent, string placeHolderText, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool disableESC = false, UnityAction<string> OnTextChangedCallback = null, UnityAction<string> onSelectedCallback = null, UnityAction<string> onDeSelectCallback = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("InputField");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = size;
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.anchoredPosition = anchoredPosition;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = Color.white;
			TMP_InputField val3 = ((!disableESC) ? val.AddComponent<TMP_InputField>() : val.AddComponent<TMP_InputField>());
			((Selectable)val3).targetGraphic = (Graphic)(object)val2;
			val3.readOnly = false;
			ColorBlock colors = ((Selectable)val3).colors;
			((ColorBlock)(ref colors)).selectedColor = new Color(0.8f, 1f, 0.8f, 1f);
			((Selectable)val3).colors = colors;
			GameObject val4 = new GameObject("Text Area");
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val4.AddComponent<RectMask2D>().padding = new Vector4(-8f, -8f, -5f, -5f);
			val5.sizeDelta = Vector2.zero;
			val5.anchorMin = new Vector2(0f, 0f);
			val5.anchorMax = new Vector2(1f, 1f);
			val5.pivot = new Vector2(0.5f, 0.5f);
			val5.anchoredPosition = Vector2.zero;
			GameObject val6 = new GameObject("Placeholder");
			val6.transform.SetParent(val4.transform, false);
			RectTransform obj2 = val6.AddComponent<RectTransform>();
			obj2.sizeDelta = Vector2.zero;
			obj2.anchorMin = new Vector2(0f, 0f);
			obj2.anchorMax = new Vector2(1f, 1f);
			obj2.pivot = new Vector2(0.5f, 0.5f);
			obj2.anchoredPosition = Vector2.zero;
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = placeHolderText;
			((TMP_Text)val7).fontSize = 14f;
			((Graphic)val7).color = new Color(0.5f, 0.5f, 0.5f, 1f);
			((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
			GameObject val8 = new GameObject("Text");
			val8.transform.SetParent(val4.transform, false);
			RectTransform obj3 = val8.AddComponent<RectTransform>();
			obj3.sizeDelta = Vector2.zero;
			obj3.anchorMin = new Vector2(0f, 0f);
			obj3.anchorMax = new Vector2(1f, 1f);
			obj3.pivot = new Vector2(0.5f, 0.5f);
			obj3.anchoredPosition = Vector2.zero;
			TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val9).fontSize = 14f;
			((Graphic)val9).color = Color.black;
			((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
			val3.textViewport = val5;
			val3.textComponent = (TMP_Text)(object)val9;
			val3.placeholder = (Graphic)(object)val7;
			if ((Delegate)(object)OnTextChangedCallback != (Delegate)null)
			{
				((UnityEvent<string>)(object)val3.onValueChanged).AddListener(OnTextChangedCallback);
			}
			if ((Delegate)(object)onSelectedCallback != (Delegate)null)
			{
				((UnityEvent<string>)(object)val3.onSelect).AddListener(onSelectedCallback);
			}
			if ((Delegate)(object)onDeSelectCallback != (Delegate)null)
			{
				((UnityEvent<string>)(object)val3.onDeselect).AddListener(onDeSelectCallback);
			}
			return val3;
		}

		public static RectTransform AddPanel(string name, Transform parent, Vector2 size, Color color, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Graphic)val.AddComponent<Image>()).color = color;
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.anchoredPosition = anchoredPosition;
			val2.pivot = pivot;
			val2.sizeDelta = size;
			return val2;
		}

		public static RectTransform AddVerticalPanel(string name, Transform parent, Vector2 size, Color color, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, float spacing = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Image val3 = val.AddComponent<Image>();
			VerticalLayoutGroup obj = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)obj).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing;
			((Graphic)val3).color = color;
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.anchoredPosition = anchoredPosition;
			val2.pivot = pivot;
			val2.sizeDelta = size;
			return val2;
		}

		public static TextMeshProUGUI AddTextMeshPro(string text, float fontSize, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0055: 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)
			GameObject val = new GameObject("MyText");
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = size;
			TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = text;
			((TMP_Text)val3).fontSize = fontSize;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			val.transform.SetParent(parent, false);
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.pivot = pivot;
			val2.anchoredPosition = anchoredPosition;
			return val3;
		}

		public static ScrollRect AddScrollView(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00e1: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ScrollView");
			RectTransform obj = val.AddComponent<RectTransform>();
			((Transform)obj).SetParent(parent, false);
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.sizeDelta = size;
			obj.anchoredPosition = anchoredPosition;
			ScrollRect obj2 = val.AddComponent<ScrollRect>();
			obj2.scrollSensitivity = 25f;
			GameObject val2 = new GameObject("Mask");
			val2.transform.SetParent(val.transform, false);
			RectTransform val3 = val2.AddComponent<RectTransform>();
			val3.anchorMax = new Vector2(1f, 1f);
			val3.anchorMin = new Vector2(0f, 0f);
			val3.sizeDelta = Vector2.zero;
			((Graphic)val2.AddComponent<Image>()).color = Constants.colorBackGround;
			val2.AddComponent<Mask>();
			GameObject val4 = new GameObject("content");
			val4.transform.SetParent(val2.transform, false);
			val4.transform.localPosition = Vector3.zero;
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMax = new Vector2(1f, 1f);
			val5.anchorMin = new Vector2(0f, 0f);
			val5.pivot = new Vector2(0.5f, 1f);
			val5.offsetMin = Vector2.zero;
			val5.offsetMax = Vector2.zero;
			val3.sizeDelta = Vector2.zero;
			if (isVertical)
			{
				VerticalLayoutGroup obj3 = val4.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj3).spacing = spacing;
				ContentSizeFitter obj4 = val4.AddComponent<ContentSizeFitter>();
				obj4.verticalFit = (FitMode)2;
				obj4.horizontalFit = (FitMode)0;
			}
			else
			{
				HorizontalLayoutGroup obj5 = val4.AddComponent<HorizontalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj5).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj5).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)obj5).spacing = spacing;
				ContentSizeFitter obj6 = val4.AddComponent<ContentSizeFitter>();
				obj6.verticalFit = (FitMode)0;
				obj6.horizontalFit = (FitMode)2;
			}
			obj2.content = val5;
			obj2.horizontal = !isVertical;
			obj2.vertical = isVertical;
			obj2.viewport = val3;
			obj2.movementType = (MovementType)2;
			return obj2;
		}

		public static ScrollRect AddScrollViewGrid(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f, float childHeight = 100f, float childWidth = 100f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0069: Expected O, but got Unknown
			//IL_008d: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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)
			GameObject val = new GameObject("ScrollView");
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Transform)val2).SetParent(parent, false);
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.pivot = pivot;
			val2.sizeDelta = size + new Vector2(spacing, spacing);
			val2.anchoredPosition = anchoredPosition;
			ScrollRect obj = val.AddComponent<ScrollRect>();
			obj.scrollSensitivity = 25f;
			GameObject val3 = new GameObject("Mask");
			val3.transform.SetParent(val.transform, false);
			RectTransform val4 = val3.AddComponent<RectTransform>();
			val4.anchorMax = new Vector2(1f, 1f);
			val4.anchorMin = new Vector2(0f, 0f);
			val4.sizeDelta = Vector2.zero;
			((Graphic)val3.AddComponent<Image>()).color = Constants.colorBackGround;
			val3.AddComponent<Mask>();
			GameObject val5 = new GameObject("content");
			val5.transform.SetParent(val3.transform, false);
			val5.transform.localPosition = Vector3.zero;
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMax = new Vector2(1f, 1f);
			val6.anchorMin = new Vector2(0f, 0f);
			val6.pivot = new Vector2(0.5f, 1f);
			val6.offsetMin = Vector2.zero;
			val6.offsetMax = Vector2.zero;
			val4.sizeDelta = Vector2.zero;
			GridLayoutGroup val7 = val5.gameObject.AddComponent<GridLayoutGroup>();
			val7.spacing = new Vector2(spacing, spacing);
			val7.cellSize = new Vector2(childHeight, childWidth);
			Rect rect = val2.rect;
			int constraintCount = (int)Math.Floor(((Rect)(ref rect)).width / childWidth);
			rect = val2.rect;
			int constraintCount2 = (int)Math.Floor(((Rect)(ref rect)).height / childHeight);
			if (isVertical)
			{
				val7.constraint = (Constraint)1;
				val7.constraintCount = constraintCount;
			}
			else
			{
				val7.constraint = (Constraint)2;
				val7.constraintCount = constraintCount2;
			}
			ContentSizeFitter obj2 = val5.AddComponent<ContentSizeFitter>();
			obj2.horizontalFit = (FitMode)2;
			obj2.verticalFit = (FitMode)2;
			obj.content = val6;
			obj.horizontal = !isVertical;
			obj.vertical = isVertical;
			obj.viewport = val4;
			obj.movementType = (MovementType)2;
			return obj;
		}

		public static RectTransform AddGrid(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f, float childHeight = 100f, float childWidth = 100f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GridView");
			RectTransform obj = val.AddComponent<RectTransform>();
			((Transform)obj).SetParent(parent, false);
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.sizeDelta = size;
			obj.anchoredPosition = anchoredPosition;
			GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>();
			val2.spacing = new Vector2(spacing, spacing);
			val2.cellSize = new Vector2(childHeight, childWidth);
			Rect rect = obj.rect;
			int constraintCount = (int)Math.Floor(((Rect)(ref rect)).width / childWidth);
			rect = obj.rect;
			int constraintCount2 = (int)Math.Floor(((Rect)(ref rect)).height / childHeight);
			if (isVertical)
			{
				val2.constraint = (Constraint)1;
				val2.constraintCount = constraintCount;
			}
			else
			{
				val2.constraint = (Constraint)2;
				val2.constraintCount = constraintCount2;
			}
			ContentSizeFitter obj2 = val.AddComponent<ContentSizeFitter>();
			obj2.horizontalFit = (FitMode)2;
			obj2.verticalFit = (FitMode)2;
			return obj;
		}

		public static TMP_Dropdown CreateDropdown(string name, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color backgroundColor, List<string> values, UnityAction<int> callback)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0025: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL