Decompiled source of More Pickaxes v1.0.0

BepInEx\plugins\MorePickaxes\MorePickaxes.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MorePickaxes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MorePickaxes")]
[assembly: AssemblyTitle("MorePickaxes")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MorePickaxes
{
	internal static class ModConfig
	{
		internal static ConfigEntry<bool> RingLuckEnabled;

		internal static ConfigEntry<int> RingLuckCostPerLevel;

		internal static ConfigEntry<float> RingLuckCommonDelta;

		internal static ConfigEntry<float> RingLuckRareDelta;

		internal static ConfigEntry<float> RingLuckEpicDelta;

		internal static ConfigEntry<float> RingLuckLegendaryDelta;

		internal static ConfigEntry<bool> PickaxesEnabled;

		internal static ConfigEntry<float>[] HitsMultiplier;

		internal static ConfigEntry<float>[] DamageMultiplier;

		internal static ConfigEntry<int>[] MetaCost;

		internal static void Init(ConfigFile cfg)
		{
			RingLuckEnabled = cfg.Bind<bool>("RingLuck", "Enabled", true, "Show 'Senhor dos Anaeis' upgrade card in General tab.");
			RingLuckCostPerLevel = cfg.Bind<int>("RingLuck", "CostPerLevel", 250, "Meta-currency cost per upgrade level.");
			RingLuckCommonDelta = cfg.Bind<float>("RingLuck", "CommonWeightDeltaPerLevel", -0.0225f, "Common rarity weight change per level. Negative = less common items over time.");
			RingLuckRareDelta = cfg.Bind<float>("RingLuck", "RareWeightDeltaPerLevel", 0.01f, "Rare rarity weight change per level.");
			RingLuckEpicDelta = cfg.Bind<float>("RingLuck", "EpicWeightDeltaPerLevel", 0.008f, "Epic rarity weight change per level.");
			RingLuckLegendaryDelta = cfg.Bind<float>("RingLuck", "LegendaryWeightDeltaPerLevel", 0.0045f, "Legendary rarity weight change per level.");
			PickaxesEnabled = cfg.Bind<bool>("Pickaxes", "Enabled", true, "Show Pickaxes tab in pre-run shop.");
			int num = PickaxeDefinitions.All.Length;
			HitsMultiplier = new ConfigEntry<float>[num];
			DamageMultiplier = new ConfigEntry<float>[num];
			MetaCost = new ConfigEntry<int>[num];
			for (int i = 0; i < num; i++)
			{
				PickaxeDef pickaxeDef = PickaxeDefinitions.All[i];
				string text = "Pickaxe_" + pickaxeDef.ItemID;
				HitsMultiplier[i] = cfg.Bind<float>(text, "HitsMultiplier", pickaxeDef.HitsMultiplier, "Multiplier on hitsPerDig. <1 = fewer hits = faster mining.");
				DamageMultiplier[i] = cfg.Bind<float>(text, "DamageMultiplier", pickaxeDef.DamageMultiplier, "Multiplier on base damage. >1 = more power per swing.");
				MetaCost[i] = cfg.Bind<int>(text, "MetaCost", pickaxeDef.MetaCost, "Meta-currency cost to purchase this tier.");
			}
		}
	}
	internal class PickaxeAnimator : MonoBehaviour
	{
		private MeshRenderer[] _renderers;

		private float _hue;

		internal void Init(MeshRenderer[] renderers)
		{
			_renderers = renderers;
		}

		private void Update()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (_renderers == null)
			{
				return;
			}
			_hue = (_hue + Time.deltaTime * 0.2f) % 1f;
			Color val = Color.HSVToRGB(_hue, 0.9f, 1f);
			Color val2 = val * 1.5f;
			MaterialPropertyBlock val3 = new MaterialPropertyBlock();
			MeshRenderer[] renderers = _renderers;
			foreach (MeshRenderer val4 in renderers)
			{
				if (!((Object)(object)val4 == (Object)null))
				{
					((Renderer)val4).GetPropertyBlock(val3);
					val3.SetColor("_BaseColor", val);
					val3.SetColor("_Color", val);
					val3.SetColor("_EmissionColor", val2);
					((Renderer)val4).SetPropertyBlock(val3);
				}
			}
		}
	}
	internal struct PickaxeDef
	{
		internal string ItemID;

		internal string DisplayName;

		internal float HitsMultiplier;

		internal float DamageMultiplier;

		internal int MetaCost;

		internal PickaxeDef(string itemID, string displayName, float hitsMultiplier, float damageMultiplier, int metaCost)
		{
			ItemID = itemID;
			DisplayName = displayName;
			HitsMultiplier = hitsMultiplier;
			DamageMultiplier = damageMultiplier;
			MetaCost = metaCost;
		}
	}
	internal static class PickaxeDefinitions
	{
		internal static readonly PickaxeDef[] All = new PickaxeDef[11]
		{
			new PickaxeDef("sw_pickaxe_caiua", "Caiua Pica Reta", 0.86f, 0.9f, 115),
			new PickaxeDef("sw_pickaxe_kaue", "Kaue Pica Reta", 0.68f, 1.05f, 290),
			new PickaxeDef("sw_pickaxe_seidy", "Seidy Pica Reta", 0.62f, 1.2f, 575),
			new PickaxeDef("sw_pickaxe_takanari", "Takanari Pica Reta", 0.5f, 1.35f, 1150),
			new PickaxeDef("sw_pickaxe_vinicius", "Vinicius Pica Reta", 0.44f, 1.5f, 2300),
			new PickaxeDef("sw_pickaxe_vini_kpop", "Vini KpopSPFC", 0.33f, 1.875f, 4025),
			new PickaxeDef("sw_pickaxe_taka_taka", "Taka taka taka", 0.28f, 2.4f, 6900),
			new PickaxeDef("sw_pickaxe_seidelas", "Seidelas magicks", 0.17f, 2.85f, 11500),
			new PickaxeDef("sw_pickaxe_kue_cruel", "Kue cruel e-girls", 0.1f, 3.3f, 18400),
			new PickaxeDef("sw_pickaxe_rap_utida", "RAP n shit, Utida", 0.056f, 3.75f, 28750),
			new PickaxeDef("sw_pickaxe_uniao", "Uniao faz acucar", 0.001f, 7.5f, 57500)
		};

		internal static int IndexOf(string itemID)
		{
			for (int i = 0; i < All.Length; i++)
			{
				if (All[i].ItemID == itemID)
				{
					return i;
				}
			}
			return -1;
		}
	}
	internal static class PickaxeEquipState
	{
		private const string PrefKey = "sw_pickaxe_equipped";

		internal static string EquippedID
		{
			get
			{
				return PlayerPrefs.GetString("sw_pickaxe_equipped", "");
			}
			set
			{
				PlayerPrefs.SetString("sw_pickaxe_equipped", value);
				PlayerPrefs.Save();
			}
		}

		internal static bool TryGetDef(out PickaxeDef def)
		{
			string equippedID = EquippedID;
			PickaxeDef[] all = PickaxeDefinitions.All;
			for (int i = 0; i < all.Length; i++)
			{
				PickaxeDef pickaxeDef = all[i];
				if (pickaxeDef.ItemID == equippedID)
				{
					def = pickaxeDef;
					return true;
				}
			}
			def = default(PickaxeDef);
			return false;
		}
	}
	internal class PickaxeUnlockable : ScriptableObject, IUnlockable
	{
		private string _itemID;

		private PickaxeDef Def
		{
			get
			{
				PickaxeDef[] all = PickaxeDefinitions.All;
				for (int i = 0; i < all.Length; i++)
				{
					PickaxeDef result = all[i];
					if (result.ItemID == _itemID)
					{
						return result;
					}
				}
				return default(PickaxeDef);
			}
		}

		public string ID => _itemID;

		public int MetaCurrencyCost
		{
			get
			{
				int num = PickaxeDefinitions.IndexOf(_itemID);
				return (num >= 0 && ModConfig.MetaCost != null) ? ModConfig.MetaCost[num].Value : Def.MetaCost;
			}
		}

		public bool Unlockable => true;

		public UnlockableCategory Category => (UnlockableCategory)4;

		public Sprite Icon => null;

		internal static PickaxeUnlockable Create(PickaxeDef def)
		{
			PickaxeUnlockable pickaxeUnlockable = ScriptableObject.CreateInstance<PickaxeUnlockable>();
			pickaxeUnlockable._itemID = def.ItemID;
			return pickaxeUnlockable;
		}

		public string GetLocalizedTitle()
		{
			return Def.DisplayName;
		}

		public string GetLocalizedDescription()
		{
			PickaxeDef def = Def;
			int num = Mathf.RoundToInt((1f / def.HitsMultiplier - 1f) * 100f);
			int num2 = Mathf.RoundToInt((def.DamageMultiplier - 1f) * 100f);
			return $"+{num}% swing speed  +{num2}% dig power";
		}
	}
	internal static class PickaxeUnlockables
	{
		private static readonly Dictionary<string, PickaxeUnlockable> Cache = new Dictionary<string, PickaxeUnlockable>();

		internal static PickaxeUnlockable Get(PickaxeDef def)
		{
			if (!Cache.TryGetValue(def.ItemID, out var value))
			{
				value = PickaxeUnlockable.Create(def);
				Cache[def.ItemID] = value;
			}
			return value;
		}

		internal static bool IsAcquired(PickaxeDef def)
		{
			UnlockableManager instance = UnlockableManager.Instance;
			return instance != null && instance.IsItemAcquired((IUnlockable)(object)Get(def));
		}
	}
	internal class PickaxeVisualDriver : MonoBehaviour
	{
		private EquippedItem _item;

		private MeshRenderer[] _renderers;

		private string _lastID;

		private static bool _iconRefreshing;

		internal void Init(EquippedItem item)
		{
			_item = item;
			_renderers = ((Component)item).GetComponentsInChildren<MeshRenderer>();
			Apply();
		}

		private void Update()
		{
			if (!((Object)(object)_item == (Object)null))
			{
				string equippedID = PickaxeEquipState.EquippedID;
				if (!(equippedID == _lastID))
				{
					_renderers = ((Component)_item).GetComponentsInChildren<MeshRenderer>();
					Apply();
				}
			}
		}

		private void Apply()
		{
			_lastID = PickaxeEquipState.EquippedID;
			if (!PickaxeEquipState.TryGetDef(out var def))
			{
				return;
			}
			int num = PickaxeDefinitions.IndexOf(def.ItemID);
			if (num >= 0)
			{
				MeshRenderer[] renderers = _renderers;
				foreach (MeshRenderer r in renderers)
				{
					PickaxeVisuals.ApplyPropertyBlock(r, num);
				}
				PickaxeAnimator component = ((Component)_item).GetComponent<PickaxeAnimator>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				if (PickaxeVisuals.All[num].IsAnimated)
				{
					PickaxeAnimator pickaxeAnimator = ((Component)_item).gameObject.AddComponent<PickaxeAnimator>();
					pickaxeAnimator.Init(_renderers);
				}
				if ((Object)(object)_item.ItemAnimator != (Object)null)
				{
					float num2 = Mathf.Min(1f / def.HitsMultiplier, 3f);
					_item.ItemAnimator.speed = 1f + (num2 - 1f) * 0.4f;
				}
				RefreshInventoryIcon(def);
			}
		}

		private void RefreshInventoryIcon(PickaxeDef def)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			if (_iconRefreshing)
			{
				return;
			}
			Sprite icon = PickaxeVisuals.GetIcon(def);
			if ((Object)(object)icon == (Object)null || (Object)(object)_item.ItemDataSO == (Object)null)
			{
				return;
			}
			_item.ItemDataSO.itemIcon = icon;
			FirstPersonController player = _item.Player;
			InventorySystem val = ((player != null) ? player.InventorySystem : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			for (int i = 0; i < val.InventoryEntries.Count; i++)
			{
				InventoryEntry val2 = val.InventoryEntries[i];
				if (val2.itemID == "PickaxeTool")
				{
					_iconRefreshing = true;
					try
					{
						val.OnEquipmentChanged?.Invoke(_item.Player.playerID, i, "PickaxeTool", val2.count);
						break;
					}
					finally
					{
						_iconRefreshing = false;
					}
				}
			}
		}
	}
	internal struct PickaxeVisualDef
	{
		internal Color TintA;

		internal Color TintB;

		internal Color GlowColor;

		internal float Metallic;

		internal float Smoothness;

		internal bool IsGradient;

		internal bool IsAnimated;
	}
	internal static class PickaxeVisuals
	{
		internal static readonly PickaxeVisualDef[] All = new PickaxeVisualDef[11]
		{
			new PickaxeVisualDef
			{
				TintA = new Color(0.75f, 0.75f, 0.8f),
				GlowColor = Color.black,
				Metallic = 0.2f,
				Smoothness = 0.3f
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.7f, 0.78f, 0.95f),
				GlowColor = Color.black,
				Metallic = 0.5f,
				Smoothness = 0.5f
			},
			new PickaxeVisualDef
			{
				TintA = new Color(1f, 0.78f, 0.25f),
				GlowColor = Color.black,
				Metallic = 0.6f,
				Smoothness = 0.5f
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.25f, 0.9f, 0.45f),
				GlowColor = Color.black,
				Metallic = 0.4f,
				Smoothness = 0.4f
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.25f, 0.5f, 1f),
				GlowColor = Color.black,
				Metallic = 0.5f,
				Smoothness = 0.6f
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.8f, 0.1f, 0.8f),
				TintB = new Color(0.1f, 0.9f, 0.9f),
				GlowColor = new Color(1f, 0.2f, 0.8f) * 0.6f,
				Metallic = 0.8f,
				Smoothness = 0.8f,
				IsGradient = true
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.1f, 0.3f, 1f),
				TintB = new Color(0.8f, 0.95f, 1f),
				GlowColor = new Color(0.2f, 0.8f, 1f) * 0.7f,
				Metallic = 0.9f,
				Smoothness = 0.85f,
				IsGradient = true
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.2f, 0f, 0.5f),
				TintB = new Color(0.7f, 0.3f, 1f),
				GlowColor = new Color(0.5f, 0.1f, 1f) * 0.7f,
				Metallic = 0.7f,
				Smoothness = 0.9f,
				IsGradient = true
			},
			new PickaxeVisualDef
			{
				TintA = new Color(1f, 0.1f, 0.5f),
				TintB = new Color(0.8f, 0.6f, 1f),
				GlowColor = new Color(1f, 0.2f, 0.6f) * 0.9f,
				Metallic = 0.85f,
				Smoothness = 0.85f,
				IsGradient = true
			},
			new PickaxeVisualDef
			{
				TintA = new Color(0.05f, 0.05f, 0.05f),
				TintB = new Color(1f, 0.8f, 0.1f),
				GlowColor = new Color(1f, 0.7f, 0f) * 1f,
				Metallic = 1f,
				Smoothness = 0.9f,
				IsGradient = true
			},
			new PickaxeVisualDef
			{
				GlowColor = new Color(1f, 1f, 1f) * 1.5f,
				Metallic = 1f,
				Smoothness = 1f,
				IsAnimated = true
			}
		};

		private static Texture2D _sourceTexture;

		private static readonly Dictionary<string, Sprite> _iconCache = new Dictionary<string, Sprite>();

		private static readonly Dictionary<string, Texture2D> _texCache = new Dictionary<string, Texture2D>();

		private static readonly Dictionary<string, Texture2D> _mesh3DTexCache = new Dictionary<string, Texture2D>();

		private static readonly HashSet<string> _skipTexProps = new HashSet<string> { "_BumpMap", "_NormalMap", "_EmissionMap", "_MetallicGlossMap", "_OcclusionMap", "_DetailNormalMap", "_DetailMask", "_ParallaxMap" };

		internal static Texture2D GetSourceTexture()
		{
			if ((Object)(object)_sourceTexture != (Object)null)
			{
				return _sourceTexture;
			}
			ItemDataSO[] array = Resources.FindObjectsOfTypeAll<ItemDataSO>();
			foreach (ItemDataSO val in array)
			{
				if (val.itemID == "PickaxeTool" && (Object)(object)val.itemIcon != (Object)null)
				{
					_sourceTexture = EnsureReadable(val.itemIcon.texture);
					return _sourceTexture;
				}
			}
			return null;
		}

		internal static bool TryGetCachedIcon(string itemID, out Sprite sprite)
		{
			return _iconCache.TryGetValue(itemID, out sprite);
		}

		internal static Sprite GetIcon(PickaxeDef def)
		{
			//IL_0053: 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)
			if (_iconCache.TryGetValue(def.ItemID, out var value))
			{
				return value;
			}
			Texture2D orBuildTexture = GetOrBuildTexture(def.ItemID);
			if ((Object)(object)orBuildTexture == (Object)null)
			{
				return null;
			}
			Sprite val = Sprite.Create(orBuildTexture, new Rect(0f, 0f, (float)((Texture)orBuildTexture).width, (float)((Texture)orBuildTexture).height), new Vector2(0.5f, 0.5f));
			_iconCache[def.ItemID] = val;
			return val;
		}

		internal static Texture2D GetOrBuildTexture(string itemID)
		{
			if (_texCache.TryGetValue(itemID, out var value))
			{
				return value;
			}
			Texture2D sourceTexture = GetSourceTexture();
			if ((Object)(object)sourceTexture == (Object)null)
			{
				return null;
			}
			int num = PickaxeDefinitions.IndexOf(itemID);
			if (num < 0 || num >= All.Length)
			{
				return null;
			}
			Texture2D val = BuildTexture(sourceTexture, All[num]);
			_texCache[itemID] = val;
			return val;
		}

		internal static Texture2D BuildMeshTexture(Texture2D srcTex, string itemID)
		{
			if (_mesh3DTexCache.TryGetValue(itemID, out var value))
			{
				return value;
			}
			int num = PickaxeDefinitions.IndexOf(itemID);
			if (num < 0 || num >= All.Length)
			{
				return null;
			}
			Texture2D src = EnsureReadable(srcTex);
			Texture2D val = BuildTexture(src, All[num]);
			_mesh3DTexCache[itemID] = val;
			return val;
		}

		internal static void ApplyPropertyBlock(MeshRenderer r, int idx)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			if (idx < 0 || idx >= All.Length)
			{
				return;
			}
			PickaxeVisualDef def = All[idx];
			Material sharedMaterial = ((Renderer)r).sharedMaterial;
			if ((Object)(object)sharedMaterial == (Object)null || (Object)(object)sharedMaterial.shader == (Object)null)
			{
				return;
			}
			MaterialPropertyBlock val = new MaterialPropertyBlock();
			((Renderer)r).GetPropertyBlock(val);
			if (!def.IsAnimated)
			{
				Texture2D val2 = null;
				string text = null;
				try
				{
					string[] texturePropertyNames = sharedMaterial.GetTexturePropertyNames();
					foreach (string text2 in texturePropertyNames)
					{
						if (!_skipTexProps.Contains(text2))
						{
							Texture texture = sharedMaterial.GetTexture(text2);
							Texture2D val3 = (Texture2D)(object)((texture is Texture2D) ? texture : null);
							if (val3 != null && (Object)(object)val3 != (Object)null)
							{
								val2 = val3;
								text = text2;
								break;
							}
						}
					}
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("[PVD] texture scan failed on '" + ((Object)sharedMaterial).name + "': " + ex.Message));
				}
				bool flag = false;
				if ((Object)(object)val2 != (Object)null && text != null)
				{
					string key = $"{((Object)val2).GetInstanceID()}_{idx}";
					if (!_mesh3DTexCache.TryGetValue(key, out var value))
					{
						try
						{
							value = BuildTexture(EnsureReadable(val2), def);
						}
						catch (Exception ex2)
						{
							Plugin.Log.LogWarning((object)("[PVD] BuildTexture failed: " + ex2.Message));
							value = null;
						}
						_mesh3DTexCache[key] = value;
					}
					if ((Object)(object)value != (Object)null)
					{
						val.SetTexture(text, (Texture)(object)value);
						flag = true;
					}
				}
				if (!flag)
				{
					Color val4 = (def.IsGradient ? Color.Lerp(def.TintA, def.TintB, 0.5f) : def.TintA);
					val.SetColor("_BaseColor", val4);
					val.SetColor("_Color", val4);
				}
			}
			else
			{
				val.SetColor("_BaseColor", Color.white);
				val.SetColor("_Color", Color.white);
			}
			if (def.GlowColor != Color.black)
			{
				val.SetColor("_EmissionColor", def.GlowColor);
				sharedMaterial.EnableKeyword("_EMISSION");
			}
			val.SetFloat("_Metallic", def.Metallic);
			val.SetFloat("_Glossiness", def.Smoothness);
			val.SetFloat("_Smoothness", def.Smoothness);
			((Renderer)r).SetPropertyBlock(val);
		}

		internal static void ApplyTint(Material mat, int idx)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (idx >= 0 && idx < All.Length)
			{
				PickaxeVisualDef pickaxeVisualDef = All[idx];
				Color c = (pickaxeVisualDef.IsAnimated ? Color.white : (pickaxeVisualDef.IsGradient ? Color.Lerp(pickaxeVisualDef.TintA, pickaxeVisualDef.TintB, 0.5f) : pickaxeVisualDef.TintA));
				SetColor(mat, c);
				if (pickaxeVisualDef.GlowColor != Color.black)
				{
					mat.EnableKeyword("_EMISSION");
					mat.SetColor("_EmissionColor", pickaxeVisualDef.GlowColor);
				}
				if (mat.HasProperty("_Metallic"))
				{
					mat.SetFloat("_Metallic", pickaxeVisualDef.Metallic);
				}
				if (mat.HasProperty("_Glossiness"))
				{
					mat.SetFloat("_Glossiness", pickaxeVisualDef.Smoothness);
				}
				else if (mat.HasProperty("_Smoothness"))
				{
					mat.SetFloat("_Smoothness", pickaxeVisualDef.Smoothness);
				}
			}
		}

		internal static void ApplyToMaterial(Material mat, int idx)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			if (idx >= 0 && idx < All.Length)
			{
				PickaxeVisualDef pickaxeVisualDef = All[idx];
				SetColor(mat, Color.white);
				if (pickaxeVisualDef.GlowColor != Color.black)
				{
					mat.EnableKeyword("_EMISSION");
					mat.SetColor("_EmissionColor", pickaxeVisualDef.GlowColor);
				}
				SetFloat(mat, "_Metallic", "_Metallic", pickaxeVisualDef.Metallic);
				SetFloat(mat, "_Glossiness", "_Smoothness", pickaxeVisualDef.Smoothness);
			}
		}

		private static Texture2D BuildTexture(Texture2D src, PickaxeVisualDef def)
		{
			//IL_001b: 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_0027: 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_0042: 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_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_005f: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			Color[] pixels = src.GetPixels();
			Color[] array = (Color[])(object)new Color[pixels.Length];
			for (int i = 0; i < pixels.Length; i++)
			{
				Color val = pixels[i];
				float num = 0.299f * val.r + 0.587f * val.g + 0.114f * val.b;
				if (IsHandlePixel(val, num))
				{
					array[i] = val;
				}
				else if (def.IsAnimated)
				{
					array[i] = new Color(num, num, num, val.a);
				}
				else if (def.IsGradient)
				{
					Color val2 = Color.Lerp(def.TintA, def.TintB, num);
					array[i] = new Color(val2.r, val2.g, val2.b, val.a);
				}
				else
				{
					array[i] = new Color(num * def.TintA.r, num * def.TintA.g, num * def.TintA.b, val.a);
				}
			}
			Texture2D val3 = new Texture2D(((Texture)src).width, ((Texture)src).height, (TextureFormat)4, false);
			val3.SetPixels(array);
			val3.Apply();
			return val3;
		}

		private static bool IsHandlePixel(Color p, float lum)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			if (p.a < 0.05f)
			{
				return true;
			}
			if (lum < 0.08f)
			{
				return true;
			}
			float num = p.r - p.b;
			float num2 = Mathf.Max(new float[3] { p.r, p.g, p.b }) - Mathf.Min(new float[3] { p.r, p.g, p.b });
			return num > 0.08f && num2 > 0.06f;
		}

		private static Texture2D EnsureReadable(Texture2D src)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (((Texture)src).isReadable)
			{
				return src;
			}
			RenderTexture temporary = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height, 0, (RenderTextureFormat)0);
			Graphics.Blit((Texture)(object)src, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(((Texture)src).width, ((Texture)src).height, (TextureFormat)4, false);
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)src).width, (float)((Texture)src).height), 0, 0);
			val.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			return val;
		}

		private static void SetColor(Material mat, Color c)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (mat.HasProperty("_BaseColor"))
			{
				mat.SetColor("_BaseColor", c);
			}
			else
			{
				mat.color = c;
			}
		}

		private static void SetFloat(Material mat, string standard, string urp, float v)
		{
			if (mat.HasProperty(standard))
			{
				mat.SetFloat(standard, v);
			}
			else if (mat.HasProperty(urp))
			{
				mat.SetFloat(urp, v);
			}
		}
	}
	[BepInPlugin("stonewards.morepickaxes", "More Pickaxes", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string GUID = "stonewards.morepickaxes";

		internal const string Name = "More Pickaxes";

		internal const string Version = "1.0.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			new Harmony("stonewards.morepickaxes").PatchAll();
			Log.LogInfo((object)"More Pickaxes v1.0.0 loaded");
		}
	}
	internal class RingLuckUpgradable : ScriptableObject, IUpgradable, IUnlockable
	{
		private static RingLuckUpgradable _instance;

		private static Sprite _ringIcon;

		internal static RingLuckUpgradable Instance
		{
			get
			{
				if ((Object)(object)_instance == (Object)null)
				{
					_instance = ScriptableObject.CreateInstance<RingLuckUpgradable>();
				}
				return _instance;
			}
		}

		private int CurrentLevel
		{
			get
			{
				UnlockableManager instance = UnlockableManager.Instance;
				return (instance != null) ? instance.GetUpgradableLevel((IUpgradable)(object)this) : 0;
			}
		}

		public string ID => "sw_ring_luck";

		public bool Unlockable => true;

		public int MaxLevel => 20;

		public UnlockableCategory Category => (UnlockableCategory)4;

		public Sprite Icon
		{
			get
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Invalid comparison between Unknown and I4
				if ((Object)(object)_ringIcon != (Object)null)
				{
					return _ringIcon;
				}
				RogueLikeUpgradeSO[] array = Resources.FindObjectsOfTypeAll<RogueLikeUpgradeSO>();
				foreach (RogueLikeUpgradeSO val in array)
				{
					if ((int)val.UpgradeCategory == 1 && (Object)(object)((BaseUpgradeSO)val).Icon != (Object)null)
					{
						_ringIcon = ((BaseUpgradeSO)val).Icon;
						return _ringIcon;
					}
				}
				return null;
			}
		}

		public int MetaCurrencyCost => GetMetaCurrencyCost(CurrentLevel);

		public int GetMetaCurrencyCost(int nextLevel)
		{
			return ModConfig.RingLuckCostPerLevel?.Value ?? 250;
		}

		public string GetLocalizedTitle()
		{
			return "Senhor dos Anaeis";
		}

		public string GetLocalizedDescription()
		{
			int currentLevel = CurrentLevel;
			if (currentLevel >= MaxLevel)
			{
				return "MAX: Rare+ rings appear much more often during level-ups.";
			}
			float num = ModConfig.RingLuckRareDelta?.Value ?? 0.01f;
			float num2 = ModConfig.RingLuckEpicDelta?.Value ?? 0.008f;
			float num3 = ModConfig.RingLuckLegendaryDelta?.Value ?? 0.0045f;
			int num4 = Mathf.RoundToInt((0.1f + num * (float)currentLevel) * 100f);
			int num5 = Mathf.RoundToInt((0.04f + num2 * (float)currentLevel) * 100f);
			int num6 = Mathf.RoundToInt((0.01f + num3 * (float)currentLevel) * 100f);
			return $"Level {currentLevel}/{MaxLevel}\n" + $"Rare {num4}%  Epic {num5}%  Legendary {num6}%";
		}
	}
}
namespace MorePickaxes.Patches
{
	[HarmonyPatch(typeof(ItemSlotBase), "Set")]
	internal static class InventoryBagIconPatch
	{
		[HarmonyPostfix]
		private static void Postfix(ItemSlotBase __instance, ItemDataSO _ItemDataSO)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!(_ItemDataSO?.itemID != "PickaxeTool") && PickaxeEquipState.TryGetDef(out var def) && PickaxeVisuals.TryGetCachedIcon(def.ItemID, out var sprite))
				{
					__instance.SlotIcon.style.backgroundImage = StyleBackground.op_Implicit(sprite.texture);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[InventoryBagIconPatch] " + ex.Message));
			}
		}
	}
	[HarmonyPatch(typeof(InventoryBarSlot), "SetVisuals")]
	internal static class HotbarIconPatch
	{
		[HarmonyPostfix]
		private static void Postfix(InventoryBarSlot __instance, ItemDataSO _itemData)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!(_itemData?.itemID != "PickaxeTool") && PickaxeEquipState.TryGetDef(out var def) && PickaxeVisuals.TryGetCachedIcon(def.ItemID, out var sprite))
				{
					__instance.itemElement.style.backgroundImage = new StyleBackground(sprite.texture);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HotbarIconPatch] " + ex.Message));
			}
		}
	}
	[HarmonyPatch(typeof(DiggingToolDataSO), "GetHitsPerDig")]
	internal static class DiggingToolHitsPatch
	{
		[HarmonyPostfix]
		private static void Postfix(DiggingToolDataSO __instance, ref float __result)
		{
			if (!(__result < 0f) && !(((ItemDataSO)__instance).itemID != "PickaxeTool") && PickaxeEquipState.TryGetDef(out var def))
			{
				int num = PickaxeDefinitions.IndexOf(def.ItemID);
				float num2 = ((num >= 0 && ModConfig.HitsMultiplier != null) ? ModConfig.HitsMultiplier[num].Value : def.HitsMultiplier);
				float num3 = ((num >= 0 && ModConfig.DamageMultiplier != null) ? ModConfig.DamageMultiplier[num].Value : def.DamageMultiplier);
				__result = Mathf.Max(1f, __result * num2 / num3);
			}
		}
	}
	[HarmonyPatch(typeof(ItemDataSO), "GetLocalizedName")]
	internal static class PickaxeNamePatch
	{
		[HarmonyPrefix]
		private static bool Prefix(ItemDataSO __instance, ref string __result)
		{
			if (__instance.itemID != "PickaxeTool")
			{
				return true;
			}
			if (!PickaxeEquipState.TryGetDef(out var def))
			{
				return true;
			}
			__result = def.DisplayName;
			return false;
		}
	}
	[HarmonyPatch(typeof(EquippedItem), "SetPlayer")]
	internal static class PickaxeVisualPatch
	{
		[HarmonyPostfix]
		private static void Postfix(EquippedItem __instance, bool _IsLocalPlayer)
		{
			if (!_IsLocalPlayer || __instance.ItemDataSO?.itemID != "PickaxeTool")
			{
				return;
			}
			try
			{
				PickaxeVisualDriver component = ((Component)__instance).GetComponent<PickaxeVisualDriver>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				PickaxeVisualDriver pickaxeVisualDriver = ((Component)__instance).gameObject.AddComponent<PickaxeVisualDriver>();
				pickaxeVisualDriver.Init(__instance);
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[PickaxeVisualPatch] {arg}");
			}
		}
	}
	[HarmonyPatch(typeof(RogueLikeUpgradeManager), "GetRarityWeight")]
	internal static class RarityWeightPatch
	{
		[HarmonyPostfix]
		private static void Postfix([HarmonyArgument(0)] Rarity rarity, ref float __result)
		{
			//IL_0035: 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_0038: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected I4, but got Unknown
			if ((Object)(object)UnlockableManager.Instance == (Object)null)
			{
				return;
			}
			int upgradableLevel = UnlockableManager.Instance.GetUpgradableLevel((IUpgradable)(object)RingLuckUpgradable.Instance);
			if (upgradableLevel > 0)
			{
				switch ((int)rarity)
				{
				case 0:
					__result = Mathf.Max(0f, __result + (ModConfig.RingLuckCommonDelta?.Value ?? (-0.0225f)) * (float)upgradableLevel);
					break;
				case 2:
					__result += (ModConfig.RingLuckRareDelta?.Value ?? 0.01f) * (float)upgradableLevel;
					break;
				case 3:
					__result += (ModConfig.RingLuckEpicDelta?.Value ?? 0.008f) * (float)upgradableLevel;
					break;
				case 4:
					__result += (ModConfig.RingLuckLegendaryDelta?.Value ?? 0.0045f) * (float)upgradableLevel;
					break;
				case 1:
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShopMenu), "InitUnlockablesAndUpgradables")]
	internal static class RingLuckShopPatch
	{
		[HarmonyPostfix]
		private static void Postfix(ShopMenu __instance)
		{
			if (ModConfig.RingLuckEnabled != null && !ModConfig.RingLuckEnabled.Value)
			{
				return;
			}
			try
			{
				List<IUpgradable> value = Traverse.Create((object)__instance).Field<List<IUpgradable>>("upgradables").Value;
				if (value != null && !value.Contains((IUpgradable)(object)RingLuckUpgradable.Instance))
				{
					value.Add((IUpgradable)(object)RingLuckUpgradable.Instance);
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[RingLuckShopPatch] {arg}");
			}
		}
	}
	[HarmonyPatch(typeof(ShopMenu), "RebuildShopButtons")]
	internal static class ShopMenuPatch
	{
		private static VisualElement _pickaxesContainer;

		[HarmonyPostfix]
		private static void Postfix(ShopMenu __instance)
		{
			try
			{
				RebuildPickaxesTab(__instance);
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[ShopMenuPatch] {arg}");
			}
		}

		private static void RebuildPickaxesTab(ShopMenu instance)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfig.PickaxesEnabled != null && !ModConfig.PickaxesEnabled.Value)
			{
				return;
			}
			VisualElement value = Traverse.Create((object)instance).Field<VisualElement>("menuParent").Value;
			if (value == null)
			{
				return;
			}
			TabView val = UQueryExtensions.Q<TabView>(value, (string)null, (string)null);
			if (val != null)
			{
				if (_pickaxesContainer == null || _pickaxesContainer.panel == null)
				{
					Tab val2 = new Tab
					{
						label = "Pickaxes"
					};
					ScrollView val3 = new ScrollView((ScrollViewMode)0);
					((VisualElement)val3).style.flexGrow = StyleFloat.op_Implicit(1f);
					_pickaxesContainer = new VisualElement();
					_pickaxesContainer.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
					_pickaxesContainer.style.flexWrap = StyleEnum<Wrap>.op_Implicit((Wrap)1);
					_pickaxesContainer.style.paddingTop = StyleLength.op_Implicit(8f);
					_pickaxesContainer.style.paddingLeft = StyleLength.op_Implicit(8f);
					((VisualElement)val3).Add(_pickaxesContainer);
					((VisualElement)val2).Add((VisualElement)(object)val3);
					((VisualElement)val).Add((VisualElement)(object)val2);
				}
				_pickaxesContainer.Clear();
				PickaxeDef[] all = PickaxeDefinitions.All;
				foreach (PickaxeDef def in all)
				{
					_pickaxesContainer.Add(BuildCard(def, instance));
				}
			}
		}

		private static VisualElement BuildCard(PickaxeDef def, ShopMenu instance)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00d1: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: 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_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Expected O, but got Unknown
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Expected O, but got Unknown
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Expected O, but got Unknown
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			int num = PickaxeDefinitions.IndexOf(def.ItemID);
			float num2 = ((num >= 0 && ModConfig.HitsMultiplier != null) ? ModConfig.HitsMultiplier[num].Value : def.HitsMultiplier);
			float num3 = ((num >= 0 && ModConfig.DamageMultiplier != null) ? ModConfig.DamageMultiplier[num].Value : def.DamageMultiplier);
			int cost = ((num >= 0 && ModConfig.MetaCost != null) ? ModConfig.MetaCost[num].Value : def.MetaCost);
			bool flag = PickaxeUnlockables.IsAcquired(def);
			bool flag2 = PickaxeEquipState.EquippedID == def.ItemID;
			VisualElement val = new VisualElement();
			val.style.width = StyleLength.op_Implicit(130f);
			val.style.minHeight = StyleLength.op_Implicit(160f);
			val.style.marginTop = StyleLength.op_Implicit(6f);
			val.style.marginBottom = StyleLength.op_Implicit(6f);
			val.style.marginLeft = StyleLength.op_Implicit(6f);
			val.style.marginRight = StyleLength.op_Implicit(6f);
			val.style.paddingTop = StyleLength.op_Implicit(8f);
			val.style.paddingBottom = StyleLength.op_Implicit(8f);
			val.style.paddingLeft = StyleLength.op_Implicit(8f);
			val.style.paddingRight = StyleLength.op_Implicit(8f);
			val.style.backgroundColor = new StyleColor(new Color(0.15f, 0.15f, 0.15f, 0.9f));
			val.style.borderTopLeftRadius = StyleLength.op_Implicit(6f);
			val.style.borderTopRightRadius = StyleLength.op_Implicit(6f);
			val.style.borderBottomLeftRadius = StyleLength.op_Implicit(6f);
			val.style.borderBottomRightRadius = StyleLength.op_Implicit(6f);
			if (flag2)
			{
				val.style.borderTopWidth = StyleFloat.op_Implicit(2f);
				val.style.borderBottomWidth = StyleFloat.op_Implicit(2f);
				val.style.borderLeftWidth = StyleFloat.op_Implicit(2f);
				val.style.borderRightWidth = StyleFloat.op_Implicit(2f);
				val.style.borderTopColor = new StyleColor(Color.yellow);
				val.style.borderBottomColor = new StyleColor(Color.yellow);
				val.style.borderLeftColor = new StyleColor(Color.yellow);
				val.style.borderRightColor = new StyleColor(Color.yellow);
			}
			Image val2 = new Image();
			val2.sprite = PickaxeVisuals.GetIcon(def);
			((VisualElement)val2).style.width = StyleLength.op_Implicit(64f);
			((VisualElement)val2).style.height = StyleLength.op_Implicit(64f);
			((VisualElement)val2).style.alignSelf = StyleEnum<Align>.op_Implicit((Align)2);
			val.Add((VisualElement)(object)val2);
			Label val3 = new Label(def.DisplayName);
			((VisualElement)val3).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0);
			((VisualElement)val3).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4);
			((VisualElement)val3).style.marginTop = StyleLength.op_Implicit(4f);
			val.Add((VisualElement)(object)val3);
			int num4 = Mathf.RoundToInt((1f / num2 - 1f) * 100f);
			int num5 = Mathf.RoundToInt((num3 - 1f) * 100f);
			Label val4 = new Label($"+{num4}% speed\n+{num5}% power");
			((VisualElement)val4).style.fontSize = StyleLength.op_Implicit(10f);
			((VisualElement)val4).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0);
			((VisualElement)val4).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4);
			((VisualElement)val4).style.marginTop = StyleLength.op_Implicit(2f);
			val.Add((VisualElement)(object)val4);
			Button val5;
			if (!flag)
			{
				val5 = new Button((Action)delegate
				{
					if (ResourceManager.HasMoney(cost))
					{
						UnlockableManager.Instance.AcquireObject((IUnlockable)(object)PickaxeUnlockables.Get(def), false);
						if (string.IsNullOrEmpty(PickaxeEquipState.EquippedID))
						{
							PickaxeEquipState.EquippedID = def.ItemID;
						}
						RebuildPickaxesTab(instance);
					}
				})
				{
					text = $"Buy\n{cost}g"
				};
			}
			else if (flag2)
			{
				val5 = new Button
				{
					text = "Equipped"
				};
				((VisualElement)val5).SetEnabled(false);
			}
			else
			{
				val5 = new Button((Action)delegate
				{
					PickaxeEquipState.EquippedID = def.ItemID;
					RebuildPickaxesTab(instance);
				})
				{
					text = "Equip"
				};
			}
			((VisualElement)val5).style.marginTop = StyleLength.op_Implicit(6f);
			val.Add((VisualElement)(object)val5);
			return val;
		}
	}
}